帮我生成计算这个1行5列的行向量[-2003.23,2.25,-1006.11,2.71,12.01]和5行5列矩阵[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]的逆和5行1列的列向量[-2003.23,2.25,-1006.11,2.71,12.01]的乘积的代码
时间: 2023-05-27 09:04:23 浏览: 116
行向量代码:
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) # 打印结果
阅读全文