Error in linalg.inv ??

Carl Banks pavlovevidence at
Sun Jun 7 01:08:52 CEST 2009

On Jun 6, 3:31 pm, Robert Kern <robert.k... at> wrote:
> On 2009-06-06 17:09, John Machin wrote:
> > Robert Kern<robert.kern<at>>  writes:
> >> 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
> > ( not
> > a "sensible result"?
> That's not the way I was using the phrase, but you have a point.
> We depend on the underlying LAPACK routine to tell us if the array is singular
> or not.

Perhaps the documentation should be updated to say "Raises LinAlgError
if inv() detects that 'a' a singular matrix".

Anyone with much experience with linear algebra libraries should know
that these routines are shaky when ill-conditioned, but it could help
newbies and computer science experts to be explicit about it.

Carl Banks

More information about the Python-list mailing list