operations(): Examples of linear algebra operations Matrix-vector multiplication: A*x=y A [[1 2 3] [4 5 6] [7 8 0]] x [1 2 3] y = np.matmul(A,x) = A*x: [14 32 23] Given A, y, solve A*x=y for x A [[1 2 3] [4 5 6] [7 8 0]] y [14 32 23] x = np.linalg.solve(A,y) [1. 2. 3.] Verify by computing A*x: [14. 32. 23.] Try power method for a symmetric matrix with positive eigenvalues 0 2.982062490439092 1 4.409620360315209 2 4.417304707497886 3 4.417445579257894 4 4.417452841446047 5 4.417453318476534 6 4.4174533519433625 7 4.417453354333066 8 4.4174533545044845 9 4.417453354516794 Estimated dominant eigenvalue is 4.417453354516794 Estimated dominant eigenvector [0.5273854 0.46592293 0.54137524 0.46010142] np.linalg.eig() returns 4.417453354517752 np.linalg.dominant eigenvector [0.52738541 0.46592283 0.54137519 0.46010157] Estimate matrix norm ||A|| = max ||Ax|| / ||x|| A_norm = 13.201458618948678 A_norm_estimate = 13.121967004653577