numpy.linalg.det() Method in Python
Last Updated :
29 Jul, 2021
In NumPy, we can compute the determinant of the given square array with the help of numpy.linalg.det(). It will take the given square array as a parameter and return the determinant of that.
Syntax: numpy.linalg.det()
Parameter: An square array.
Return: The determinant of that square array.
Example 1:
Python
import numpy as np
from numpy import linalg as LA
array1 = np.array([[ 1 , 2 ], [ 3 , 4 ]])
print (array1)
print (np.linalg.det(array1))
|
Output:
[[1 2]
[3 4]]
-2.0000000000000004
Example 2:
Python
import numpy as np
from numpy import linalg as LA
array1 = np.array([[ 1 , 2 , 3 ], [ 3 , 4 , 1 ], [ 3 , 2 , 1 ]])
print (array1)
print (np.linalg.det(array1))
|
Output:
[[1 2 3]
[3 4 1]
[3 2 1]]
-15.999999999999998
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...