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)
Here is what the above code is Doing:
1. We’re importing the numpy library as np.
2. We’re creating a random 2×2 matrix K.
3. We’re finding the eigenvalues and eigenvectors of K.
4. We’re printing the eigenvectors.
5. We’re printing the shape of the eigenvectors.