Python – scipy.linalg.det
scipy.linalg 包含一组用于线性代数的不同的功能。其中之一是 det() 函数。此函数用于求二阶矩阵的行列式。
语法
scipy.linalg.det(x)
其中 x 是一个方阵。
示例 1
让我们考虑以下示例 −
# 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)输出
它将生成以下输出 −
Input Matrix : [[8 5] [3 4]] Determinant Value of A: 17.0
示例 2
让我们考虑以下示例 −
# 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
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP