Created
March 14, 2017 14:23
-
-
Save Xorgon/68fe6598017eb854f36ddc33c8245e5b to your computer and use it in GitHub Desktop.
Solving an eigenvalue problem in Python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
matrix = np.array([[0., 0.16, 0., -9.81], | |
[-0.1250, -0.5, 212., 0.], | |
[0., -0.0082, -0.5, 0.], | |
[0., 0., 1., 0.]]) | |
print("Matrix:\n" + str(matrix)) | |
# Get the eigenvalues (eig returns tuple with eigenvalues and eigenvectors) | |
eigenvalues = np.linalg.eig(matrix)[0] | |
print("\nEigenvalues:") | |
for eigenvalue in eigenvalues: | |
print(eigenvalue) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment