scipy.special.jn(2,0) returns nan (Trac #215) #742

Closed
scipy-gitbot opened this Issue Apr 25, 2013 · 3 comments

Comments

Projects
None yet
1 participant
@scipy-gitbot

Original ticket http://projects.scipy.org/scipy/ticket/215 on 2006-06-22 by @dmcooke, assigned to @dmcooke.

scipy.special.jn(2,0.000000000)
nan

while

scipy.special.jv(2,0)
0.0

scipy.version
'0.5.0.1991'

@scipy-gitbot

This comment has been minimized.

Show comment Hide comment
@scipy-gitbot

scipy-gitbot Apr 25, 2013

@dmcooke wrote on 2006-06-22

Changed cc: to nils.

@dmcooke wrote on 2006-06-22

Changed cc: to nils.

@scipy-gitbot

This comment has been minimized.

Show comment Hide comment
@scipy-gitbot

scipy-gitbot Apr 25, 2013

trac user JohnByrnes wrote on 2006-06-22

The problem lies in scipy/Lib/special/cephes/jn.c on line 85.

if( n == 2 )
return( sign * (2.0 * j1(x) / x - j0(x)) );

In the jn(2,0) case, we end up dividing by zero. The recurrence relationship for higher orders doesn't seem to end up doing this.

trac user JohnByrnes wrote on 2006-06-22

The problem lies in scipy/Lib/special/cephes/jn.c on line 85.

if( n == 2 )
return( sign * (2.0 * j1(x) / x - j0(x)) );

In the jn(2,0) case, we end up dividing by zero. The recurrence relationship for higher orders doesn't seem to end up doing this.

@scipy-gitbot

This comment has been minimized.

Show comment Hide comment
@scipy-gitbot

scipy-gitbot Apr 25, 2013

@dmcooke wrote on 2006-06-22

Fixed in 29ea57d. For x < 1e-5, I use x2/8 - x4/96 instead of the recurrence relation.

@dmcooke wrote on 2006-06-22

Fixed in 29ea57d. For x < 1e-5, I use x2/8 - x4/96 instead of the recurrence relation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment