back to table · edit · history · where entries came from · files · download
6719 bytes, as of the version from 2026-10-29 04:58 (current). Recorded here, not run.
"""Independent spectral-continuation checks for numberdb.org/T600.
Run: sage -python checks.py > numerical-evidence.json
Also requires generate.py and the unchanged campaign check.py from this run.
This program does not write to NumberDB. The mpmath continuation is independent
of the generator's finite Stirling/central-factorial formula. Its truncation
error is bounded explicitly; mpmath arithmetic itself is a corroborating check,
not the basis for the generator's proven Arb intervals. See continuation.md.
"""
import json
import math
import sys
from fractions import Fraction
from pathlib import Path
import numberdb.sage as numberdb
from sage.rings.real_arb import RealBallField
import mpmath as mp
import generate as gen
from check import exactness, names_its_rings, measure, agrees_with
DPS=190
TARGET=mp.mpf('1e-160')
# Independent polynomial construction: Spreafico Section 3, Q_d(2k).
def centered_multiplicity(d):
if d==1:
return [Fraction(2)]
coeff=[Fraction(0),Fraction(4,math.factorial(d-1))]
for i in range(1,d-1):
nxt=[Fraction(0)]*(len(coeff)+1)
for j,c in enumerate(coeff):
nxt[j]+=c*(Fraction(i)-Fraction(d-1,2))
nxt[j+1]+=2*c
coeff=nxt
return coeff
def mf(r):
return mp.mpf(r.numerator)/r.denominator
def hz(s,q,derivative=0):
# Preserve relative accuracy for tiny positive-s Hurwitz-zeta values.
with mp.extradps(30+max(0,int((s-1)*mp.log10(q)))):
return +mp.zeta(s,q,derivative=derivative)
def spectral_continuation(d,working_digits=DPS):
with mp.workdps(working_digits):
a=mp.mpf(d-1)/4
K=30
q=K+a
coeff=[mf(c) for c in centered_multiplicity(d)]
rho=(a/q)**2
def bound(M):
if a==0: return mp.mpf(0)
return sum(abs(c)*a**(2*M)/(M*(1-rho))
*(q**(j-2*M)+q**(j-2*M+1)/(2*M-j-1))
for j,c in enumerate(coeff) if c)
M=max(12,d)
while bound(M)>=mp.mpf('1e-170'):
M+=1
# Derivative of the finite initial spectrum.
zp=mp.mpf(0)
for k in range(1,K):
multiplicity=math.comb(d+2*k,d)-math.comb(d+2*k-2,d)
zp-=multiplicity*mp.log(2*k*(2*k+d-1))
# Cache the positive-integer Hurwitz zeta values across coefficients.
zetas={s:hz(s,q) for s in range(1-d,2*M) if s!=1}
for j,c in enumerate(coeff):
if not c: continue
piece=2*hz(-j,q,1)-mp.log(4)*zetas[-j]
if a:
for ell in range(1,M):
s=2*ell-j
if s==1:
H=sum((mp.mpf(1)/t for t in range(1,ell)),mp.mpf(0))
piece+=a**(2*ell)/ell*(-mp.digamma(q)+H/2-mp.log(4)/2)
else:
piece+=a**(2*ell)/ell*zetas[s]
zp+=c*piece
return -zp, bound(M), M
def ball_midpoint(x):
return mp.mpf(str(x.mid().n(digits=190)))
def assert_good(x,bits=450):
assert x.is_finite() and x.accuracy()>=bits, str(x)
SOURCE_ROUNDED=['9.869604','2.240353','2.004050','1.312925','1.226325',
'0.985390','0.909314','0.804377','0.732550','0.686519','0.618221',
'0.602558','0.537518','0.539189','0.477157','0.489387','0.430114',
'0.449052','0.392302','0.415618']
def main():
mp.mp.dps=DPS
# A known nonzero result must pass before the continuation is used.
L1,tail,_=spectral_continuation(1)
err=abs(L1-2*mp.log(mp.pi))
assert err<mp.mpf('1e-170')
R=RealBallField(numberdb.bits(200))
# Zeta derivative control at zero and functional-equation checks at -2k.
assert gen.zeta_derivative(0,200).overlaps(-R(2*R.pi()).log()/2)
for k in range(1,10):
expected=(-1)**k*R(math.factorial(2*k))*R(2*k+1).zeta()/(2*(2*R.pi())**(2*k))
got=gen.zeta_derivative(2*k,200)
assert_good(expected,600);assert_good(got,600)
assert got.overlaps(expected)
# Exact spectral multiplicity check, independent binomial vs polynomial.
count=0
for d in range(1,21):
c=centered_multiplicity(d); a=Fraction(d-1,4)
for k in range(1,51):
p=sum(v*(k+a)**j for j,v in enumerate(c))
assert p==math.comb(d+2*k,d)-math.comb(d+2*k-2,d)
count+=1
rows=[]; values={}; minimum=10000
for d in range(1,21):
low=gen.logdet(d,150); high=gen.logdet(d,200)
assert_good(low);assert_good(high,600)
independent, tail, terms=spectral_continuation(d)
error=abs(ball_midpoint(high)-independent)
assert error<mp.mpf('1e-160'),(d,mp.nstr(error,10))
assert low.overlaps(high)
assert abs(mp.exp(independent)-mp.mpf(SOURCE_ROUNDED[d-1]))<mp.mpf('0.00000051')
for label,lo,hi in [('det',low.exp(),high.exp()),('logdet',low,high)]:
assert_good(lo);assert_good(hi,600);assert lo.overlaps(hi)
minimum=min(minimum,int(lo.accuracy()))
values[(d,label)]=lo
rows.append({'d':d,'logdet':mp.nstr(independent,175),
'det':mp.nstr(mp.exp(independent),175),
'absolute_logdet_difference':mp.nstr(error,8),
'tail_bound':mp.nstr(tail,8),'series_terms':terms,
'logdet_accuracy_bits_150':int(low.accuracy())})
print('checked dimension',d,file=sys.stderr,flush=True)
assert not exactness(values)
assert not names_its_rings(str(Path(gen.__file__)))
# Use the campaign comparator for an exact spectral identity, since ==
# is deliberately unsuitable for equality of inexact overlapping balls.
exact={(d,k):sum(c*(Fraction(k)+Fraction(d-1,4))**j
for j,c in enumerate(centered_multiplicity(d)))
for d in range(1,21) for k in range(1,51)}
assert not agrees_with(exact,lambda key:math.comb(key[0]+2*key[1],key[0])-math.comb(key[0]+2*key[1]-2,key[0]))
result={'table':'T600','skill_manifest':'agents/runs/20261029T043345Z-build-skills/manifest.json',
'skill_sha256':'28ecbeeccb0c5e5d6eb541b5a5b0f88aec47b154374d909085116d34f5629199',
'versions':{'mpmath':mp.__version__,'numberdb':getattr(numberdb,'__version__','unknown')},
'controls':{'circle_logdet_error':mp.nstr(err,8),'negative_even_zeta_derivatives':9,'exact_multiplicity_checks':count},
'entries':40,'minimum_accuracy_bits_150':minimum,'measure':measure(values),
'independent_method':'Shifted spectral binomial continuation with explicit tail bound; 190-digit mpmath arithmetic',
'all_determinants_match_source_rounding':True,'rows':rows}
print(json.dumps(result,indent=2,default=str))
if __name__=='__main__':main()