arb icon indicating copy to clipboard operation
arb copied to clipboard

acb_hypgeom_legendre_p(n, 0, 0) fails with rational n>15

Open rwst opened this issue 7 years ago • 3 comments

With mpmath as comparison:

sage: import mpmath
sage: from sage.libs.mpmath.all import call as mpcall
sage: mpcall(mpmath.legenp, 29/2, 0, 0)
-0.145632776315886
sage: mpcall(mpmath.legenp, 31/2, 0, 0)
0.141013048084263
sage: mpcall(mpmath.legenp, 44/3, 0, 0)
-0.102411166309551
sage: mpcall(mpmath.legenp, 46/3, 0, 0)
0.100234189567193

there is:

sage: CBF(0).legendre_P(29/2)
[-0.14563278 +/- 7.94e-9]
sage: CBF(0).legendre_P(31/2)
nan + nan*I
sage: CBF(0).legendre_P(31/2, 0, type=2)
nan + nan*I
sage: CBF(0).legendre_P(31/2, 0, type=3)
nan + nan*I

sage: CBF(0).legendre_P(44/3)
[-0.102411 +/- 2.40e-7]
sage: CBF(0).legendre_P(46/3)
nan + nan*I

sage: CBF(0).legendre_P(59/4)
[-0.07816789 +/- 7.19e-9]
sage: CBF(0).legendre_P(61/4)
nan + nan*I

rwst avatar Jan 16 '18 16:01 rwst

Increase the precision until the result is sufficiently accurate:

sage: C = ComplexBallField(128)
sage: C(0).legendre_P(31/2)
[0.141013048084263329998974219590 +/- 5.88e-31]

fredrik-johansson avatar Jan 16 '18 16:01 fredrik-johansson

That is unexpected. So this is a Sage interface issue?

rwst avatar Jan 16 '18 16:01 rwst

No, that is how Arb works in general (although the algorithms could be improved to address specific cases like this one). In general the user has the responsibility to check if the interval is precise enough and increase the precision otherwise.

fredrik-johansson avatar Jan 16 '18 17:01 fredrik-johansson