check_stored_identities.py

back to table · edit · history · where entries came from · files · download

1501 bytes, as of the version from 2026-11-18 01:45 (current). Recorded here, not run.

"""Check identities directly on all stored last-place intervals, without quadrature."""
import json,sys
from pathlib import Path
from decimal import Decimal
import numberdb.sage
from sage.rings.real_arb import RealBallField
from sage.rings.rational_field import QQ
R=RealBallField(460)
def parse(s):
 d=Decimal(s);a,b=d.as_integer_ratio();return R(QQ(a)/b).add_error(R(QQ(10)**d.as_tuple().exponent))
here=Path(__file__).parent;data=json.loads((here/'stored-values.json').read_text());rows={tuple(str(x['params'][k]) for k in ['n','j','normalization']):parse(x['number']) for x in data['records']}
checked=0;results=[]
for m in range(1,5):
 for j in range(m,2*m):
  n=4*m;f=rows[(str(n),str(j),'bessel')];g=rows[(str(n),str(j),'period')];factor=(-1)**m*R(2)**(n-2*j)*R.pi()**(2*m)
  residual=g-factor*f
  assert residual.is_finite() and 0 in residual
  assert R(residual.rad())/abs(g)<R('1e-95')
  assert not(0 in (g*R(QQ(101)/100)-factor*f))
  results.append({'n':n,'j':j,'period_identity_passed':True,'negative_control_rejected':True,'residual':str(residual)});checked+=2
reference=json.loads((here/'reference-values.json').read_text());base=parse(reference['T521_0_4_2']);residual=rows[('4','1','bessel')]*R.pi()**2-base
assert 0 in residual and residual.is_finite()
print('STORED_IDENTITIES',json.dumps({'checked_entries':checked,'total_entries':20,'period_pairs':results,'base_cross_table_consistency':True,'base_note':'T521 corroboration is not independent scientific evidence','failures':[]}))