back to table · edit · history · where entries came from · files · download
5467 bytes, as of the version from 2026-11-26 10:19 (current). Recorded here, not run.
"""T814: modular S-matrix entries of SU(N) WZW models.
Install SageMath, then install the client and run:
sage -pip install numberdb
sage -python generate.py
sage -python generate.py --publish
The default command checks; --publish explicitly writes entries to this draft.
Requires SageMath (or the named passagemath modules) and numberdb.
sage -python generate.py # verify every stored entry; no writes
sage -python generate.py --preview # compute/compare without writes
sage -python generate.py --publish # additive upload to the assigned draft
The key and agent/model provenance come from the caller's environment.
The finite default selection is every pair in each full integrable alcove for
2 <= N <= 5 with binomial(k+N-1,N-1) <= 10. Dynkin tuple keys have no spaces;
weights are ordered by label sum, then integer lexicographic order.
Fuchs hep-th/9702194v1 (4.11) and Gannon-Walton q-alg/9709039v1 section 6
fix the negative Weyl exponent and i^(N*(N-1)/2) phase. Exact cyclotomic
arithmetic constructs its numerator A. The positive denominator is sqrt(D),
D=N*(N+k)^(N-1). A real component u/sqrt(D) is rational precisely when
u^2/D is a rational square; its sign is certified in the canonical embedding.
All such components, including zeros, are returned as exact Fractions.
Other components use Arb throughout at bits(digits, losing=160) bits, then
outward-rounded rational interval endpoints. No floating-point guesses,
rounded zeros or numerical rational reconstruction are used.
"""
import os
import sys
import math
from functools import lru_cache
from itertools import product, permutations
from fractions import Fraction
import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from sage.rings.integer_ring import ZZ
from sage.rings.number_field.number_field import CyclotomicField
from sage.rings.complex_arb import ComplexBallField
from sage.rings.real_arb import RealBallField
from sage.rings.real_mpfi import RealIntervalField
def theories():
for N in range(2, 6):
k = 1
while math.comb(k + N - 1, N - 1) <= 10:
yield N, k
k += 1
def weights(N, k):
return sorted((a for a in product(range(k + 1), repeat=N - 1)
if sum(a) <= k), key=lambda a: (sum(a), a))
def key(a):
return ','.join(map(str, a))
def parse_weight(s, N, k):
a = tuple(int(x) for x in str(s).split(','))
if len(a) != N - 1 or min(a) < 0 or sum(a) > k or key(a) != str(s):
raise ValueError('Expected a canonical integrable Dynkin tuple')
return a
@lru_cache(None)
def field(N, k):
M = math.lcm(4, N * (N + k))
F = CyclotomicField(M)
return F, F.gen(), M
@lru_cache(None)
def centered(N, a):
b = tuple(sum(a[j:]) + N - 1 - j for j in range(N - 1)) + (0,)
avg = QQ(sum(b)) / N
return tuple(QQ(v) - avg for v in b)
@lru_cache(None)
def numerator(N, k, a, b):
F, z, M = field(N, k)
ra, rb = centered(N, a), centered(N, b)
ans = F(0)
for p in permutations(range(N)):
sign = (-1) ** sum(p[i] > p[j] for i in range(N) for j in range(i + 1, N))
exponent = -QQ(M) * sum(ra[j] * rb[p[j]] for j in range(N)) / (N + k)
assert exponent.denominator() == 1
ans += sign * z ** ZZ(exponent)
return z ** (M // 4 * (N * (N - 1) // 2)) * ans
def fraction(q):
return Fraction(int(q.numerator()), int(q.denominator()))
def component(u, D, digits):
if not u:
return Fraction(0)
bits = numberdb.bits(digits, losing=160)
C, R = ComplexBallField(bits), RealBallField(bits)
ball = C(u).real() / R(D).sqrt()
assert ball.is_finite()
square = u * u / D
if square in QQ:
q = QQ(square)
if q.is_square():
assert ball > 0 or ball < 0
return fraction(q.sqrt() if ball > 0 else -q.sqrt())
interval = RealIntervalField(bits)(ball)
lo, hi = fraction(interval.lower().exact_rational()), fraction(interval.upper().exact_rational())
assert lo < hi and lo * hi > 0
assert (hi - lo) < min(abs(lo), abs(hi)) / 10 ** (digits + 20)
return numberdb.RealInterval(lo, hi)
class ModularS(numberdb.Generator):
table = 'T814'
parameters = ('N', 'k', 'weight1', 'weight2')
type = 'C'
digits = 100
rigour = 'proven'
def enumerate(self):
for N, k in theories():
for a in weights(N, k):
for b in weights(N, k):
yield dict(N=N, k=k, weight1=key(a), weight2=key(b))
def value(self, params, digits):
N, k = int(params['N']), int(params['k'])
if N < 2 or k < 1:
raise ValueError('Expected N>=2, k>=1')
a, b = (parse_weight(params[x], N, k) for x in ('weight1', 'weight2'))
A = numerator(N, k, a, b)
F, z, M = field(N, k)
real = (A + A.conjugate()) / 2
imag = (A - A.conjugate()) / (2 * z ** (M // 4))
D = ZZ(N) * ZZ(N + k) ** (N - 1)
return numberdb.ComplexInterval(component(real, D, digits), component(imag, D, digits))
if __name__ == '__main__':
if os.environ.get('NUMBERDB_KEY_FROM_STDIN') == '1':
numberdb.configure(api_key=sys.stdin.read().strip())
generator = ModularS()
if '--publish' in sys.argv or os.environ.get('NUMBERDB_PUBLISH') == '1':
generator.publish()
elif '--preview' in sys.argv:
generator.preview()
else:
print(generator.verify(sample=None))