Skip to content

Instantly share code, notes, and snippets.

@YHaruoka
Created June 24, 2022 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YHaruoka/02c3191dda777410687d9b04ea398477 to your computer and use it in GitHub Desktop.
Save YHaruoka/02c3191dda777410687d9b04ea398477 to your computer and use it in GitHub Desktop.
import numpy as np
matrix1 = np.array([[3, 4],
[1, 1]])
matrix1_inv = np.linalg.inv(matrix1)
print(matrix1_inv)
print(np.dot(matrix1,matrix1_inv))
matrix2 = np.array([[1, 1, 2],
[3, -1, 2],
[2, 1, 1]])
matrix2_inv = np.linalg.inv(matrix2)
print(matrix2_inv)
print(np.dot(matrix2,matrix2_inv))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment