And matrix to use determinant MUST BE square (i.e. have the same number of rows as columns).
You better if have a look of this link:
https://www.mathsisfun.com/algebra/matrix-determinant.html
Example 1
Using determinant to calculate this matrix :We use this rule to multiply elements in matrix where Blue is positive (+ad) and Red is negative (−bc) :
With python, we can use det() method to get the result.
import numpy as npResult :
from scipy import linalg as la
A = np.array([[3,8],[4,6]])
print(la.det(A))
-14.0
Example 2
det(A) = | A | = (1*4)-(2*3) = 4 - 6 = - 2.0Calculation with python :
import numpy as npResult :
from scipy import linalg as la
A = np.array([[1,2],[3,4]])
print(A)
B = la.det(A)
print(B)
[[1 2]
[3 4]]
-2.0
Example 3
Let use python with package numpy and linalg to represent the determinant of this 3×3 matrix:import numpy as npResult:
from scipy import linalg as la
A = np.array([[6,1,1],[4,-2,5],[2,8,7]])
print(A)
B = la.det(A)
print(B)
[[ 6 1 1]
[ 4 -2 5]
[ 2 8 7]]
-306.0
No comments :
Post a Comment