Python – scipy.linalg.det


scipy.linalg 包含一组用于线性代数的不同的功能。其中之一是 det() 函数。此函数用于求二阶矩阵的行列式。

语法

scipy.linalg.det(x)

其中 x 是一个方阵。

示例 1

让我们考虑以下示例 −

Open Compiler
# Importing the required libraries from scipy import linalg import numpy as np # Initialize the matrix A A = np.array([[8, 5], [3, 4]]) print("Input Matrix :", A) # Find the determinant of matrix X x = linalg.det(A) print("Determinant Value of A:", x)

Learn Python in-depth with real-world projects through our Python certification course. Enroll and become a certified expert to boost your career.

输出

它将生成以下输出 −

Input Matrix :
[[8 5]
[3 4]]
Determinant Value of A: 17.0

示例 2

让我们考虑以下示例 −

Open Compiler
# Importing the required libraries from scipy import linalg import numpy as np # Initializing the matrix M M = np.arange(6, 10).reshape(2, 2) print("Input Matrix :", M) # Finding the determinant of matrix X x = linalg.det(M) print("Determinant Value of M:", x)

输出

上述程序将生成以下输出 −

Input Matrix :
[[6 7]
[8 9]]
Determinant Value of M: -2.0000000000000053

更新于:2021-12-22

248 次浏览

开启您的职业

完成课程获得认证

开始
广告