from sage.arith.misc import factorial
from sage.misc.misc_c import prod
from sage.rings.rational_field import QQ
def g(G, k):
if G == 'U':
return QQ(factorial(k*k)) * prod(
QQ(factorial(j)) / QQ(factorial(k+j))
for j in range(k))
if G == 'O':
return QQ(2)**(k-1) * QQ(factorial(k*(k-1)//2)) * prod(
QQ(factorial(j)) / QQ(factorial(2*j))
for j in range(1, k))
if G == 'USp':
return QQ(factorial(k*(k+1)//2)) * prod(
QQ(factorial(j)) / QQ(factorial(2*j))
for j in range(1, k+1))
raise ValueError(G)
print(g('U', 5))The generator evaluates the factorial products in (3), (5), and (4) over $\mathbb Q$.
Before the draft was filled, the unitary rows were checked against the printed values $1,2,42,24024,701149020$, and the symplectic and orthogonal rows were checked by extracting the leading terms from the corresponding CFKRS random-matrix moment formulas after the conductor normalisation.