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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | >>> 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