GNU Scientific Library - Bugs: bug #54998, Bugs in gsl_sf_hyperg_2F1
You are not allowed to post comments on this tracker with your current authentication level.
bug #54998: Bugs in gsl_sf_hyperg_2F1
Submitter: | Ludvig af Klinteberg <ludvigak> | ||
Submitted: | Sat 10 Nov 2018 12:42:24 AM UTC | ||
Category: | Accuracy problem | Severity: | 3 - Normal |
Operating System: | Status: | None | |
Assigned to: | None | Open/Closed: | Open |
Release: | 2.5 |
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
Carbon-Copy List
No changes have been made to this item
Powered by Savane 3.13-bb6a.
Corresponding source code
For some reason hyperg_2F1_reflect computes the wrong value when c-a-b is integer, and a and b are of opposite signs, e.g.
gsl_sf_hyperg_2F1_e(-0.25, 0.25, 1.0, 0.9, &r)
=> 0.8800433809321181 (should be 0.92058925138209276)
I don't have access to Moshier, so I can't tell if it's due to the "reflection" method or just a bug. However, hyperg_2F1_series appears to compute the correct value for these cases, so a workaround is to use that when a and b are of opposite signs:
https://github.com/ludvigak/gsl/commit/bc27ee844907567bb11b6acc9c6343bfd8ba5438
This appears to fix some of the issues mentioned in bugs #39056, #32306, #21835.
In addition, the fix introduced in commit 9163448f5e0bfa3591a2535c16a2e37386b91171 could use some amendment. First, it uses a stopping criterion of two terms, not the three that Pearson recommends. Second, the new stopping criterion doesn't associate an error estimate with the new termination criteria. This gives an error estimate of O(1) when it's used:
gsl_sf_hyperg_2F1_e(-0.25, 0.25, 1, 0.25, &r)
=> val=0.9833426507751653, err=1.0000000000000049
This can be fixed as:
https://github.com/ludvigak/gsl/commit/da629add7f0a5228dc7ab965c7c6ef88e60486d0