I think I should have the same result using both methods (In[4]
and In[5]
). What's wrong? I can tell the correct is In[5]
.
In [1]: import numpy as np
In [2]: A = np.mat('1 2 3; 4 5 6; 7 8 9')
In [3]: B = np.mat('10;20;30')
In [4]: A.I*B
Out[4]:
matrix([[ 64.],
[-64.],
[ 16.]])
In [5]: np.linalg.solve(A,B)
Out[5]:
matrix([[-0.93333333],
[ 1.86666667],
[ 2.4 ]])