hyperg is wrong for large negative x (Trac #659) #1186
Labels
defect
A clear bug or issue that prevents SciPy from being installed or used as expected
Migrated from Trac
scipy.special
Milestone
Original ticket http://projects.scipy.org/scipy/ticket/659 on 2008-04-29 by trac user helias, assigned to unknown.
=== problem ===
The evaluation of hyperg (hyp1f1, real arguments) yields wrong results for large negative x=-30.
The problem appeared with changeset 3012, where Kahan's summation formula was applied. The problem seems to be a too optimistic error estimate in Kahan's summation: The error estimation of hy1f1p (special/cehpes/hyperg.c) is always in the range of machine resolution, but the actual error is much larger due to cancelation in the strongly alternating series (for negative x). Hence, hyperg always returns the result of hy1f1p, even, if hy1f1a would be better (as for large negative x).[[BR]]
Restoring the old error estimation based on the maximum term yields a too high error estimates.
=== possible solution ===
Resorting to the fortran function chgm in specfun/specfun.f also works for negative x=-30.
The text was updated successfully, but these errors were encountered: