Ticket #3961: sage-trac3926.patch
| File sage-trac3926.patch, 4.2 kB (added by cremona, 4 months ago) |
|---|
-
a/sage/schemes/elliptic_curves/ell_finite_field.py
old new 1014 1014 sage: for p in prime_range(10000): #long time (~20s) 1015 1015 ... if p != 389: 1016 1016 ... G=E.change_ring(GF(p)).abelian_group() 1017 1018 This tests that the bug reported in trac \#3926 has been fixed: 1019 sage: K.<i> = QuadraticField(-1) 1020 sage: OK = K.ring_of_integers() 1021 sage: P=K.factor(10007)[0][0] 1022 sage: OKmodP = OK.residue_field(P) 1023 sage: E = EllipticCurve([0,0,0,i,i+3]) 1024 sage: Emod = E.change_ring(OKmodP); Emod 1025 Elliptic Curve defined by y^2 = x^3 + ibar*x + (ibar+3) over Residue field in ibar of Fractional ideal (10007) 1026 sage: Emod.abelian_group() #random generators 1027 (Multiplicative Abelian Group isomorphic to C50067594 x C2, 1028 ((3152*ibar + 7679 : 7330*ibar + 7913 : 1), (8466*ibar + 1770 : 0 : 1))) 1017 1029 """ 1018 1030 if not debug: 1019 1031 # if we're in debug mode, always recalculate … … 1120 1132 P1a = n1a*P1 # has order = n1b 1121 1133 if debug: print "n1a=",n1a 1122 1134 a = None 1123 for m in (N//n1).divisors():1135 for m in n1b.divisors(): 1124 1136 try: 1125 1137 a = generic.bsgs(m*P1a,m*Q,(0,(n1b//m)-1),operation='+') 1126 1138 break … … 1139 1151 n2=m 1140 1152 if debug: 1141 1153 print "Adding second generator ",P2," of order ",n2 1142 print " Group order now ",n1*n2,"=",n1,"*",n21154 print "Subgroup order now ",n1*n2,"=",n1,"*",n2 1143 1155 else: # we must merge P2 and Q: 1144 1156 oldn2=n2 # holds old value 1145 1157 P2,n2=generic.merge_points((P2,n2),(Q,m),operation='+'); … … 1149 1161 if n2>oldn2: 1150 1162 print "Replacing second generator by ",P2, 1151 1163 print " of order ",n2, " gaining index ",n2//oldn2 1152 print " Group order now ",n1*n2,"=",n1,"*",n21164 print "Subgroup order now ",n1*n2,"=",n1,"*",n2 1153 1165 elif not Q1.is_zero(): # Q1 nonzero: n1 will increase 1154 1166 if debug: print "Case 1: n1 may increase" 1155 1167 oldn1=n1 … … 1165 1177 if debug: 1166 1178 print "Replacing first generator by ",P1," of order ", 1167 1179 print n1,", gaining index ",n1//oldn1 1168 print "Group order now ",n1*n2,"=",n1,"*",n2 1180 print "Subgroup order now ",n1*n2,"=",n1,"*",n2 1181 1182 # If we did not yet know the group order, we may now be 1183 # able to determine it 1184 if not group_order_known: 1185 M = n1*n2 # group order is a multiple of this 1186 c1 = (upper/M).floor() 1187 if c1 == (lower/M).ceil(): 1188 group_order_known = True 1189 lower = upper = N = c1*M 1190 if debug: 1191 print "Group order now determined to be ",N 1192 1169 1193 # Now replace P2 by a point of order n2 s.t. it and 1170 1194 # (n1//n2)*P1 are still a basis for n2-torsion: 1171 1195 if n2>1: … … 1204 1228 raise ValueError 1205 1229 print "Generators: P1 = ",P1," of order ",n1, 1206 1230 print ", P2 = ",P2," of order ",n2 1207 print " Group ordernow ",n1*n2,"=",n1,"*",n21231 print "Subgroup order is now ",n1*n2,"=",n1,"*",n2 1208 1232 1209 1233 # Finished: record group order, structure and generators 1210 1234