# glowmoments.py -- exact moments of the complex glow. For H with entries n-th roots of unity, and a,b uniform on T^N, # we have E|Omega|^(2m) = sum_{alpha,beta} |C_m(alpha,beta)|^2, where C_m(alpha,beta) is the coefficient of x^alpha y^beta # in (sum_ij H_ij x_i y_j)^m, by orthogonality of the characters of the torus, and these coefficients are computed by # the recurrence C_{m+1}(alpha,beta) = sum_ij H_ij C_m(alpha-e_i,beta-e_j), from C_0(0,0)=1. All the computations are # done in the group ring Z[Z_n], the final sum being computed modulo 3 primes, lifted by the Chinese remainder theorem, # with a bound check, and reduced modulo the cyclotomic polynomial Phi_n, the result being an integer when the moment is # rational. We find the universal parts of Theorem 8.4 by exact interpolation on the Fourier matrices F_N with N <= 9, # check them at N = 10, 11 and on the other matrices below, and compute the moments up to order 16 for the Dita # deformations H(q)_{ab,cd} = w^(ac) (-1)^(bd) q^(ad) of F_6 = H(1), with a,c in Z_3, b,d in Z_2, at q = 1 and q = i. # Usage: python3 glowmoments.py import numpy as np, itertools from fractions import Fraction PR=[2147483647,2147483629,2147483587] def cyclotomic(n): # Phi_n as an integer coefficient list, lowest degree first P=[-1]+[0]*(n-1)+[1] for d in range(1,n): if n%d==0: Q=cyclotomic(d); q=[0]*(len(P)-len(Q)+1); r=P[:] for k in range(len(r)-len(Q),-1,-1): c=r[k+len(Q)-1]; q[k]=c for i,y in enumerate(Q): r[k+i]-=c*y assert not any(r[:len(Q)-1]); P=q return P def reduce(g,n): P=cyclotomic(n); r=list(g) for k in range(len(r)-1,len(P)-2,-1): c=r[k] if c: for i,y in enumerate(P): r[k-len(P)+1+i]-=c*y return r[:len(P)-1] def crt(res): x,M=0,1 for r,p in zip(res,PR): t=((r-x)*pow(M,-1,p))%p; x+=M*t; M*=p return x if x<=M//2 else x-M def moments(E,n,mmax): # E[i][j] = exponent of H_ij; returns the moments E|Omega|^(2m), m = 1..mmax, as reduced elements of Z[zeta_n] N=len(E); E=np.array(E)%n idx=[(0,)*N]; C=np.zeros((1,1,n),dtype=np.int64); C[0,0,0]=1; out=[] for m in range(1,mmax+1): new=sorted({tuple(s[k]+(k==i) for k in range(N)) for s in idx for i in range(N)}) pos={s:k for k,s in enumerate(new)} nxt=[np.array([pos[tuple(s[k]+(k==i) for k in range(N))] for s in idx]) for i in range(N)] D=np.zeros((len(new),len(new),n),dtype=np.int64) for i in range(N): for j in range(N): D[np.ix_(nxt[i],nxt[j])]+=np.roll(C,int(E[i,j]),axis=2) idx,C=new,D big=int(np.abs(C).max()); assert big<2**31 bound=n*big*big*C.shape[0]*C.shape[1]; assert 2*bound