2025-09-10:仓库迁移
This commit is contained in:
16
3.数字日期和时间/10.矩阵和线性代数的计算.py
Normal file
16
3.数字日期和时间/10.矩阵和线性代数的计算.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import numpy as np
|
||||
|
||||
if __name__ == '__main__':
|
||||
# np在线性代数处理上有一个子包叫matrix,专门使用线性代数规则来处理数据,比如矩阵乘法、求行列式和解线性方程
|
||||
m = np.matrix([[1,-2,3],[0,4,5],[7,8,-9]])
|
||||
print(m)
|
||||
|
||||
# 做一个矩阵转置
|
||||
print(m.T)
|
||||
# 求可逆矩阵
|
||||
print(m.I)
|
||||
|
||||
v = np.matrix([[2], [3], [4]])
|
||||
print(m * v)
|
||||
|
||||
# 更多线代操作在np.linalg模块下可以找到,随用随查就行
|
Reference in New Issue
Block a user