bugGNU Octave - Bugs: bug #43344, specfun: Jacobian elliptic dn()...

 
 

bug #43344: specfun: Jacobian elliptic dn() precision loss

Submitter:  Hartmut Henkel <hhenkel>
Submitted:  Wed 01 Oct 2014 09:26:01 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  Hartmut Henkel Open/Closed:  * Closed
Release:  * other Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 02 Oct 2014 03:38:25 AM UTC, comment #1: 

Thanks for your bug report. The ellipj function has been incorporated into Octave beginning with version 3.8.0, the one provided by the specfun package has been removed (although I'm not sure if the specfun package has seen a release since then). I applied your change to the ellipj function in Octave's library and added a test case for continuity as suggested by your examples.

http://hg.savannah.gnu.org/hgweb/octave/rev/068a3e51b7b8

As a point of comparison, scipy seems to suffer from the same bug, see https://github.com/scipy/scipy/issues/3904.

Mike Miller <mtmiller>
Group Member
Wed 01 Oct 2014 09:26:01 PM UTC, original submission:  

Bug in specfun-1.1.0.tar.gz, file ellipj.cc, function sncndn() in line 116: dn(K(m),m) gives wrong result. Error demonstration:


octave:3> [s,c,d]=ellipj(ellipke(0.5),0.5)
s =  1
c =  6.1230e-17
d =  0.99997 <------ WRONG
octave:4> [s,c,d]=ellipj(ellipke(0.5)+1e-12,0.5)
s =  1
c = -7.0715e-13
d =  0.70697
octave:5> [s,c,d]=ellipj(ellipke(0.5)+1e-3,0.5)
s =  1.00000
c = -7.0711e-04
d =  0.70711


Bug is known already since approx. 2001, see e. g.,
http://bugs.alglib.net/view.php?id=573

sn() and cn() are not affected. Fix is straight-forward: Use dn() definition from A&S 16.1.5. Patch is attached.

Hartmut Henkel <hhenkel>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #32208:  ellipj.cc.patch added by hhenkel (268B - text/x-diff - Patch file,1 line to be changed.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by jordigh (Updated the item)
  • -email is unavailable- added by hhenkel (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-10-02 mtmiller CategoryOctave Package Octave Function
        StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2014-10-01 jordigh StatusNone Patch Submitted
    2014-10-01 hhenkel Attached File- Added ellipj.cc.patch, #32208

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code