[SciPy-User] Strange behavior of sph_jn

Yann ZIEGLER yann.ziegler@etu.unistra...
Thu Apr 5 09:50:37 CDT 2012


Hi everybody,

I noticed a strange behavior of the sph_jn function (and it really  
bothers me!).

Here is a copy-past of what I get (from scipy.special import sph_jn)  
in IPython:

In [1]: sph_jn(2,3350.506)
Out[1]:
(array([  2.98461400e-04,  -6.76491641e-07,  -2.98462005e-04]),
  array([  6.76491641e-07,   2.98461803e-04,  -4.09252598e-07]))

In [2]: sph_jn(2,3350.507)
Out[2]:
(array([             inf,  -3.78029638e-07,             -inf]),
  array([  3.78029638e-07,              inf,              inf]))

As you can see, there is a 'jump' (a very big one!) between 3350.506  
and 3350.507 for some orders and some derivatives. What happens ?
As a point of comparison, Mathematica  
(http://www.wolframalpha.com/input/?i=SpericalBesselJ[2%2C3350.507])  
says:

J_2(3350.507) ~= -0.000298462... wich seems to be far more correct.

Is there any 'numerical disaster' ?

Thanks,

Yann





More information about the SciPy-User mailing list