How to find eigenvalues and eigenvectors using NumPy

You can find the eigenvalues and eigenvectors in Python using NumPy with the following code. If you want to learn Python then I will highly recommend you to read This Book.

How to find eigenvalues and eigenvectors using NumPy
How to find eigenvalues and eigenvectors using NumPy

Step 1

Import the required libraries.

import numpy as np
import numpy.linalg as la

Step 2

Now make a matrix and find the eigenvalues and eigenvectors using la.eig().

a = np.array([[1,2],[3,4]])
eigen_values, eigen_vectors = la.eig(a)

print(eigen_values)
print(eigen_vectors)
Output
[-0.37228132  5.37228132]
[[-0.82456484 -0.41597356]
 [ 0.56576746 -0.90937671]]

People are also reading:

Best Python Books

What is Computer Vision? Examples, Applications, Techniques

Top 10 Computer Vision Books with Python

Books for Machine Learning (ML)

Free Learning Resources

Leave a Comment

Your email address will not be published.