back to table · edit · history · where entries came from · files · download
2397 bytes, as of the version from 2026-10-29 07:39 (current). Recorded here, not run.
"""Check source rounding, sphere splitting and the 1993 low-dimensional discrepancy.
Run with generate.py, independent.py, T595.json and source-table2.json alongside.
"""
import json,os
from pathlib import Path
from math import comb
from decimal import Decimal
import numberdb.sage as numberdb
from sage.rings.real_arb import RealBallField
from sage.rings.complex_arb import ComplexBallField
from sage.rings.rational_field import QQ
from generate import logdet
from independent import continuation
def rational_decimal(text):
t=Decimal(text);sign,digits,exponent=t.as_tuple()
v=QQ((-1)**sign*int(''.join(map(str,digits))))
return v*QQ(10)**exponent,QQ(10)**exponent
def decimal_enclosure(text,R):
v,ulp=rational_decimal(text)
return R(v).add_error(R(ulp))
if __name__=='__main__':
w=Path(__file__).parent
source=json.loads((w/'source-table2.json').read_text())
spheres=json.loads((w/'T595.json').read_text())['Numbers']
R=RealBallField(numberdb.bits(240));C=ComplexBallField(numberdb.bits(240))
for d in range(1,21):
D=logdet(d,200);N,info=continuation(d,boundary='N')
sphere=decimal_enclosure(spheres[str(d)]['logdet'],R)
assert sphere.overlaps(D+N)
assert decimal_enclosure(spheres[str(d)]['det'],R).overlaps(D.exp()*N.exp())
v,ulp=rational_decimal(source[str(d)])
# Published Table 2 rounds to six decimal places, rather than truncating.
assert R(v).add_error(R(ulp/2)).overlaps(D.exp())
for k in range(1,d+2):
assert comb(d+k-2,d-1)+comb(d+k-1,d-1)==(2 if d==1 else comb(d+k,d)-comb(d+k-2,d))
print(json.dumps({'d':d,'sphere_relation':True,'source_rounding':True,'neumann_logdet':str(N)}),flush=True)
LD=logdet(3,200);LN,_=continuation(3,boundary='N')
# Difference of zeta derivatives: Z_N' - Z_D' = L_D - L_N.
corrected=(2*C(-1).zetaderiv(1)+C(2).log()-1).real()
printed=(2*C(-1).zetaderiv(1)+C(2).log()+QQ(1)/2).real()
assert (LD-LN).overlaps(corrected)
assert not (LD-LN).overlaps(printed)
assert (printed-corrected).overlaps(R(QQ(3)/2))
print(json.dumps({'dowker_p7':{'spectral_derivative_difference':str(LD-LN),
'corrected_constant':'-1','printed_constant':'+1/2',
'printed_minus_spectral':'3/2','reconciled':True}}))
print(json.dumps({'status':'PASS','sphere_dimensions':20,'rounded_source_values':20}))