compute.py

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

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

"""Fresh mass computations and analytic controls for numberdb.org/T614.
Run: sage -python compute.py > compute.log
The DATA line is the numerical evidence; all rows are recomputed.
"""
import numberdb.sage as numberdb
from sage.rings.real_mpfr import RealField
from solver import radius
import json,time,platform
import sage.version
import mpmath

def main():
    out={'table':'T614','skill_manifest':'agents/runs/20261030T013608Z-build-skills/manifest.json','skill_sha256':'28ecbeeccb0c5e5d6eb541b5a5b0f88aec47b154374d909085116d34f5629199','versions':{'python':platform.python_version(),'sage':sage.version.version,'numberdb':numberdb.__version__,'mpmath':mpmath.__version__},'values':{}}
    # Controls precede the eight nonlinear values.
    for n in ['0','1','1/2','3/2','2','5/2','3','7/2','4','9/2']:
        row={};start=time.time()
        for work,order,divisor,center in [(150,160,12,'1/2'),(210,210,18,'2/3')]:
            x,q,meta=radius(n,work,order,divisor,center,trace=True)
            row[str(work)]={'mass':str(q),'radius':str(x),'meta':meta}
            if n in ('0','1'):
                F=q.parent();target=2*F(6).sqrt() if n=='0' else F.pi()
                error=abs(q-target)/target
                assert error<F(10)**(-work+12),(n,error)
                assert abs(q*(1+F(10)**-90)-target)/target>F(10)**-100
                row[str(work)]['control_relative_error']=str(error)
            print('PASS',n,work,'seconds',round(time.time()-start,3),flush=True)
        F=RealField(numberdb.bits(220));lo=F(row['150']['mass']);hi=F(row['210']['mass'])
        discrepancy=abs(lo-hi)/abs(hi)
        assert discrepancy<F(10)**-120,(n,discrepancy)
        row['relative_difference']=str(discrepancy);row['seconds']=time.time()-start
        out['values'][n]=row
        print('ROW '+json.dumps({n:row}),flush=True)
    print('DATA '+json.dumps(out),flush=True)
if __name__=='__main__':main()