← Back to NumPy Course | Chapter 7: Linear Algebra | Lesson 3 of 6

np.linalg.eig() से Eigenvalues

Eigenvalues और eigenvectors वे directions reveal करते हैं जहाँ एक matrix सिर्फ stretch करता है, और कितना।

In this page:

  1. np.linalg.eig()
Syntax
python
eigenvalues, eigenvectors = np.linalg.eig(matrix)

np.linalg.eig()

np.linalg.eig एक pair return करता है: eigenvalues का एक array और एक matrix जिसके columns matching eigenvectors हैं। ये A v = lambda v satisfy करते हैं। Eigen-decomposition PCA और कई physics और data-science methods का आधार है।

Note: Symmetric matrices के लिए np.linalg.eigh इस्तेमाल करें; यह faster है और real values return करता है।

उदाहरण: np.linalg.eig()

python
import numpy as np

A = np.array([[2, 0], [0, 3]])
vals, vecs = np.linalg.eig(A)
print(sorted(vals))
v = vecs[:, 0]
print(np.allclose(A @ v, vals[0] * v))

# Output:
# [2.0, 3.0]
# True
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. Columns की बजाय rows से eigenvectors पढ़ना
  2. यह मान लेना कि eigenvalues sorted आते हैं
  3. non-symmetric matrices के लिए complex results ignore करना
चैप्टर सारांश
  • eig eigenvalues और eigenvectors return करता है
  • Eigenvectors columns हैं
  • Order guaranteed नहीं है
  • eigh symmetric matrices के लिए suit करता है
🔒

Chapter Quiz — Complete all 6 topics to unlock

0/6 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.