行向量代码:
vec = [-2003.23, 2.25, -1006.11, 2.71, 12.01]
矩阵代码:
mat = [[9181717.56, 5242.14, 2985241.78, -5398.06, -57206.92],
[5242.14, 175.32, -949.18, 59.62, 393.27],
[2985241.78, -949.18, 1128278.89, -1922.71, -28170.35],
[-5398.06, 59.62, -1922.71, 54.89, 228.69],
[-57206.92, 393.27, -28170.35, 228.69, 1771.96]]
逆矩阵代码:
import numpy as np
inv_mat = np.linalg.inv(mat)
列向量代码:
col_vec = np.array([-2003.23, 2.25, -1006.11, 2.71, 12.01]).reshape(-1, 1)
乘积代码:
result = np.dot(inv_mat, col_vec)
print(result) # 打印结果