IsogenyDBCode

330 days ago by Ben.LeVeque

import nosqlite db = nosqlite.Client('/home/bleveque/moddb').db import psage.modform.hilbert.sqrt5.tables as sqrt5 
       
x=var('x') K.<a> = NumberField(x^2-x-1) 
       
f = open('/home/bleveque/matched.txt') 
       
def grabber(s): return eval('['+s.split('[')[1].split(']')[0]+']') #returns a-invariants def dictionary_maker(line): dict = {'N':line.split()[0]} ainv = grabber(line) E = EllipticCurve(K,ainv) w = walltime() X,Y = curve_isogeny_vector(E) time = walltime(w) for i in range(len(X)): dict['%s'%i] = X[i].a_invariants() dict['matrix'] = Y dict['time'] = time return dict #def isogeny_database_maker(file,database): # for line in file.readlines(): # db.isotable.insert(dictionary_maker(line)) 
       
###################### 
       
for line in f.readlines(): db.isotablenew.insert(dictionary_maker(line)) 
       
################################ 
       
list(db.isotablenew) 
       
dictionary_maker('121 11 0 0 -5 1 -10 ? ? 0 0 0 0 7 7 -8 -8 5 5 12 12 -3 -3 -10 -10 15 15 [0,-1,1,0,0] 5') 
       
Traceback (click to the left of this block for traceback)
...
__SAGE__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_69.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("ZGljdGlvbmFyeV9tYWtlcignMTIxICAgICAxMSAgICAgICAgICAwICAgMCAtNSAxIC0xMCA/ID8gMCAwIDAgMCA3IDcgLTggLTggNSA1IDEyIDEyIC0zIC0zIC0xMCAtMTAgMTUgMTUgICAgICAgICAgICAgIFswLC0xLDEsMCwwXSAgICAgICAgICAgICAgICAgIDUnKQ=="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpnYfwQF/___code___.py", line 2, in <module>
    exec compile(u"dictionary_maker('121     11          0   0 -5 1 -10 ? ? 0 0 0 0 7 7 -8 -8 5 5 12 12 -3 -3 -10 -10 15 15              [0,-1,1,0,0]                  5')" + '\n', '', 'single')
  File "", line 1, in <module>
    
  File "/tmp/tmpq5owSt/___code___.py", line 11, in dictionary_maker
    X,Y = curve_isogeny_vector(E)
  File "/tmp/tmpEQQMPl/___code___.py", line 95, in curve_isogeny_vector
    isolist = isogeny_primes(curve_list[i],_sage_const_500 ,_sage_const_500 )
  File "/tmp/tmpEQQMPl/___code___.py", line 18, in isogeny_primes
    P = [p for p in sqrt5.ideals_of_bounded_norm(norm_bound) if p.is_prime() and E.has_good_reduction(p)]
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_number_field.py", line 860, in has_good_reduction
    return self.local_data(P).has_good_reduction()
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_number_field.py", line 723, in local_data
    return self._get_local_data(P,proof,algorithm)       
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_number_field.py", line 777, in _get_local_data
    self._local_data[P, proof, algorithm] = EllipticCurveLocalData(self, P, proof, algorithm)
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_local_data.py", line 271, in __init__
    self._Emin, ch, self._val_disc, self._fp, self._KS, self._cp, self._split = self._tate(proof)
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_local_data.py", line 743, in _tate
    halfmodp = pinv(Integer(2))
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/schemes/elliptic_curves/ell_local_data.py", line 713, in <lambda>
    pinv = lambda x: F.lift(~F(x))
  File "residue_field.pyx", line 621, in sage.rings.residue_field.ResidueField_generic.lift (sage/rings/residue_field.c:6818)
  File "parent.pyx", line 915, in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:6820)
  File "residue_field.pyx", line 1231, in sage.rings.residue_field.LiftingMap._call_ (sage/rings/residue_field.c:10160)
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/rings/number_field/number_field_ideal.py", line 2951, in __call__
    v = self.__Q.lift(x)
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/modules/quotient_module.py", line 308, in lift
    return self.__lift_map(x)
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/modules/free_module_morphism.py", line 143, in __call__
    return matrix_morphism.MatrixMorphism.__call__(self, x)
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/modules/matrix_morphism.py", line 144, in __call__
    if not hasattr(x, 'parent') or x.parent() != self.domain():
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/modules/free_module.py", line 3861, in __cmp__
    elif other.base_ring().is_subring(self.base_ring()):
  File "ring.pyx", line 677, in sage.rings.ring.Ring.is_subring (sage/rings/ring.c:5605)
  File "parent_base.pyx", line 121, in sage.structure.parent_base.ParentWithBase.Hom (sage/structure/parent_base.c:1540)
  File "finite_field_base.pyx", line 336, in sage.rings.finite_rings.finite_field_base.FiniteField._Hom_ (sage/rings/finite_rings/finite_field_base.c:3275)
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/rings/homset.py", line 33, in __init__
    HomsetWithBase.__init__(self, R, S, category)
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/categories/homset.py", line 545, in __init__
    Homset.__init__(self, X, Y, check=check, category=category, base = base)
  File "/usr/local/sage/local/lib/python2.6/site-packages/sage/categories/homset.py", line 292, in __init__
    Parent.__init__(self, base = base, category = category.hom_category())
KeyboardInterrupt
__SAGE__
E = EllipticCurve(K,[0,-1,1,0,0]) isogeny_class_computation(E,5) 
       
[Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20)
over Number Field in a with defining polynomial x^2 - x - 1]
[Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in a with defining polynomial x^2 - x - 1]
curve_isogeny_vector(E) 
       
([Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field
in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2
+ y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in a with
defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3
+ (-1)*x^2 + (-7820)*x + (-263580) over Number Field in a with defining
polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 +
(a+1)*x^2 + (-543074*a-362966)*x + (-261178146*a-163231804) over Number
Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined
by y^2 + y = x^3 + (a+1)*x^2 + (-39824*a-27466)*x + (-3448146*a-2150554)
over Number Field in a with defining polynomial x^2 - x - 1, Elliptic
Curve defined by y^2 + y = x^3 + (a+1)*x^2 + (-562324*a-373966)*x +
(-260524746*a-162832504) over Number Field in a with defining polynomial
x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 + (a+1)*x^2 +
(-59074*a-38466)*x + (-2794746*a-1751254) over Number Field in a with
defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3
+ (-1)*x^2 + (-110*a+320)*x + (47030*a-76094) over Number Field in a
with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y
= x^3 + (-1)*x^2 + (390*a+300)*x + (4322*a+908) over Number Field in a
with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y
= x^3 + (-1)*x^2 + (-390*a+690)*x + (-4322*a+5230) over Number Field in
a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 +
y = x^3 + (-1)*x^2 + (110*a+210)*x + (-47030*a-29064) over Number Field
in a with defining polynomial x^2 - x - 1], [0 5 0 0 0 0 0 0 0 0 0]
[5 0 5 5 5 5 5 5 5 5 5]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0])
([Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-7820)*x + (-263580) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 + (a+1)*x^2 + (-543074*a-362966)*x + (-261178146*a-163231804) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 + (a+1)*x^2 + (-39824*a-27466)*x + (-3448146*a-2150554) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 + (a+1)*x^2 + (-562324*a-373966)*x + (-260524746*a-162832504) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 + (a+1)*x^2 + (-59074*a-38466)*x + (-2794746*a-1751254) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-110*a+320)*x + (47030*a-76094) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (390*a+300)*x + (4322*a+908) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-390*a+690)*x + (-4322*a+5230) over Number Field in a with defining polynomial x^2 - x - 1, Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (110*a+210)*x + (-47030*a-29064) over Number Field in a with defining polynomial x^2 - x - 1], [0 5 0 0 0 0 0 0 0 0 0]
[5 0 5 5 5 5 5 5 5 5 5]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0]
[0 5 0 0 0 0 0 0 0 0 0])
wt = walltime() EllipticCurve(K,[0,a-1,a+1,-10*a-30,-32*a-82]).conductor().norm() walltime(wt) 
       
0.057826042175292969
0.057826042175292969
@cached_function 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): #Returns prime for which E has an isogeny 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): #Returns the equations for curves in p-iso class of E # 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=[] # o = 1 # while o < len(w): # try: # v.append(E.isogeny(w[o]).codomain()) # except ValueError: # pass # o+=1 # 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] # return v ###################################### def isogeny_class_computation(E,p): if p != 2: E = E.short_weierstrass_model() F = E.division_polynomial(p).change_ring(K) v = [] for f in [f for f in divisors(F) 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] return v ###################################### def curve_isogeny_vector(E): #Returns isogeny class and adjacency matrix curve_list = [E] i = 0 Adj = matrix(50) ins = 1 while i < len(curve_list): isolist = isogeny_primes(curve_list[i],500,500) for p in isolist: for F in isogeny_class_computation(curve_list[i],p): bool = True for G in curve_list: if F.is_isomorphic(G): bool = False Adj[i,curve_list.index(G)]=p #if a curve in the isogeny class computation is isom Adj[curve_list.index(G),i]=p #to a curve already in the list, we want a line if bool: curve_list.append(F) Adj[i,ins]=p Adj[ins,i]=p ins += 1 i+=1 Adj = Adj.submatrix(nrows=len(curve_list),ncols=len(curve_list)) return curve_list, Adj #################################