[SciPy-dev] Bug in matfuncs.py

Nils Wagner nwagner at mecha.uni-stuttgart.de
Fri Feb 25 04:36:49 CST 2005


I am reporting a bug in matfuncs.py

Python 2.3.3 (#1, Feb  5 2005, 16:22:10)
[GCC 3.3.3 (SuSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> from scipy import *
numerix Numeric 23.7
 >>> a = zeros((2,2),Float)
 >>> linalg.expm(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.3/site-packages/scipy/linalg/matfuncs.py", line 
32, in expm
    e = int(floor(val))
OverflowError: cannot convert float infinity to long
 >>> linalg.expm2(a)
array([[ 1.,  0.],
       [ 0.,  1.]])
 >>> linalg.expm3(a)
array([[ 1.,  0.],
       [ 0.,  1.]])

The matrix exponential is defined via it's series expansion

exp(x) = 1 + x+ x^2/2! + x^3/3! + \dots + x^n/n!

So exp(zeros((m,m),Float) is the identity of order m.

Nils




More information about the Scipy-dev mailing list