compute.py

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

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

"""Compute and check the two-precision pressure constants; no network writes."""
import json,time,platform,importlib.metadata,hashlib
from pathlib import Path
from generate import INDICES,background,pressure
import numberdb.sage as numberdb
from sage.rings.real_mpfr import RealField
from sage.rings.rational_field import QQ
from sage.env import SAGE_VERSION
F=RealField(numberdb.bits(230)); results=[];worst=F(0)
for n in INDICES:
    start=time.monotonic();a=pressure(n,150);b=pressure(n,210)
    rel=abs((F(a)-F(b))/F(b));assert rel<F(10)**-120
    if n in ('0','1'):
        exact=F(3)/(8*F.pi()) if n=='0' else F.pi()/8
        assert abs((F(b)-exact)/exact)<F(10)**-180
    worst=max(worst,rel)
    x,q,meta=background(n,210)
    row={'n':n,'low':str(a),'high':str(b),'xi':str(x),'mu':str(q),'relative_difference':str(rel),
         'configuration_low':background(n,150)[2],'configuration_high':meta,'elapsed_seconds':time.monotonic()-start}
    results.append(row);print(json.dumps(row),flush=True)
print(json.dumps({'summary':{'worst_relative_difference':str(worst),'sage':SAGE_VERSION,'python':platform.python_version(),
    'numberdb':importlib.metadata.version('numberdb'),'skill_manifest':'agents/runs/20261030T035316Z-build-skills/manifest.json',
    'local_skill_sha256':'28ecbeeccb0c5e5d6eb541b5a5b0f88aec47b154374d909085116d34f5629199',
    'live_skill_sha256':'28ecbeeccb0c5e5d6eb541b5a5b0f88aec47b154374d909085116d34f5629199'}}),flush=True)