Error in linalg.inv ??

Ajith Kumar ajith at iuac.res.in
Sat Jun 6 01:34:10 EDT 2009


Hello,
 I ran the following code (Using Debian 5.0)

from numpy import *
a = arange(1.,10.)
b = reshape(a, [3,3])
c = linalg.inv(b)
print b
print c
print dot(b,c)
print dot(c,b)

And the result is

[[ 1.  2.  3.]
 [ 4.  5.  6.]
 [ 7.  8.  9.]]

[[  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]]

[[-0.5 -1.  -1. ]
 [-1.  -2.   2. ]
 [-1.5 -3.   1. ]]

[[  5.5   8.   10.5]
 [  3.    0.   -3. ]
 [ -1.    0.   -3. ]]

NOT the identity matrix. Any help ?

Thanks

Ajith Kumar




More information about the Python-list mailing list