arb icon indicating copy to clipboard operation
arb copied to clipboard

hypgeom_u: ball becomes rather wide for large z

Open jgmbenoit opened this issue 7 years ago • 7 comments

The below (and attached) code

arb_one(a);
arb_set_str(b,"[-0.236000000000000000000000000000000 +/- 5.12e-34]",prec);
arb_set_str(z,"[69.314718055994530941723212145817656807550013436025525 +/- 4.13e-52]",prec);
arb_indeterminate(res);
arb_hypgeom_u(res,a,b,z,prec);
arb_printn(res,53,0); printf("\n");
arb_set_str(b,"-0.236000000000000000000000000000000",prec);
arb_set_str(z,"69.314718055994530941723212145817656807550013436025525",prec);
arb_indeterminate(res);
arb_hypgeom_u(res,a,b,z,prec);
arb_printn(res,53,0); printf("\n");

gives: [+/- 30.4] ## with [0.0139820478288060060036870204487 +/- 7.41e-32]

Is there less drastic ways to reduce the final ball ? arb_hypgeom_u-2_13-bug.c.txt

jgmbenoit avatar May 05 '18 16:05 jgmbenoit

Increasing the precision is the intended way to do it (for now).

The problem is that z is in the transition region between the asymptotic expansion and the local expansion at zero for the U function. To avoid loss of precision in this range, a better algorithm will be needed to handle the transition region. This is the same problem as in #166 (in fact, your U function in this case with a = 1 is also an incomplete gamma).

fredrik-johansson avatar May 05 '18 17:05 fredrik-johansson

In fact, increasing the precision just make the ball wider.

jgmbenoit avatar May 05 '18 19:05 jgmbenoit

You have to increase the precision of the inputs as well.

fredrik-johansson avatar May 05 '18 19:05 fredrik-johansson

Indeed. Let say that my inputs are stringified exact floats: what is the best way to override the precision argument in arb_set_str ? add " +/- 0" ? setting precision to a special value ?

jgmbenoit avatar May 05 '18 19:05 jgmbenoit

What do you mean? arb_set_str(x, "0.1", prec) should do the job.

fredrik-johansson avatar May 05 '18 21:05 fredrik-johansson

I had arb_set(x,"0.5",prec) in mind. Playing with the attached sample, I realised that my question has only sense for numbers exactly representable in binary format. arb_set_str-2_13-ambiguity.c.txt

jgmbenoit avatar May 06 '18 09:05 jgmbenoit

This is partially fixed in 3f2a79b7d5bc70074. hypgeom_u will still lose some accuracy in the transition region for the asymptotic expansion, but now does a better job avoiding total catastrophe, at least when the parameters a and b are small.

The output of your code with different prec:

prec = 16

[0.01398 +/- 3.14e-6]
[0.01398 +/- 3.14e-6]

prec = 32

[0.013982048 +/- 5.25e-10]
[0.013982048 +/- 5.25e-10]

prec = 64

[0.013982047828806006 +/- 2.02e-19]
[0.013982047828806006 +/- 2.02e-19]

prec = 128

[0.013982047828806006003687020 +/- 5.55e-28]
[0.013982047828806006003687020 +/- 5.55e-28]

prec = 256

[0.013982047828806006003687020 +/- 5.55e-28]
[0.01398204782880600600368702044872975060918 +/- 3.55e-42]

fredrik-johansson avatar Feb 23 '19 13:02 fredrik-johansson