Opened 2 years ago

Closed 3 months ago

#810 closed defect (fixed)

J1(x) returns NaN for x << 0

Reported by: pkienzle Owned by:
Priority: minor Milestone: SasView Next Release +1
Component: SasView Keywords:
Cc: Work Package: SasView Bug Fixing

Description

The cephes math function for J1 in lib/sas_J1.c returns NaN for values of x << 0.

Mathematica says J1(-x) = -J1(x) (http://www.wolframalpha.com/input/?i=J_1(-x)). The series expansion as given in the DLMF (http://dlmf.nist.gov/10.2) supports this.

The code in sas_J1.c is the same as that in the cephes library, so rather than a translation error, it appears to be an error in the cephes library itself.

Change History (1)

comment:1 Changed 3 months ago by pkienzle

  • Resolution set to fixed
  • Status changed from new to closed

This looks like it has been fixed.

The code in sasmodels/models/lib/sas_J1.c says:

    // 2017-05-18 PAK - mathematica and mpmath use J1(-x) = -J1(x)
Note: See TracTickets for help on using tickets.