linalg.det
Description
Compute the determinant of an array.
Mandatory Input Parameters
Parameter |
Type |
Description |
|---|---|---|
a |
array_like |
Input array |
Optional Input Parameters
None
Return Value
Type |
Description |
|---|---|
ndarray |
Determinant of a |
Examples
>>> import numpy as np
>>> # The determinant of a 2-D array [[a, b], [c, d]] is ad - bc.
>>> a = np.array([[1,2],[3,4]])
>>> a
array([[1, 2],
[3, 4]])
>>>
>>> np.linalg.det(a)
-2.0
>>>
>>> a = np.array([[[1,2],[3,4]], [[1,2],[2,1]], [[1,3],[3,1]]])
>>> a
array([[[1, 2],
[3, 4]],
[[1, 2],
[2, 1]],
[[1, 3],
[3, 1]]])
>>>
>>> np.linalg.det(a)
array([-2., -3., -8.])
>>>
Parent topic: Linear Algebra Functions