@@ -155,7 +155,7 @@ def quadratic_twist(self, D=None):
155
155
# degree is odd we can take D=1; otherwise it suffices to
156
156
# consider odd powers of a generator.
157
157
D = K (1 )
158
- if K .degree () % 2 == 0 :
158
+ if K .degree () % 2 == 0 :
159
159
D = K .gen ()
160
160
a = D ** 2
161
161
while (x ** 2 + x + D ).roots ():
@@ -172,26 +172,26 @@ def quadratic_twist(self, D=None):
172
172
raise ValueError ("twisting parameter D must be specified over infinite fields." )
173
173
else :
174
174
try :
175
- D = K (D )
175
+ D = K (D )
176
176
except ValueError :
177
177
raise ValueError ("twisting parameter D must be in the base field." )
178
178
179
- if char != 2 and D .is_zero ():
179
+ if char != 2 and D .is_zero ():
180
180
raise ValueError ("twisting parameter D must be nonzero when characteristic is not 2" )
181
181
182
- if char != 2 :
183
- b2 ,b4 ,b6 ,b8 = self .b_invariants ()
182
+ if char != 2 :
183
+ b2 ,b4 ,b6 ,b8 = self .b_invariants ()
184
184
# E is isomorphic to [0,b2,0,8*b4,16*b6]
185
185
return EllipticCurve (K ,[0 ,b2 * D ,0 ,8 * b4 * D ** 2 ,16 * b6 * D ** 3 ])
186
186
187
187
# now char==2
188
- if self .j_invariant () != 0 : # iff a1!=0
189
- a1 ,a2 ,a3 ,a4 ,a6 = self .ainvs ()
190
- E0 = self .change_weierstrass_model (a1 ,a3 / a1 ,0 ,(a1 ** 2 * a4 + a3 ** 2 )/ a1 ** 3 )
188
+ if self .j_invariant () != 0 : # iff a1!=0
189
+ a1 ,a2 ,a3 ,a4 ,a6 = self .ainvs ()
190
+ E0 = self .change_weierstrass_model (a1 ,a3 / a1 ,0 ,(a1 ** 2 * a4 + a3 ** 2 )/ a1 ** 3 )
191
191
# which has the form = [1,A2,0,0,A6]
192
- assert E0 .a1 ()== K (1 )
193
- assert E0 .a3 ()== K (0 )
194
- assert E0 .a4 ()== K (0 )
192
+ assert E0 .a1 () == K (1 )
193
+ assert E0 .a3 () == K (0 )
194
+ assert E0 .a4 () == K (0 )
195
195
return EllipticCurve (K ,[1 ,E0 .a2 ()+ D ,0 ,0 ,E0 .a6 ()])
196
196
else :
197
197
raise ValueError ("Quadratic twist not implemented in char 2 when j=0" )
@@ -229,8 +229,8 @@ def two_torsion_rank(self):
229
229
sage: EllipticCurve('15a1').two_torsion_rank()
230
230
2
231
231
"""
232
- f = self .division_polynomial (rings .Integer (2 ))
233
- n = len (f .roots ())+ 1
232
+ f = self .division_polynomial (rings .Integer (2 ))
233
+ n = len (f .roots ())+ 1
234
234
return rings .Integer (n ).ord (rings .Integer (2 ))
235
235
236
236
def quartic_twist (self , D ):
@@ -258,22 +258,22 @@ def quartic_twist(self, D):
258
258
sage: E.is_isomorphic(E1, GF(13^4,'a')) # optional - sage.rings.finite_rings
259
259
True
260
260
"""
261
- K = self .base_ring ()
262
- char = K .characteristic ()
263
- D = K (D )
261
+ K = self .base_ring ()
262
+ char = K .characteristic ()
263
+ D = K (D )
264
264
265
- if char == 2 or char == 3 :
265
+ if char == 2 or char == 3 :
266
266
raise ValueError ("Quartic twist not defined in chars 2,3" )
267
267
268
- if self .j_invariant () != K (1728 ):
268
+ if self .j_invariant () != K (1728 ):
269
269
raise ValueError ("Quartic twist not defined when j!=1728" )
270
270
271
271
if D .is_zero ():
272
272
raise ValueError ("quartic twist requires a nonzero argument" )
273
273
274
- c4 ,c6 = self .c_invariants ()
274
+ c4 ,c6 = self .c_invariants ()
275
275
# E is isomorphic to [0,0,0,-27*c4,0]
276
- assert c6 == 0
276
+ assert c6 == 0
277
277
return EllipticCurve (K ,[0 ,0 ,0 ,- 27 * c4 * D ,0 ])
278
278
279
279
def sextic_twist (self , D ):
@@ -303,22 +303,22 @@ def sextic_twist(self, D):
303
303
sage: E.is_isomorphic(E1, GF(13^6,'a')) # optional - sage.rings.finite_rings
304
304
True
305
305
"""
306
- K = self .base_ring ()
307
- char = K .characteristic ()
308
- D = K (D )
306
+ K = self .base_ring ()
307
+ char = K .characteristic ()
308
+ D = K (D )
309
309
310
- if char == 2 or char == 3 :
310
+ if char == 2 or char == 3 :
311
311
raise ValueError ("Sextic twist not defined in chars 2,3" )
312
312
313
- if self .j_invariant () != K (0 ):
313
+ if self .j_invariant () != K (0 ):
314
314
raise ValueError ("Sextic twist not defined when j!=0" )
315
315
316
316
if D .is_zero ():
317
317
raise ValueError ("Sextic twist requires a nonzero argument" )
318
318
319
- c4 ,c6 = self .c_invariants ()
319
+ c4 ,c6 = self .c_invariants ()
320
320
# E is isomorphic to [0,0,0,0,-54*c6]
321
- assert c4 == 0
321
+ assert c4 == 0
322
322
return EllipticCurve (K ,[0 ,0 ,0 ,0 ,- 54 * c6 * D ])
323
323
324
324
def is_quadratic_twist (self , other ):
@@ -420,7 +420,7 @@ def is_quadratic_twist(self, other):
420
420
zero = K .zero ()
421
421
if not K == F .base_ring ():
422
422
return zero
423
- j = E .j_invariant ()
423
+ j = E .j_invariant ()
424
424
if j != F .j_invariant ():
425
425
return zero
426
426
@@ -429,12 +429,12 @@ def is_quadratic_twist(self, other):
429
429
return rings .ZZ (1 )
430
430
return K .one ()
431
431
432
- char = K .characteristic ()
432
+ char = K .characteristic ()
433
433
434
- if char == 2 :
434
+ if char == 2 :
435
435
raise NotImplementedError ("not implemented in characteristic 2" )
436
- elif char == 3 :
437
- if j == 0 :
436
+ elif char == 3 :
437
+ if j == 0 :
438
438
raise NotImplementedError ("not implemented in characteristic 3 for curves of j-invariant 0" )
439
439
D = E .b2 ()/ F .b2 ()
440
440
@@ -443,18 +443,18 @@ def is_quadratic_twist(self, other):
443
443
c4E ,c6E = E .c_invariants ()
444
444
c4F ,c6F = F .c_invariants ()
445
445
446
- if j == 0 :
446
+ if j == 0 :
447
447
um = c6E / c6F
448
- x = rings .polygen (K )
449
- ulist = (x ** 3 - um ).roots (multiplicities = False )
448
+ x = rings .polygen (K )
449
+ ulist = (x ** 3 - um ).roots (multiplicities = False )
450
450
if not ulist :
451
451
D = zero
452
452
else :
453
453
D = ulist [0 ]
454
- elif j == 1728 :
455
- um = c4E / c4F
456
- x = rings .polygen (K )
457
- ulist = (x ** 2 - um ).roots (multiplicities = False )
454
+ elif j == 1728 :
455
+ um = c4E / c4F
456
+ x = rings .polygen (K )
457
+ ulist = (x ** 2 - um ).roots (multiplicities = False )
458
458
if not ulist :
459
459
D = zero
460
460
else :
@@ -519,18 +519,18 @@ def is_quartic_twist(self, other):
519
519
zero = K .zero ()
520
520
if not K == F .base_ring ():
521
521
return zero
522
- j = E .j_invariant ()
523
- if j != F .j_invariant () or j != K (1728 ):
522
+ j = E .j_invariant ()
523
+ if j != F .j_invariant () or j != K (1728 ):
524
524
return zero
525
525
526
526
if E .is_isomorphic (F ):
527
527
return K .one ()
528
528
529
- char = K .characteristic ()
529
+ char = K .characteristic ()
530
530
531
- if char == 2 :
531
+ if char == 2 :
532
532
raise NotImplementedError ("not implemented in characteristic 2" )
533
- elif char == 3 :
533
+ elif char == 3 :
534
534
raise NotImplementedError ("not implemented in characteristic 3" )
535
535
else :
536
536
# now char!=2,3:
@@ -588,18 +588,18 @@ def is_sextic_twist(self, other):
588
588
zero = K .zero ()
589
589
if not K == F .base_ring ():
590
590
return zero
591
- j = E .j_invariant ()
591
+ j = E .j_invariant ()
592
592
if j != F .j_invariant () or not j .is_zero ():
593
593
return zero
594
594
595
595
if E .is_isomorphic (F ):
596
596
return K .one ()
597
597
598
- char = K .characteristic ()
598
+ char = K .characteristic ()
599
599
600
- if char == 2 :
600
+ if char == 2 :
601
601
raise NotImplementedError ("not implemented in characteristic 2" )
602
- elif char == 3 :
602
+ elif char == 3 :
603
603
raise NotImplementedError ("not implemented in characteristic 3" )
604
604
else :
605
605
# now char!=2,3:
@@ -1757,7 +1757,7 @@ def hasse_invariant(self):
1757
1757
R = k ['x' ]
1758
1758
x = R .gen ()
1759
1759
E = self .short_weierstrass_model ()
1760
- f = (x ** 3 + E .a4 ()* x + E .a6 ())** ((p - 1 )// 2 )
1760
+ f = (x ** 3 + E .a4 ()* x + E .a6 ())** ((p - 1 )// 2 )
1761
1761
return f .coefficients (sparse = False )[p - 1 ]
1762
1762
1763
1763
def isogeny_ell_graph (self , l , directed = True , label_by_j = False ):
0 commit comments