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
|
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
|