compute_all.py

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

1007 bytes, as of the version from 2026-11-17 14:09 (current). Recorded here, not run.

"""Checkpoint every completed calculation as a flushed JSON line on stdout."""
import json,time,sys,importlib.metadata
import numberdb.sage as numberdb
from generate import GuilleraPeriods,SELECTION,compute
import mpmath as mp
print(json.dumps({'event':'versions','python':sys.version,'numberdb':importlib.metadata.version('numberdb'),'mpmath':mp.__version__}),flush=True)
g=GuilleraPeriods()
for template,z in SELECTION:
    t=time.monotonic();low=compute(template,z,150);high=compute(template,z,200)
    value=g.value({'template':template,'z':z},100)
    with mp.workdps(220):
        discrepancy=abs(mp.mpf(low)-mp.mpf(high))
        rel=discrepancy/abs(mp.mpf(high))
        assert rel<mp.mpf('1e-140')
    print(json.dumps({'event':'value','params':{'template':template,'z':z},
                      'low150':low,'high200':high,'relative_discrepancy':str(rel),
                      'native_type':type(value).__name__,'ball':str(value),
                      'seconds':time.monotonic()-t}),flush=True)