checks.py

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

6778 bytes, as of the version from 2026-11-01 11:37 (current). Recorded here, not run.

"""Independent checks for Broadhurst–Mellit vacuum determinants -- numberdb.org/T648.

Run: sage -python checks.py > independent-evidence.json
To check stored values as well, pipe the NumberDB key to stdin and use
NUMBERDB_CHECK_STORED=1. The key is used only by NumberDB's API client.

This file does not import generate.py or use Bessel functions. It computes
noncritical L-values from exact eta-product Fourier coefficients and the
split Mellin transform. Broadhurst arXiv:1604.03057, Sections 7.2, 7.3 and 7.8,
gives the comparisons; the eight-factor identity is stated as Conjecture 6.
Agreement with these identities is evidence, not an integration certificate.

For the positive imaginary-axis Fricke relation
 f(i/(N*y)) = N^(k/2)*y^k*f(i*y),
the Mellin integral split at 1/sqrt(N) gives, at s=k+1,
 L(s) = sum_m A(m)/m^s * [Gamma(s,x)+x^(k+2)*Gamma(-1,x)]/Gamma(s),
 x=2*pi*m/sqrt(N). The eta transformation is independently checked numerically
at two points for each form. No Bessel quadrature enters this calculation.
The coefficient routine is checked against Euler's pentagonal theorem before
it is used. The Mellin normalization has a nonzero exponential test integral.
"""
import numberdb.sage as numberdb
import mpmath as mp
import json,os,sys
from functools import lru_cache

# (weight, level, [(integer leading q-power, eta exponents)], V/L prefactor)
FORMS={
 5:(3,15,[(1,{3:3,5:3}),(2,{1:3,15:3})],(45,8)),
 6:(4,6,[(1,{1:2,2:2,3:2,6:2})],(27,4)),
 8:(6,6,[(1,{1:-3,2:9,3:9,6:-3}),(2,{1:9,2:-3,3:-3,6:9})],(6075,128))}

def euler_product(exponents,limit):
    sigma=[0]*(limit+1)
    for scale,power in exponents.items():
        for d in range(scale,limit+1,scale):
            for j in range(d,limit+1,d):
                sigma[j]+=power*d
    c=[1]+[0]*limit
    for n in range(1,limit+1):
        numerator=-sum(sigma[j]*c[n-j] for j in range(1,n+1))
        assert numerator%n==0
        c[n]=numerator//n
    return c

@lru_cache(maxsize=16)
def coefficients(n,limit):
    weight,level,parts,_=FORMS[n]
    a=[0]*(limit+1)
    for shift,exponents in parts:
        assert sum(d*e for d,e in exponents.items())==24*shift
        assert sum(exponents.values())==2*weight
        c=euler_product(exponents,limit-shift)
        for j,v in enumerate(c): a[j+shift]+=v
    assert a[1]==1
    return a

def eta(y):
    if y<1:
        return eta(1/y)/mp.sqrt(y)
    q=mp.exp(-2*mp.pi*y)
    count=int(mp.ceil((mp.mp.dps+15)*mp.log(10)/(2*mp.pi*y)))
    return mp.exp(-mp.pi*y/12)*mp.fprod(1-q**j for j in range(1,count+1))

def eta_form(n,y):
    return mp.fsum(mp.fprod(eta(d*y)**e for d,e in exponents.items())
                   for _,exponents in FORMS[n][2])

def modular_value(n,digits):
    with mp.workdps(digits+20):
        k,N,_,ratio=FORMS[n];s=k+1
        limit=2*(digits+30)
        a=coefficients(n,limit)
        total=mp.mpf(0)
        for m in range(1,limit+1):
            if not a[m]:continue
            x=2*mp.pi*m/mp.sqrt(N)
            upper=mp.factorial(k)*mp.exp(-x)*sum(x**j/mp.factorial(j) for j in range(k+1))
            lower=mp.exp(-x)/x-mp.e1(x)
            total+=mp.mpf(a[m])/mp.mpf(m)**s*(upper+x**(k+2)*lower)
        value=total/mp.factorial(k)*ratio[0]/ratio[1]/mp.pi**2
        return mp.nstr(value,digits),limit

def run():
    result={'method':'eta-product Fourier coefficients and split Mellin transform',
      'rigour':'heuristic comparison; the modular determinant identities are not used as certification',
      'skill_manifest':'agents/runs/20261101T095610Z-build-skills/manifest.json',
      'controls':{},'values':{},'eta_checks':{}}
    pent=euler_product({1:1},100);expected=[0]*101;expected[0]=1
    for j in range(1,10):
        for p in (j*(3*j-1)//2,j*(3*j+1)//2):
            if p<=100:expected[p]=(-1)**j
    assert pent==expected;result['controls']['Euler_pentagonal_through_100']=True
    with mp.workdps(150):
        integral=mp.quad(lambda y:mp.exp(-2*mp.pi*y)*y**3,[0,1,mp.inf])*(2*mp.pi)**4/mp.factorial(3)
        assert abs(integral-1)<mp.mpf('1e-145')
        result['controls']['nonzero_Mellin_normalization_error']=mp.nstr(abs(integral-1),8)
        for n,(k,N,parts,ratio) in FORMS.items():
            checks=[]
            for y in (mp.mpf('0.31'),mp.mpf('0.73')):
                fy=eta_form(n,y)
                fricke=eta_form(n,1/(N*y))/(mp.mpf(N)**(mp.mpf(k)/2)*y**k)
                coeff=coefficients(n,420)
                series=mp.fsum(coeff[m]*mp.exp(-2*mp.pi*m*y) for m in range(1,421))
                errors=[abs(fricke/fy-1),abs(series/fy-1)]
                assert max(errors)<mp.mpf('1e-140')
                checks.append([mp.nstr(e,8) for e in errors])
            result['eta_checks'][str(n)]=checks
    for n in FORMS:
        low,L=modular_value(n,130);high,H=modular_value(n,180)
        with mp.workdps(200):
            err=abs(mp.mpf(low)/mp.mpf(high)-1)
            assert err<mp.mpf('1e-128')
        result['values'][str(n)]={'at_130':low,'at_180':high,'terms':[L,H],'relative_discrepancy':mp.nstr(err,8)}
    if os.environ.get('NUMBERDB_CHECK_STORED')=='1':
        client=numberdb.Client(api_key=sys.stdin.read().strip())
        doc=numberdb.table('T648',client=client)
        result['stored_document']=doc
        with mp.workdps(220):
            comparisons={}
            for n,item in result['values'].items():
                text=doc['Numbers'][n]
                if isinstance(text,dict):text=text['number']
                center=mp.mpf(text);candidate=mp.mpf(item['at_180'])
                unit=mp.power(10,mp.floor(mp.log10(abs(center)))-99)
                discrepancy=abs(center-candidate)/unit
                assert discrepancy<=1
                comparisons[n]=mp.nstr(discrepancy,12)
            result['stored_modular_differences_in_last_places']=comparisons
        # A separate, limited-precision comparison to the published Mahler rows.
        mahler=numberdb.table('T283',client=client)['Numbers']
        with mp.workdps(150):
            comparisons={}
            for n,factor in [('5',2*mp.pi**3/(15*mp.sqrt(15))),('6',mp.pi**4/96)]:
                item=mahler[n];text=item['number'] if isinstance(item,dict) else item
                mu=mp.mpf(text);written=doc['Numbers'][n]
                v=mp.mpf(written['number'] if isinstance(written,dict) else written)
                discrepancy=abs(v/factor-mu)/mp.mpf('1e-50')
                assert discrepancy<=1
                comparisons[n]=mp.nstr(discrepancy,12)
            result['stored_Mahler_differences_in_last_places']=comparisons
            result['Mahler_limitation']='T283 has 50-digit conjectural eta-integral evaluations at n=5,6; these are comparisons, not certificates.'
    return result

if __name__=='__main__':
    print(json.dumps(run(),indent=2))