JuliaMath / HypergeometricFunctions.jl

A Julia package for calculating hypergeometric functions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is 1F1 broken?

MikaelSlevinsky opened this issue · comments

Thank you in advance for your bug report @ioannisPApapadopoulos @TSGut

Sorry! So actually before I even get to the change that affected me, 1F1 seems to throw warning for certain values of x. E.g.

_₁F₁.(5/6,1/2,-4.9^2)
┌ Warning: Rational approximation to ₂F₀ reached the maximum type of (1048576, 1048576).
└ @ HypergeometricFunctions C:\Users\john.papad\.julia\dev\HypergeometricFunctions\src\weniger.jl:98
-0.03244131055572879

This comes from the recent commit df46b74

If I fix to the commit 089e208 (commit before the warning comes in) then it's actually quite tricky to nail down a specific change because quite a few come in.

e.g.

x = -5:0.1:5;
git checkout 089e208d5869dd09b0f12010dd28d1026a18a0ca
new = _₁F₁.(5/6,1/2,-x.^2)
git checkout 98eab44b111549e5c20e238748f34658ac3e23f1
old = _₁F₁.(5/6,1/2,-x.^2)
norm(new-old, Inf)
>> 0.00019090947307336126

If I compare to older commits, then the difference is even bigger

x = -5:0.1:5;
git checkout 089e208d5869dd09b0f12010dd28d1026a18a0ca
new = _₁F₁.(5/6,1/2,-x.^2)
git checkout 318473b6b123f30f6b9d9b65dbddb706977f288c
old = _₁F₁.(5/6,1/2,-x.^2)
norm(new-old, Inf)
>> 0.00021717676628874028

Wowza! I wonder what's gonna happen to the guy who pushed those changes

This is my favourite Julia package.

Maybe these bugs can be avoided by just writing a MeijerGFunctions.jl and have this package call that?