validate.py

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

1413 bytes, as of the version from 2026-10-30 02:35 (current). Recorded here, not run.

"""Numerical checks for T615. Run: sage -python validate.py.
Run analytic controls first, then the standard NumberDB dry run.
BACKGROUND lines and the final DATA record are retained as numerical evidence.
"""
import os,json,platform
os.environ['NUMBERDB_EVIDENCE']='1'
import numberdb.sage as numberdb
from sage.rings.real_mpfr import RealField
import sage.version
import mpmath
from generate import background,CONFIG
import dry_run
from pathlib import Path

def main():
    controls={}
    for n in ['0','1']:
        controls[n]={}
        for work in CONFIG:
            x,q,c=background(n,work);F=c.parent()
            target=F(1) if n=='0' else F.pi()**2/3
            err=abs(c-target)/target
            assert err<F(10)**(-work+12),(n,work,err)
            assert abs(c*(1+F(10)**-90)-target)/target>F(10)**-100
            controls[n][str(work)]=str(err)
            print('CONTROL',n,work,str(err),flush=True)
    code=dry_run.main([str(Path(__file__).with_name('generate.py'))])
    assert code==0
    print('DATA '+json.dumps({'table':'T615','skill_manifest':'agents/runs/20261030T020254Z-build-skills/manifest.json','skill_sha256':'28ecbeeccb0c5e5d6eb541b5a5b0f88aec47b154374d909085116d34f5629199','controls':controls,'versions':{'python':platform.python_version(),'sage':sage.version.version,'numberdb':numberdb.__version__,'mpmath':mpmath.__version__}}),flush=True)
if __name__=='__main__':main()