This pull request improves the implementation of acb_hypgeom_gamma_upper by no longer dispatching to acb_hypgeom_gamma_upper_asymp under certain conditions when doing so can be predetermined to give an uninformative result (nan +/- inf). The improvement is particularly noticeable when s is large compared to z and to the number of bits of working precision.
The shaded region of this figure shows where z is too close to the origin for the asymptotic expansion to work, and the scale of that region depends on s. The old code uses the asymptotic expansion when z is outside a disk whose radius is proportional to the working precision, without taking s into account. The new code adds a condition requiring z to also be outside of the shaded region.
This PR does not address the transition region problems when z is near the boundary of the shaded region.
This pull request improves the implementation of
acb_hypgeom_gamma_upper
by no longer dispatching toacb_hypgeom_gamma_upper_asymp
under certain conditions when doing so can be predetermined to give an uninformative result (nan +/- inf). The improvement is particularly noticeable whens
is large compared toz
and to the number of bits of working precision.The shaded region of this figure shows where
z
is too close to the origin for the asymptotic expansion to work, and the scale of that region depends ons
. The old code uses the asymptotic expansion whenz
is outside a disk whose radius is proportional to the working precision, without takings
into account. The new code adds a condition requiringz
to also be outside of the shaded region.This PR does not address the transition region problems when
z
is near the boundary of the shaded region.There was a typo on line https://github.com/fredrik-johansson/arb/blob/master/acb_hypgeom/u_asymp.c#L73 where
if (R == 0)
should beif (*R == 0)
. It looked scary but I'm pretty sure its effects were masked.