Error in linalg.inv ??

John Machin sjmachin at lexicon.net
Sat Jun 6 18:09:57 EDT 2009


Robert Kern <robert.kern <at> gmail.com> writes:

> 
> On 2009-06-06 00:34, Ajith Kumar wrote:

> > from numpy import *
> 
> Please ask numpy questions on the numpy mailing list, not here:
> 
>    http://www.scipy.org/Mailing_Lists
> 
> > a = arange(1.,10.)
> > b = reshape(a, [3,3])
> > c = linalg.inv(b)
> >
> > And the result is
> >
> > [[ 3.15221191e+15 -6.30442381e+15 3.15221191e+15]
> > [ -6.30442381e+15 1.26088476e+16 -6.30442381e+15]
> > [ 3.15221191e+15 -6.30442381e+15 3.15221191e+15]]

(gibberish)

> 
> You have a very singular matrix (2*a[1] - a[0] == a[2]). You cannot invert it 
> numerically and expect sensible results.

Is raising an exception (as documented
(http://docs.scipy.org/doc/numpy/reference/generated/numpy.linalg.inv.html)) not
a "sensible result"? 







More information about the Python-list mailing list