Isogeny_Computations_Find_Bugs

332 days ago by WilliamStein

See isogeny_class_computation2 below for an improvement.

x = var('x') K.<a> = NumberField(x^2-x-1) import psage.modform.hilbert.sqrt5.tables as sqrt5 
       
def ap(E,p): return E.change_ring(p.residue_field()).trace_of_frobenius() R.<ch> = GF(2)[] def frob(E,p): t = ap(E,p) return ch^2 - ap(E, p)*ch + int(p.norm()) def disc(E, p): t = ap(E, p) return t^2 - 4*p.norm() def isogeny_primes(E, norm_bound, isog_degree_bound): P = [p for p in sqrt5.ideals_of_bounded_norm(norm_bound) if p.is_prime() and E.has_good_reduction(p)] w = set(primes(isog_degree_bound+1)) i = 0 w.remove(2) while len(w) > 0 and i < len(P): d = disc(E, P[i]) w = [ell for ell in w if not (legendre_symbol(d,ell) == -1)] i = i +1 i = 0 while i < len(P): if frob(E,P[i]).is_irreducible(): break i = i+1 if i == len(P): w.insert(0,2) return w 
       
def isogeny_class_computation(E,p): if p != 2: E = E.short_weierstrass_model() F = E.division_polynomial(p).change_ring(K) f = F.factor() i=0 S.<x> = K[] t=f[0][0].degree() w=[S(1)] while t < (p+1)/2: for j in w: if (j*f[i][0]).degree() < (p +1)/2 and (j*f[i][0]).divides(F): w.append(j*f[i][0]) t = f[i+1][0].degree() i+=1 v=[] for f in w: try: v.append(E.change_ring(K).isogeny(f).codomain()) except ValueError: pass v = [F.change_ring(K).global_minimal_model() for F in v] return v else: w = [Q for Q in E.torsion_subgroup() if order(Q)==2] v = [E.isogeny(E(Q)).codomain() for Q in w] v.insert(0,E) return v 
       
def isogeny_class_computation2(E,p): if p != 2: E = E.short_weierstrass_model() F = E.division_polynomial(p).change_ring(K) for f in [f for f in F.divisors() if f.degree() == (p-1)/2]: try: v.append(E.change_ring(K).isogeny(f).codomain()) except ValueError: pass v = [F.change_ring(K).global_minimal_model() for F in v] return v else: w = [Q for Q in E.torsion_subgroup() if order(Q)==2] v = [E.isogeny(E(Q)).codomain() for Q in w] v.insert(0,E) return v 
       
def curve_isogeny_classes(E): isolist = isogeny_primes(E,1000,1000) for i in isolist: print i,'- isogeny class: ' for j in isogeny_class_computation(E,i): print ' ',j.a_invariants() 
       
E = EllipticCurve([1,a+1,a,a,0] ); E.conductor().norm() 
       
31
31
E.torsion_subgroup() 
       
Torsion Subgroup isomorphic to Z/8 associated to the Elliptic Curve
defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + a*x over Number Field in
a with defining polynomial x^2 - x - 1
Torsion Subgroup isomorphic to Z/8 associated to the Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + a*x over Number Field in a with defining polynomial x^2 - x - 1
time curve_isogeny_classes(E) 
       
2 - isogeny class: 
   (1, a + 1, a, a, 0)
   (1, a + 1, a, a - 5, 3*a - 5)
Time: CPU 25.08 s, Wall: 25.08 s
2 - isogeny class: 
   (1, a + 1, a, a, 0)
   (1, a + 1, a, a - 5, 3*a - 5)
Time: CPU 25.08 s, Wall: 25.08 s
v = isogeny_class_computation2(E,2); v 
       
[Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + a*x over
Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve
defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + (a-5)*x + (3*a-5) over
Number Field in a with defining polynomial x^2 - x - 1]
[Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + a*x over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + (a-5)*x + (3*a-5) over Number Field in a with defining polynomial x^2 - x - 1]
v = isogeny_class_computation2(E,2); v 
       
[Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + a*x over
Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve
defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + (a-5)*x + (3*a-5) over
Number Field in a with defining polynomial x^2 - x - 1]
[Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + a*x over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + (a-5)*x + (3*a-5) over Number Field in a with defining polynomial x^2 - x - 1]
v[1].conductor() 
       
Fractional ideal (5*a - 2)
Fractional ideal (5*a - 2)
time w = isogeny_class_computation2(v[1],2); len(w) 
       
Time: CPU 1.38 s, Wall: 1.37 s
4
Time: CPU 1.38 s, Wall: 1.37 s
4
       
[Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + (a-5)*x +
(3*a-5) over Number Field in a with defining polynomial x^2 - x - 1,
Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 +
(41*a-70)*x + (170*a-276) over Number Field in a with defining
polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + x*y + a*y = x^3
+ (a+1)*x^2 + (6*a-205/16)*x + (-111/16*a+759/64) over Number Field in a
with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 +
x*y + a*y = x^3 + (a+1)*x^2 + (-39*a-20)*x + (108*a+46) over Number
Field in a with defining polynomial x^2 - x - 1]
[Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + (a-5)*x + (3*a-5) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + (41*a-70)*x + (170*a-276) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + (6*a-205/16)*x + (-111/16*a+759/64) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + (-39*a-20)*x + (108*a+46) over Number Field in a with defining polynomial x^2 - x - 1]
F = v[1] F.torsion_subgroup() 
       
Torsion Subgroup isomorphic to Z/2 + Z/4 associated to the Elliptic
Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + (a-5)*x + (3*a-5)
over Number Field in a with defining polynomial x^2 - x - 1
Torsion Subgroup isomorphic to Z/2 + Z/4 associated to the Elliptic Curve defined by y^2 + x*y + a*y = x^3 + (a+1)*x^2 + (a-5)*x + (3*a-5) over Number Field in a with defining polynomial x^2 - x - 1
 
       
 
       
E = EllipticCurve(K,[1,0,1,-1,-2]) 
       
time curve_isogeny_classes(E) 
       
3 - isogeny class: 
   (1, 0, 1, -1, -2)
   (1, 0, 1, -126, -552)
5 - isogeny class: 
   (1, 0, 1, -1, -2)
   (1, 1, 1, -3, 1)
Time: CPU 4.51 s, Wall: 4.51 s
3 - isogeny class: 
   (1, 0, 1, -1, -2)
   (1, 0, 1, -126, -552)
5 - isogeny class: 
   (1, 0, 1, -1, -2)
   (1, 1, 1, -3, 1)
Time: CPU 4.51 s, Wall: 4.51 s
for E in cremona_optimal_curves([37]): print E.rank(), E.quadratic_twist(5).rank() 
       
1 0
0 1
1 0
0 1
(163^2-1)/2 
       
13284
13284
sage.schemes.elliptic_curves.ell_curve_isogeny.isogenies_sporadic_Q(163) 
       
Traceback (click to the left of this block for traceback)
...
ValueError: The elliptic curve must be defined over QQ.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_29.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("c2FnZS5zY2hlbWVzLmVsbGlwdGljX2N1cnZlcy5lbGxfY3VydmVfaXNvZ2VueS5pc29nZW5pZXNfc3BvcmFkaWNfUSgxNjMp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpdiiVVW/___code___.py", line 3, in <module>
    exec compile(u'sage.schemes.elliptic_curves.ell_curve_isogeny.isogenies_sporadic_Q(_sage_const_163 )
  File "", line 1, in <module>
    
  File "/sagenb/sage_install/sage-4.7/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_curve_isogeny.py", line 4131, in isogenies_sporadic_Q
    raise ValueError, "The elliptic curve must be defined over QQ."
ValueError: The elliptic curve must be defined over QQ.
E = EllipticCurve([-34790720, -78984748304]) 
       
E.conductor().factor() 
       
2^4 * 163^2
2^4 * 163^2
F = E.minimal_quadratic_twist()[0] 
       
F.conductor().factor() 
       
163^2
163^2
F.isogenies_prime_degree() 
       
[Isogeny of degree 163 from Elliptic Curve defined by y^2 + y = x^3 -
2174420*x + 1234136692 over Rational Field to Elliptic Curve defined by
y^2 + y = x^3 - 57772164980*x - 5344733777551611 over Rational Field]
[Isogeny of degree 163 from Elliptic Curve defined by y^2 + y = x^3 - 2174420*x + 1234136692 over Rational Field to Elliptic Curve defined by y^2 + y = x^3 - 57772164980*x - 5344733777551611 over Rational Field]
F.conductor() 
       
26569
26569
163^4 
       
705911761
705911761