[SciPy-User] Strange behavior of sph_jn
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.
On Apr 10, 2012, at 8:49 AM, ZIEGLER Yann (ETU EOT) wrote:
> 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
> 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)
> SciPy-User mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User