back to table · edit · history · where entries came from · files · download
2056 bytes, as of the version from 2026-11-09 14:49 (current). Recorded here, not run.
"""Compare independent form identification and periods with archived live companions.
Run with Python 3 and numberdb beside numerical-evidence.json. Optional
archived T215.json, T325.json, T326.json and checks.log take precedence;
otherwise the companion tables are fetched from the website.
These are consistency checks at each companion's stored precision.
"""
from decimal import Decimal,localcontext
from pathlib import Path
import json
p=Path(__file__).parent
if (p/'checks.log').exists():
checks=[json.loads(line[6:]) for line in (p/'checks.log').read_text().splitlines() if line.startswith('CHECK ')]
else:
checks=json.loads((p/'numerical-evidence.json').read_text())['independent_checks']
assert checks[-1]['kind']=='complete'
forms={(r['k'],r['i']):r for r in checks if r['kind']=='form'}
norms={(r['k'],r['i']):r for r in checks if r['kind']=='norm'}
def table(tid):
if (p/(tid+'.json')).exists():return json.loads((p/(tid+'.json')).read_text())['Numbers']
import numberdb
return numberdb.table(tid)['Numbers']
t215,t325,t326=(table(tid) for tid in ('T215','T325','T326'))
D=Decimal
with localcontext() as ctx:
ctx.prec=260
e325=[];e326=[]
for (k,i),r in forms.items():
a2=D(r['embedded_a2'])
if k==24:
assert t215['24']['2']['number']=='x^2 - 1080*x - 20468736'
assert abs(a2*a2-1080*a2-20468736)<D('1e-190')
else:
assert a2==int(a2)
expected=('x - '+str(int(a2))) if a2>0 else ('x + '+str(-int(a2)))
assert t215[str(k)]['2']['number']==expected
text=t325[str(k)][str(i)]['2']['number']
err=abs(D(text)-a2/(D(2)**((k-2)//2)*D(2).sqrt()))/(D(10)**D(text).as_tuple().exponent)
assert err<=1,(k,i,'T325',str(err));e325.append(err)
text=t326[str(k)][str(i)]['number']
err=abs(D(text)-D(norms[k,i]['petersson']))/(D(10)**D(text).as_tuple().exponent)
assert err<=1,(k,i,'T326',str(err));e326.append(err)
print(json.dumps({'T215_hecke_polynomials_checked':7,'T325_embedding_checks':8,'T326_norm_checks':8,
'max_T325_ulp_error':str(max(e325)), 'max_T326_ulp_error':str(max(e326))},indent=2))