bugGNU Scientific Library - Bugs: bug #45926, error in generalized...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #45926: error in generalized hypergeometric function

Submitter:  Patrick Alken <psa>
Submitted:  Fri 11 Sep 2015 10:09:01 AM UTC
   
 
Category:  Runtime error Severity:  3 - Normal
Operating System:  Status:  Fixed
Assigned to:  None Open/Closed:  Closed
Release: 

Sat 12 Dec 2015 10:24:36 PM UTC, comment #2: 

fixed in commit 9163448f5e0bfa3591a2535c16a2e37386b91171

Patrick Alken <psa>
Group administrator
Thu 19 Nov 2015 10:16:38 PM UTC, comment #1: 

from shufflesky =at= hotmail =dot= com

I've investigated bug #45929 "error in generalized hypergeometric function". The problem is in the
file specfunc/hyperg_2F1.c in the first function the file, hyperg_2F1_series(). There is a loop starting
at line 59 which is intended to converge to the solution, and within this loop is a check to insure the
loop is not executed more than 30000 times. This code is actually working and computing the correct
value, but the error terms del_pos and del_neg eventually get no smaller and so the loop executes the
full 30000 iterations and then reports GSL_EMAXITER error, even though it does have the correct
value calculated.

I would fix this by saving the previous error terms and insuring they are becoming smaller with each
iteration. If they are not getting smaller, machine precision has been reached and the value can be
returned to the user. I can supply code or could check in myself through git if I can get access. I have
30+ years of experience with C code and want to begin helping maintain GSL.

-Bill Maier   

Patrick Alken <psa>
Group administrator
Fri 11 Sep 2015 10:09:01 AM UTC, original submission:  

from aim =at= stats =dot= uwo =dot= ca

The bug I am reporting arose when I tried to the gsl package in R:
gsl: wrapper for the Gnu Scientific Library

The authors of the gsl package have determined that the error is in the Gnu
Scientific Library.

The problem arises with the generalized hypergeometric function and is illustrated
in the code below. Please excuse my odd syntax where I used 1+9 etc instead of 10
etc. Both Mathematica and MatLab get the result correct.

Browse[2]> hyperg_2F1(-0.2,-0.2 + 9,1 + 9,0.8)
[1] 0.7799897
Browse[2]> hyperg_2F1(-0.2,-0.2 + 10,1 + 10,0.8)
[1] NaN


MATHEMATICA GETS IT CORRECT
Hypergeometric2F1[-0.2, -0.2+9, 1+9, 0.8]
0.77999
Hypergeometric2F1[-0.2, -0.2+10, 1+10, 0.8]
0.775746

MATLAB GETS IT CORRECT

>> hypergeom([-0.2,-0.2+9],1+9,0.8)


ans =

    0.7800

>> hypergeom([-0.2,-0.2+10],1+10,0.8)


ans =

    0.7757


Patrick Alken <psa>
Group administrator

 

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

Attached Files
file #35719:  bug45926.tar.gz added by psa (17KiB - application/gzip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psa (Submitted the item)
  •  

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-12-12 psa StatusNone Fixed
        Open/ClosedOpen Closed
    2015-12-12 psa Attached File- Added bug45926.tar.gz, #35719

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code