Last active
May 13, 2019 17:40
-
-
Save tanveer-sayyed/ef32834d8d1f82465aab3227378f70ec to your computer and use it in GitHub Desktop.
cosmetic
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
A = np.array([[1, 4], [2, 3]]) | |
lambdas, eigenVectors = np.linalg.eig(A) | |
eigenVectors = Scaling_Eigen_Vectors(eigenVectors= eigenVectors) | |
print('lambdas: \n', lambdas) | |
Λ = np.around(np.linalg.inv(eigenVectors).dot(A).dot(eigenVectors), | |
decimals= 8) | |
print('diagonalized lambdas (Λ): \n', Λ) | |
# power of matrix = 20 | |
print('With factorization: \n', eigenVectors.dot(Λ**20).dot(np.linalg.inv(eigenVectors))) | |
print('Without factorization: \n', M .dot(M).dot(M).dot(M).dot(M).dot(M). | |
dot(M).dot(M).dot(M).dot(M).dot(M).dot(M) | |
.dot(M).dot(M).dot(M).dot(M).dot(M).dot(M) | |
.dot(M).dot(M)) | |
Output: | |
lambdas: | |
[-1. 5.] | |
diagonalized lambdas (Λ): | |
[[-1. 0.] | |
[ 0. 5.]] | |
With factorization: | |
[[3.69159090e+16 5.44817274e+16 9.34547768e+16] | |
[4.41426087e+16 6.51471315e+16 1.11749589e+17] | |
[9.86243361e+16 1.45553079e+17 2.49673259e+17]] | |
Without factorization: | |
[[ 36915909407920134 54481728070503621 93454777850116815] | |
[ 44142609209910003 65147132222165457 111749589908542773] | |
[ 98624337280413624 145553080257859158 249673262259637809]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment