[SciPy-user] Bug in scipy.special.ivp

David M. Cooke cookedm at physics.mcmaster.ca
Thu Jun 15 03:07:08 CDT 2006


On Tue, 13 Jun 2006 17:22:26 -0600
Travis Oliphant <oliphant.travis at ieee.org> wrote:

> Takanobu Amano wrote:
> > Hello,
> >
> > I found a small bug in scipy.special.ivp (scipy/Lib/special/basic.py)
> > this patch is for the latest svn snapshot (revision 1882).
> >
> > Takanobu Amano
> >
> > --- basic.py.orig       2006-06-13 14:29:05.766772544 +0900
> > +++ basic.py    2006-06-13 14:23:58.534420748 +0900
> > @@ -168,7 +168,7 @@
> >      if n == 0:
> >          return iv(v,z)
> >      else:
> > -        return (ivp(v-1,z,n-1) - ivp(v+1,z,n-1))/2.0
> > +        return (ivp(v-1,z,n-1) + ivp(v+1,z,n-1))/2.0
> >
> >   
> Nice catch.  Thank you.  The other modified Bessel Function also has an 
> incorrect  recurrence relation.  Thank you for finding this.

I've replaced all the Bessel function derivatives with with a non-recursive
version. This lead to finding that the Bessel functions (jv, yv, iv,
kv, hankel1, and hankel2) didn't handle negative orders correctly, which
I've fixed. Plus more test cases (mostly for kvp, b/c that's the weirdest
one).

[The recurrence is probably fine, but I wouldn't have found the errors
otherwise :D]

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca



More information about the SciPy-user mailing list