# [Scipy-tickets] [SciPy] #1114: scipy.special.sph_jn produces NaN result for large z

SciPy Trac scipy-tickets@scipy....
Thu Mar 4 04:24:32 CST 2010

```#1114: scipy.special.sph_jn produces NaN result for large z
---------------------------+------------------------------------------------
Reporter:  juya           |       Owner:  pv
Type:  defect         |      Status:  new
Priority:  normal         |   Milestone:  0.8.0
Component:  scipy.special  |     Version:  0.7.0
Keywords:  sph_jn, NaN    |
---------------------------+------------------------------------------------

Comment(by paulcristini):

I confirm the bug but in a different form. The function sph_yn is correct
and using the half integer order bessel function form gives correct
results except for yn(n+1/2).
But jn+1/2 should not work but gives correct results. There is a misprint
in the documentation. As  I understand jn should be for integer orders.

mx, k0r = 3, 10000

jl, jlp = sph_jn(mx-1,k0r)

yl, ylp = sph_yn(mx-1,k0r)

jl: [ NaN  NaN  NaN]

yl: [  9.52155368e-05   3.05709604e-05  -9.52063655e-05]

print 'jn+1/2:', jn(arange(mx)+0.5,k0r)*sqrt(pi/2./k0r)

print 'yn+1/2:', yn(arange(mx)+0.5,k0r)*sqrt(pi/2./k0r)

print 'jv+1/2:', jv(arange(mx)+0.5,k0r)*sqrt(pi/2./k0r)

print 'yv+1/2:', yv(arange(mx)+0.5,k0r)*sqrt(pi/2./k0r)

jn+1/2: [ -3.05614389e-05   9.52124807e-05   3.05900026e-05]

yn+1/2: [  4.57184628e-05   8.89394669e-05  -4.57006749e-05]  #Not
correct!

jv+1/2: [ -3.05614389e-05   9.52124807e-05   3.05900026e-05]

yv+1/2: [  9.52155368e-05   3.05709604e-05  -9.52063655e-05]

--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1114#comment:1>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
```