auxiliary_checks.py

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

2055 bytes, as of the version from 2026-10-27 13:49 (current). Recorded here, not run.

"""Check the reader program, Jack normalization and singular-dimension controls.
Run: sage -python auxiliary_checks.py, alongside generate.py, program.py,
independent_checks.py and check.py. No network or credentials are needed.
"""
import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from math import prod
from generate import OrthogonalWeingarten, zonal_expansions, weingarten, character_dimension
from independent_checks import inverse_coefficients
from program import orthogonal_weingarten
from check import agrees_with
import platform, importlib.metadata, sage.version, json

g=OrthogonalWeingarten()
values={(int(p['N']),tuple(map(int,p['mu'].split(',')))):g.value(p,100) for p in g.enumerate()}
assert not agrees_with(values,lambda key:orthogonal_weingarten(*key))
normalizations=0
for k in range(1,7):
    assert sum(character_dimension(tuple(2*x for x in lam)) for lam in zonal_expansions(k))==prod(range(1,2*k,2))
    for lam,coefs in zonal_expansions(k).items():
        assert coefs[(1,)*k]==1
        for N in range(1,13):
            specialization=sum(c*N**len(mu) for mu,c in coefs.items())
            expected=prod(N+2*j-i for i,row in enumerate(lam) for j in range(row))
            assert specialization==expected
            normalizations+=1
# Pairing Gram at N=1 is the all-ones matrix, whose pseudoinverse has every
# entry 1/m^2. This independently controls omitted singular cases in the
# stated definition; it does not add entries to the table.
for k in range(1,7):
    m=prod(range(1,2*k,2))
    for mu in zonal_expansions(k):
        assert weingarten(1,mu)==QQ(1)/QQ(m*m)
assert orthogonal_weingarten(13,(3,1)) == inverse_coefficients(13,4)[(3,1)]
print(json.dumps({'program_agreements':len(values),'zonal_specializations':normalizations,
                  'singular_N1_controls':29,'extension_example':str(orthogonal_weingarten(13,(3,1))),
                  'python':platform.python_version(),'sage':sage.version.version,
                  'numberdb':importlib.metadata.version('numberdb')},indent=2))