24
24
25
25
from sage .categories .morphism import Morphism
26
26
27
+ import sage .schemes .elliptic_curves .weierstrass_morphism as wm
28
+
27
29
28
30
class EllipticCurveHom (Morphism ):
29
31
"""
@@ -162,9 +164,11 @@ def degree(self):
162
164
r"""
163
165
Return the degree of this elliptic-curve morphism.
164
166
165
- Implemented by child classes. For examples,
166
- see :meth:`EllipticCurveIsogeny.degree` and
167
- :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.degree`.
167
+ Implemented by child classes. For examples, see:
168
+
169
+ - :meth:`EllipticCurveIsogeny.degree`
170
+ - :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.degree`
171
+ - :meth:`sage.schemes.elliptic_curves.hom_composite.EllipticCurveHom_composite.degree`
168
172
169
173
TESTS::
170
174
@@ -180,9 +184,11 @@ def kernel_polynomial(self):
180
184
r"""
181
185
Return the kernel polynomial of this elliptic-curve morphism.
182
186
183
- Implemented by child classes. For examples,
184
- see :meth:`EllipticCurveIsogeny.kernel_polynomial` and
185
- :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.kernel_polynomial`.
187
+ Implemented by child classes. For examples, see:
188
+
189
+ - :meth:`EllipticCurveIsogeny.kernel_polynomial`
190
+ - :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.kernel_polynomial`
191
+ - :meth:`sage.schemes.elliptic_curves.hom_composite.EllipticCurveHom_composite.kernel_polynomial`
186
192
187
193
TESTS::
188
194
@@ -198,9 +204,11 @@ def dual(self):
198
204
r"""
199
205
Return the dual of this elliptic-curve morphism.
200
206
201
- Implemented by child classes. For examples,
202
- see :meth:`EllipticCurveIsogeny.dual` and
203
- :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.dual`.
207
+ Implemented by child classes. For examples, see:
208
+
209
+ - :meth:`EllipticCurveIsogeny.dual`
210
+ - :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.dual`
211
+ - :meth:`sage.schemes.elliptic_curves.hom_composite.EllipticCurveHom_composite.dual`
204
212
205
213
TESTS::
206
214
@@ -218,9 +226,11 @@ def rational_maps(self):
218
226
elliptic-curve morphism as fractions of bivariate
219
227
polynomials in `x` and `y`.
220
228
221
- Implemented by child classes. For examples,
222
- see :meth:`EllipticCurveIsogeny.rational_maps` and
223
- :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.rational_maps`.
229
+ Implemented by child classes. For examples, see:
230
+
231
+ - :meth:`EllipticCurveIsogeny.rational_maps`
232
+ - :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.rational_maps`
233
+ - :meth:`sage.schemes.elliptic_curves.hom_composite.EllipticCurveHom_composite.rational_maps`
224
234
225
235
TESTS::
226
236
@@ -237,9 +247,11 @@ def x_rational_map(self):
237
247
Return the `x`-coordinate rational map of this elliptic-curve
238
248
morphism as a univariate rational expression in `x`.
239
249
240
- Implemented by child classes. For examples,
241
- see :meth:`EllipticCurveIsogeny.x_rational_map` and
242
- :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.x_rational_map`.
250
+ Implemented by child classes. For examples, see:
251
+
252
+ - :meth:`EllipticCurveIsogeny.x_rational_map`
253
+ - :meth:`sage.schemes.elliptic_curves.weierstrass_morphism.WeierstrassIsomorphism.x_rational_map`
254
+ - :meth:`sage.schemes.elliptic_curves.hom_composite.EllipticCurveHom_composite.x_rational_map`
243
255
244
256
TESTS::
245
257
@@ -448,7 +460,7 @@ def is_surjective(self):
448
460
sage: phi.is_surjective()
449
461
True
450
462
"""
451
- return True
463
+ return bool ( self . degree ())
452
464
453
465
def is_injective (self ):
454
466
r"""
@@ -477,9 +489,9 @@ def is_injective(self):
477
489
sage: phi.is_injective()
478
490
True
479
491
"""
480
- # This will become wrong once purely inseparable isogenies
481
- # are implemented. We should probably add something like a
482
- # separable_degree() method then.
492
+ if not self . is_separable ():
493
+ #TODO: should implement .separable_degree() or similar
494
+ raise NotImplementedError
483
495
return self .degree () == 1
484
496
485
497
def is_zero (self ):
@@ -501,6 +513,25 @@ def is_zero(self):
501
513
"""
502
514
return not self .degree ()
503
515
516
+ def __neg__ (self ):
517
+ r"""
518
+ Return the negative of this elliptic-curve morphism. In other
519
+ words, return `[-1]\circ\varphi` where `\varphi` is ``self``
520
+ and `[-1]` is the negation automorphism on the codomain curve.
521
+
522
+ EXAMPLES::
523
+
524
+ sage: from sage.schemes.elliptic_curves.hom import EllipticCurveHom
525
+ sage: E = EllipticCurve(GF(1019), [5,5])
526
+ sage: phi = E.isogeny(E.lift_x(73))
527
+ sage: f,g = phi.rational_maps()
528
+ sage: psi = EllipticCurveHom.__neg__(phi)
529
+ sage: psi.rational_maps() == (f, -g)
530
+ True
531
+ """
532
+ a1 ,_ ,a3 ,_ ,_ = self .codomain ().a_invariants ()
533
+ return wm .WeierstrassIsomorphism (self .codomain (), (- 1 ,0 ,- a1 ,- a3 )) * self
534
+
504
535
@cached_method
505
536
def __hash__ (self ):
506
537
"""
0 commit comments