cm_check.py

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

1194 bytes, as of the version from 2026-11-17 11:31 (current). Recorded here, not run.

import json
import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from sage.rings.number_field.number_field import QuadraticField
from sage.rings.complex_arb import ComplexBallField
from generate import compute
K=QuadraticField(-7,'d');d=K.gen();l=(31+3*d)/32;r=(3-d)/8
assert r*r==1-l
assert ((1-r)/(1+r))**2==1-1/l
assert 16*(1-l)*l*l/(l-2)**4==QQ(256)/81
C=ComplexBallField(400);tau=compute(QQ(3)/4)
a=2*tau;b=1-1/tau
for p in [a,b]:
 assert p.real()>QQ(49)/100 and p.real()<QQ(51)/100
 assert p.imag()>QQ(13)/10 and p.imag()<QQ(14)/10
# This rectangle lies inside one Gamma(2) fundamental domain: -1<Re<1,
# outside the two circles centred at +/-1/2 of radius 1/2. Lambda is injective
# there. The exact Landen equality plus the TS transformation forces a=b.
# Thus 2*tau^2-tau+1=0; Im(tau)>0 fixes (1+i*sqrt(7))/4.
expected=C(QQ(1)/4,C.real_field()(7).sqrt()/4) if hasattr(C,'real_field') else C(QQ(1)/4,C(7).sqrt().real()/4)
assert tau.overlaps(expected)
print('CM_RESULT_JSON:'+json.dumps({'exact_algebra':True,'fundamental_domain_rectangle':'0.49<Re<0.51, 1.3<Im<1.4', 'equation':'2*P(3/4)^2-P(3/4)+1=0','root':'(1+i*sqrt(7))/4','elliptic_enclosure_overlap':True}))