9951 explained code solutions for 126 technologies


python-numpyCalculate inverse matrix


import numpy as np
mtx = np.array([[1, 2], [3, 4]])
inv = np.linalg.inv(mtx)ctrl + c
import numpy as np

load Numpy module for Python

[[1, 2], [3, 4]]

sample matrix data (2-dimensional array)

.linalg.inv(

returns inverse (multiplicative) matrix for the given one

inv

will contain inverse matrix