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