python program to find eigenvalues and eigenvectors code example
Example 1: eigenvectors python
In [1]: import numpy as np
In [2]: K=np.random.normal(size=(2,2))
In [3]: eigenvalues, eigenvectors = np.linalg.eig(K)
In [4]: eigenvectors
Out[4]:
array([[ 0.83022467+0.j , 0.83022467+0.j ],
[ 0.09133956+0.54989461j, 0.09133956-0.54989461j]])
In [5]: eigenvectors.shape
Out[5]: (2, 2)
Example 2: how to find eigenvalues in python
A = np.array([[1,0],[0,-2]])
print(A)