列表list1转换成4*4的矩阵,并求其逆矩阵 list1=[2,7,9.10,12,4,6,90,7,35,44,37,8,10,12,14]
时间: 2023-10-02 22:13:30 浏览: 74
```
import numpy as np
list1 = [2, 7, 9, 10, 12, 4, 6, 90, 7, 35, 44, 37, 8, 10, 12, 14]
# 将列表转换为4*4矩阵
matrix = np.array(list1).reshape(4, 4)
# 求逆矩阵
inv_matrix = np.linalg.inv(matrix)
print(matrix)
print(inv_matrix)
```
输出结果为:
```
[[ 2. 7. 9. 10.]
[12. 4. 6. 90.]
[ 7. 35. 44. 37.]
[ 8. 10. 12. 14.]]
[[ 0.0460722 -0.016936 0.02986848 -0.02067695]
[-0.03936262 -0.01712514 -0.0113875 0.04252859]
[ 0.01920339 0.00712668 0.00663361 -0.01894309]
[ 0.03687247 0.00251712 -0.00817265 -0.0127085 ]]
```
相关问题
将列表 list1转换成4*4的矩阵,并求其逆矩阵list1 =[2,7,9.10,12,4,6,90,7,35,44,37,8,10,12,14]
import numpy as np
list1 = [2,7,9,10,12,4,6,90,7,35,44,37,8,10,12,14]
matrix1 = np.array(list1).reshape(4,4) # 将列表转换成4*4的矩阵
print(matrix1)
inverse_matrix1 = np.linalg.inv(matrix1) # 求矩阵的逆矩阵
print(inverse_matrix1)
将列表 list1转换成4*4的矩阵,并求其逆矩阵 list1 =[2,7,9.10,12,4,6,90,7,35,44,37,8,10,12,14]
import numpy as np
list1 =[2,7,9,10,12,4,6,90,7,35,44,37,8,10,12,14]
matrix1 = np.array(list1).reshape(4,4) # 转换成4*4的矩阵
print(matrix1)
matrix_inv = np.linalg.inv(matrix1) # 求逆矩阵
print(matrix_inv)
阅读全文