9951 explained code solutions for 126 technologies


python-numpyCompute the determinant of an array


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

load Numpy module for Python

np.array

declare Numpy array

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

sample matrix data

np.linalg.det

returns determinant of a given matric

mtx

name of the matrix to get determinant of