@@ -3197,6 +3197,18 @@ def dual(self):
3197
3197
sage: phi._EllipticCurveIsogeny__clear_cached_values() # forget the dual
3198
3198
sage: -phi.dual() == (-phi).dual()
3199
3199
True
3200
+
3201
+ Check that :trac:`37168` is fixed::
3202
+
3203
+ sage: R.<x> = GF(23)[]
3204
+ sage: F.<a> = FiniteField(23^2, modulus=x^2-x+1)
3205
+ sage: E0 = EllipticCurve(F, (0, 1))
3206
+ sage: E1 = EllipticCurve(F, (8, 1))
3207
+ sage: phi = E0.isogeny(kernel=E0((a, 0)), codomain=E1)
3208
+ sage: phi.dual()
3209
+ Isogeny of degree 2
3210
+ from Elliptic Curve defined by y^2 = x^3 + 8*x + 1 over Finite Field in a of size 23^2
3211
+ to Elliptic Curve defined by y^2 = x^3 + 1 over Finite Field in a of size 23^2
3200
3212
"""
3201
3213
if self .__base_field .characteristic () in (2 , 3 ):
3202
3214
raise NotImplementedError ("computation of dual isogenies not yet implemented in characteristics 2 and 3" )
@@ -3260,17 +3272,18 @@ def dual(self):
3260
3272
E2 = E2pr .change_weierstrass_model (u / F (d ), 0 , 0 , 0 )
3261
3273
3262
3274
phi_hat = EllipticCurveIsogeny (E1 , None , E2 , d )
3263
-
3264
- pre_iso = self ._codomain .isomorphism_to (E1 )
3265
- post_iso = E2 .isomorphism_to (self ._domain )
3266
-
3267
3275
# assert phi_hat.scaling_factor() == 1
3268
- sc = u * pre_iso .scaling_factor () * post_iso .scaling_factor () / F (d )
3269
- if not sc .is_one ():
3270
- auts = self ._codomain .automorphisms ()
3271
- aut = [a for a in auts if a .u == sc ]
3272
- assert len (aut ) == 1 , "bug in dual()"
3273
- pre_iso *= aut [0 ]
3276
+
3277
+ for pre_iso in self ._codomain .isomorphisms (E1 ):
3278
+ for post_iso in E2 .isomorphisms (self ._domain ):
3279
+ sc = u * pre_iso .scaling_factor () * post_iso .scaling_factor ()
3280
+ if sc == d :
3281
+ break
3282
+ else :
3283
+ continue
3284
+ break
3285
+ else :
3286
+ assert "bug in dual()"
3274
3287
3275
3288
phi_hat ._set_pre_isomorphism (pre_iso )
3276
3289
phi_hat ._set_post_isomorphism (post_iso )
0 commit comments