[Numpy-discussion] matrix inversion
Martin Teichmann
lkb.teichmann at gmail.com
Thu Aug 11 02:41:06 EDT 2011
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 ]
well, inverting latter matrix, I get
>>> n=np.mat([[ 2.472715991745 , 3.680743681735 ,-3.831392002314 ],
[ -4.673105249083, -5.348238625096, -5.703193038649 ],
[ 2.733966489601, -6.567940452290, -5.936617926811 ]])
>>> n.I
matrix([[ 0.01643777, -0.13539939, 0.11946689],
[ 0.12479926, 0.01210898, -0.09217618],
[-0.13050087, -0.07575163, -0.01144993]])
Which is nearly the same matrix as the matrix you started with,
but quite. There are some minus signs more in the last two
values... sure you didn't forget these? Adding them by hand
gives nearly the same value as your Perl result, but better,
the residua on the off diagonals are significantly lower.
Greetings
Martin
More information about the NumPy-Discussion
mailing list