take inverse of matrix numpy code example
Example 1: inverse matrix python
import numpy as np
# X is the matrix to invert
X_inverted = numpy.linalg.inv(X)
Example 2: inverse matrix numpy
#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)
Example 3: numpy function for calculation inverse of a matrix
# python3 inversion of matrix x
inverse = numpy.linalg.inv(x)