The svs are
1.99991695e-01,   1.99991682e-01,   6.84719250e-10
so if you try

>>> np.linalg.pinv(a,1e-5)
array([[ 0.41097834,  3.12024106, -3.26279309],
        [-3.38526587,  0.30274957,  1.89394811],
        [ 2.98692033, -2.30459609,  0.28627222]])

you at least get an answer that's not near-random.

w

On Wed, 10 Aug 2011, Nadav Horesh wrote:

> The matrix in singular, so you can not expect a stable inverse.
>
>   Nadav.
>
> ________________________________
> From: numpy-discussion-boun...@scipy.org [numpy-discussion-boun...@scipy.org] 
> On Behalf Of jp d [yo...@yahoo.com]
> Sent: 11 August 2011 03:50
> To: numpy-discussion@scipy.org
> Subject: [Numpy-discussion] matrix inversion
>
> hi,
> i am trying to invert matrices like this:
> [[ 0.01643777 -0.13539939  0.11946689]
> [ 0.12479926  0.01210898 -0.09217618]
> [-0.13050087  0.07575163  0.01144993]]
>
> in perl using Math::MatrixReal;
> and in various online calculators i get
> [  2.472715991745  3.680743681735 -3.831392002314 ]
> [ -4.673105249083 -5.348238625096 -5.703193038649 ]
> [  2.733966489601 -6.567940452290 -5.936617926811 ]
>
> using python , numpy and linalg.inv (or linalg.pinv) i get  a divergent answer
> [[  6.79611151e+07   1.01163031e+08   1.05303510e+08]
> [  1.01163057e+08   1.50585545e+08   1.56748838e+08]
> [  1.05303548e+08   1.56748831e+08   1.63164381e+08]]
>
> any suggestions?
>
> thanks
> jpd
>
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to