back to table · edit · history · where entries came from · files · download
958 bytes, as of the version from 2026-10-30 06:27 (current). Recorded here, not run.
# SageMath with numberdb: analytic n=0 or 1, integer ell>=2.
# Returns an exact rational or an Arb enclosure with the requested significant digits.
import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from sage.rings.integer_ring import ZZ
from sage.rings.complex_arb import ComplexBallField
def love_analytic(n, ell, digits=100):
n, ell = QQ(n), QQ(ell)
if n not in (0, 1) or ell.denominator() != 1 or ell < 2:
raise ValueError('Use n=0 or 1 and an integer ell>=2.')
ell = ZZ(ell)
if n == 0:
return QQ(3) / (4 * (ell - 1))
target = numberdb.bits(digits, losing=8)
precision = target + 80
while True:
p = ComplexBallField(precision).pi()
k = (p.bessel_J(ell + QQ(3)/2)
/ (2 * p.bessel_J(ell - QQ(1)/2))).real()
if k.is_finite() and k.accuracy() >= target:
return k
precision *= 2
print(love_analytic(0, 4))
print(love_analytic(1, 4))