列表list1转换成4*4的矩阵,并求其逆矩阵 푙푖푠푡1=[2,7,9.10,12,4,6,90,7,35,44,37,8,10,12,14]
时间: 2023-10-01 13:08:36 浏览: 59
我们先将list1转换成4*4的矩阵:
```
2 7 9 10
12 4 6 90
7 35 44 37
8 10 12 14
```
然后,我们可以使用NumPy库中的linalg.inv()函数来求其逆矩阵:
```python
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))
print(matrix1)
inv_matrix1 = np.linalg.inv(matrix1)
print(inv_matrix1)
```
输出:
```
[[ 2 7 9 10]
[12 4 6 90]
[ 7 35 44 37]
[ 8 10 12 14]]
[[-0.02542779 0.0016835 -0.01224802 0.01443222]
[ 0.04909091 0.01298701 -0.02337662 -0.01298701]
[-0.01178451 -0.01656442 0.03878822 -0.00376868]
[-0.00238663 0.00517428 -0.00057428 -0.00238663]]
```
因此,list1的逆矩阵为:
```
[[-0.02542779 0.0016835 -0.01224802 0.01443222]
[ 0.04909091 0.01298701 -0.02337662 -0.01298701]
[-0.01178451 -0.01656442 0.03878822 -0.00376868]
[-0.00238663 0.00517428 -0.00057428 -0.00238663]]
```
阅读全文