"""Check the origin identities retained by the T490 prose repair.
Run: sage -python check_origin.py
DLMF 10.65.1 gives x**nu times a convergent power series at x=0.
For nu>0 its limit is zero; for nu=0 its constant term is one.
The computation checks exact origin values at the three stored orders.
"""
import json
import numberdb.sage as numberdb
from sage.rings.complex_arb import ComplexBallField
from sage.rings.rational_field import QQ
from sage.env import SAGE_VERSION
C = ComplexBallField(600)
results = []
for nu in (0, 1, 2):
    expected = 1 if nu == 0 else 0
    actual = C(0).bessel_J(C(nu)).real()
    assert actual.is_exact() and actual == expected
    results.append({'nu': nu, 'ber_at_zero': expected, 'exact': True})
print(json.dumps({'sage_version': SAGE_VERSION, 'origin_checks': results,
 'general_argument': 'DLMF 10.65.1: the factor (x/2)^nu tends to zero for every real nu>0 and the remaining series is finite at zero; at nu=0 the constant term is 1.'},indent=2))
