Eigenvalues & Eigenvectors
Imagine a wire which is stretched but its direction does not change.
- Eigenvector: That sturdy pole. A direction that doesn't change.
- Eigenvalue: How much the pole got stretched (e.g., if it got twice as tall, the eigenvalue is 2).
Python Implementation
Finding eigenvectors is mathematically complex, but numpy.linalg does it in one line!
import numpy as np
# Define a transformation matrix (our "tornado")
matrix = np.array([
[4, -2],
[1, 1]
])
# Calculate Eigenvalues and Eigenvectors
eigenvalues, eigenvectors = np.linalg.eig(matrix)
print("Eigenvalues (How much it stretched):\n", eigenvalues)
print("Eigenvectors (The sturdy poles):\n", eigenvectors)