导入相关的包
from numpy.linalg import *
import numpy as np
设定输出精度
np.set_printoptions(precision=3, suppress=True)
矩阵数乘和矩阵乘法
print(A * A)
print(np.dot(A, A))
初始化矩阵A, 且A为可逆矩阵
list1 = [2, 2, 3, 1, -1, 0, -1, 2, 1]
A = np.array(list1).reshape(3, 3)
print(A)
求矩阵的行列式
A_det = det(A)
print(A_det)
求矩阵的逆矩阵
A_inverse = inv(A)
print(A_inverse)
求矩阵的伴随矩阵
A_adjoint = A_inverse * A_det
print(A_adjoint)
求矩阵的特征值和特征向量
eigenvalue, eigenvector = eig(A)
print(eigenvalue)
print(eigenvector)