[SciPy-User] Strange behavior of sph_jn

Travis Oliphant travis@continuum...
Wed Apr 11 08:48:35 CDT 2012

Thanks for this excellent feedback.    It would be very helpful if you could file a bug at


That way we we don't lose track of the problem you ran in to.   The algorithm should be adjusted to handle these values. 

Best regards,


On Apr 10, 2012, at 8:49 AM, ZIEGLER Yann (ETU EOT) wrote:

> Hi,
> It seems that the bug I have with sph_jn for some values is due to scipy
> itself. I finded someone having the same kind of trouble on 
> projects.scipy.org/scipy (the website seems to have some technical problems
> at this time).
> If anyone is interested in it, here is the solution I have finded to
> circumvent this bug :
> Using the definition of Spherical Bessel function involving Bessel function
> (http://functions.wolfram.com/Bessel-TypeFunctions/SphericalBesselJ/02/),
> I wrote -- nothing extraordinary, this is a 2-lines function -- my own
> SphericalBessel function (naive but seemingly correct) for positive or
> negative order n and complex argument z : 
> import numpy as np
> from scipy.special import jn
> def SphericalBessel(n,z):
>   zsqrt = np.sqrt(np.abs(z)) * np.exp(np.angle(z)/2)
>   return np.sqrt(np.pi/2) / zsqrt * jn(n+0.5, z)
> Yann
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120411/67d2ee18/attachment.html 

More information about the SciPy-User mailing list