Changeset 7681:04ba6e30689b
- Timestamp:
- 11/14/07 07:13:48 (6 years ago)
- Branch:
- default
- Location:
- sage
- Files:
-
- 5 edited
-
categories/morphism.pyx (modified) (1 diff)
-
schemes/elliptic_curves/ell_generic.py (modified) (2 diffs)
-
schemes/elliptic_curves/ell_number_field.py (modified) (1 diff)
-
schemes/elliptic_curves/ell_rational_field.py (modified) (1 diff)
-
schemes/elliptic_curves/gp_simon.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sage/categories/morphism.pyx
r6782 r7681 213 213 def __pow__(self, n, dummy): 214 214 return self 215 216 def __invert__(self): 217 return self 215 218 216 219 -
sage/schemes/elliptic_curves/ell_generic.py
r7058 r7681 44 44 import sage.modular.modform as modform 45 45 import sage.functions.transcendental as transcendental 46 47 from sage.categories.morphism import IdentityMorphism 48 from sage.categories.homset import Hom 49 from sage.rings.arith import lcm 46 50 47 51 # Schemes … … 1304 1308 return constructor.EllipticCurve([-c4/(2**4*3), -c6/(2**5*3**3)]) 1305 1309 1310 def integral_model(self): 1311 denom = lcm([a.denominator() for a in self.ainvs()]) 1312 if denom != 1: 1313 raise NotImplementedError, "model must be integral for now" 1314 else: 1315 parent = self(0).parent() 1316 return self, IdentityMorphism(Hom(parent, parent)) 1317 1306 1318 1307 1319 -
sage/schemes/elliptic_curves/ell_number_field.py
r6767 r7681 132 132 #if self.torsion_order() % 2 == 0: 133 133 # raise ArithmeticError, "curve must not have rational 2-torsion\nThe *only* reason for this is that I haven't finished implementing the wrapper\nin this case. It wouldn't be too difficult.\nPerhaps you could do it?! Email me (wstein@gmail.com)." 134 F = self.integral_weierstrass_model()135 a1,a2,a3,a4,a6 = F.a_invariants()134 # F = self.integral_weierstrass_model() 135 # a1,a2,a3,a4,a6 = F.a_invariants() 136 136 x = PolynomialRing(self.base_ring(), 'x').gen(0) 137 t = simon_two_descent( a2,a4,a6,137 t = simon_two_descent(self, 138 138 verbose=verbose, lim1=lim1, lim3=lim3, limtriv=limtriv, 139 139 maxprob=maxprob, limbigprime=limbigprime) 140 140 prob_rank = Integer(t[0]) 141 141 two_selmer_rank = Integer(t[1]) 142 prob_gens = [ F(P) for P in t[2]]142 prob_gens = [self(P) for P in t[2]] 143 143 return prob_rank, two_selmer_rank, prob_gens 144 144 -
sage/schemes/elliptic_curves/ell_rational_field.py
r7000 r7681 858 858 (8, 8) 859 859 """ 860 if self.torsion_order() % 2 == 0: 861 raise ArithmeticError, "curve must not have rational 2-torsion\nThe *only* reason for this is that I haven't finished implementing the wrapper\nin this case. It wouldn't be too difficult.\nPerhaps you could do it?! Email me (wstein@gmail.com)." 862 F = self.integral_weierstrass_model() 863 a1,a2,a3,a4,a6 = F.a_invariants() 864 t = simon_two_descent(a2,a4,a6, verbose=verbose, lim1=lim1, lim3=lim3, limtriv=limtriv, 860 t = simon_two_descent(self, verbose=verbose, lim1=lim1, lim3=lim3, limtriv=limtriv, 865 861 maxprob=maxprob, limbigprime=limbigprime) 866 862 prob_rank = rings.Integer(t[0]) 867 863 two_selmer_rank = rings.Integer(t[1]) 868 prob_gens = [ F(P) for P in t[2]]864 prob_gens = [self(P) for P in t[2]] 869 865 return prob_rank, two_selmer_rank, prob_gens 870 866 -
sage/schemes/elliptic_curves/gp_simon.py
r6066 r7681 28 28 29 29 gp = None 30 def init( K, two_torsion):30 def init(): 31 31 global gp 32 32 if gp is None: 33 33 gp = Gp(script_subdirectory='simon') 34 34 gp.read("ell.gp") 35 if K == QQ and two_torsion == 1: 36 gp.read("ellQ.gp") 35 gp.read("ellQ.gp") 37 36 gp.read("qfsolve.gp") 38 37 gp.read("resultant3.gp") 39 38 40 39 41 def simon_two_descent( A, B, C, verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30):40 def simon_two_descent(E, verbose=0, lim1=5, lim3=50, limtriv=10, maxprob=20, limbigprime=30): 42 41 43 K = A.parent() 44 x = PolynomialRing(K, 'x').gen(0) 45 f = x**3 + A*x**2 + B*x + C 46 factors = f.factor() 47 two_torsion = 1 << (len(factors) - 1) 42 init() 43 K = E.base_ring() 44 F, transform = E.integral_model() 48 45 49 init(K, two_torsion) 50 shift = 0 51 52 if K == QQ: 53 gp.eval("K = bnfinit(y-1)") # TODO: Is there a better way to get QQ? 54 else: 46 if K != QQ: 55 47 # Simon's program requires that this name be y. 56 48 with localvars(K.polynomial().parent(), 'y'): … … 62 54 print "%s = Mod(y,K.pol);" % K.gen() 63 55 64 if two_torsion == 1: 65 if K == QQ: 66 cmd = 'main(%s,%s,%s);'%(A,B,C) 67 else: 68 # Simon's program requires that the coefficients do NOT all lie in a subfield of K 69 if A.minpoly().degree() != K.degree(): 70 shift = K.gen() 71 shifted = f(x+shift) 72 C, B, A, _ = shifted 73 cmd = 'main(K, %s,%s,%s);'%(A,B,C) 56 if K == QQ: 57 cmd = 'ellrank([%s,%s,%s,%s,%s]);' % tuple(F.ainvs()) 58 else: 59 cmd = 'bnfellrank(K, [%s,%s,%s,%s,%s]);' % tuple(F.ainvs()) 74 60 75 elif two_torsion == 2:76 if C != 0:77 # If E[2] = Z/2Z, it must be of the form y^2 = x^3 + Ax^2 + Bx78 shift = -factors[0][0][0]79 shifted = f(x+shift)80 C, B, A, _ = shifted81 cmd = 'main2(K, [0, %s, 0, %s, 0])'%(A,B)82 83 else: # two_torsion == 4:84 cmd = 'complete(K, %s,%s,%s)'%(factors[0][0][0], factors[1][0][0], factors[2][0][0])85 86 61 gp('DEBUGLEVEL=%s; LIM1=%s; LIM3=%s; LIMTRIV=%s; MAXPROB=%s; LIMBIGPRIME=%s;'%( 87 62 verbose, lim1, lim3, limtriv, maxprob, limbigprime)) 63 88 64 if verbose >= 2: 89 65 print cmd … … 101 77 return args[0] 102 78 ans = sage_eval(v, {'Mod': gp_mod, 'y': K.gen(0)}) 103 if two_torsion != 1: 104 # selmer group rank and generating points not 105 # returned for non-trivial 2-torsion 106 ans = [ans, -1, []] 107 if shift: 108 # Undo the x -> x+a translation above 109 ans[2] = [[P[0]+shift, P[1]] for P in ans[2]] 79 inv_transform = ~transform 80 ans[2] = [inv_transform(F(P)) for P in ans[2]] 110 81 return ans 111 82
Note: See TracChangeset
for help on using the changeset viewer.
