Matrice inverse Python
import numpy as np
# X is the matrix to invert
X_inverted = numpy.linalg.inv(X)
Four Horned Antelope
import numpy as np
# X is the matrix to invert
X_inverted = numpy.linalg.inv(X)
#You can either use the included inv fucntion
M_inverse = numpy.linalg.inv(M)
#Or use the exponent notation, which is also understood by numpy
M_inverse = M**(-1)
from numpy.linalg import inv
a = np.array([[1., 2.], [3., 4.]])
ainv = inv(a)
np.allclose(np.dot(a, ainv), np.eye(2))
True
np.allclose(np.dot(ainv, a), np.eye(2))
True