back to table · edit · history · where entries came from · files · download
864 bytes, as of the version from 2026-11-27 14:56 (current). Recorded here, not run.
import numberdb.sage as numberdb
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.arith.misc import binomial
R = PolynomialRing(ZZ, names=('L','M'), order='lex')
L, M = R.gens()
F = R.fraction_field()
n = -5 # J(2,-10), source hand, nonabelian form
b = 2*n-1 if n > 0 else -2*n
t = F(M**2-1 if n > 0 else 1-M**2)/(L+M**2)
S = sum(binomial(n+(i-1)//2 if n > 0 else -n+i//2, i)
*t**i*(1-L)**(i//2)*(F(M**2)-L/F(M**2))**((i+1)//2)
for i in range(b+1))
f = F(M)**(2*abs(n))*(L+M**2)**b*S
assert len(f.denominator().dict()) == 1
p = f.numerator()
a = min(e[0] for e in p.dict())
b = min(e[1] for e in p.dict())
p = R({(e[0]-a,e[1]-b):c for e,c in p.dict().items()})
d = ZZ(0)
for c in p.coefficients(): d = d.gcd(c)
p = R(p/d)
if p.leading_coefficient() < 0: p = -p
print(p)