diff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py index 4719b914bde..794bbaa6763 100644 --- a/src/sage/schemes/elliptic_curves/ell_generic.py +++ b/src/sage/schemes/elliptic_curves/ell_generic.py @@ -456,10 +456,7 @@ def __contains__(self, P): P = self(P) except TypeError: return False - if P.curve() == self: - return True - x, y, a = P[0], P[1], self.ainvs() - return y**2 + a[0]*x*y + a[2]*y == x**3 + a[1]*x**2 + a[3]*x + a[4] + return P.curve() == self def __call__(self, *args, **kwds): r""" @@ -572,10 +569,7 @@ def __call__(self, *args, **kwds): P = args[0] if isinstance(P, groups.AdditiveAbelianGroupElement) and isinstance(P.parent(),ell_torsion.EllipticCurveTorsionSubgroup): return self(P.element()) - if isinstance(args[0], - (ell_point.EllipticCurvePoint_field, - ell_point.EllipticCurvePoint_number_field, - ell_point.EllipticCurvePoint)): + if isinstance(args[0], ell_point.EllipticCurvePoint): if P.curve() is self: return P # check if denominator of the point contains a factor of the diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py index 99e3e8c81fa..c1817dbd654 100644 --- a/src/sage/schemes/elliptic_curves/ell_point.py +++ b/src/sage/schemes/elliptic_curves/ell_point.py @@ -1,18 +1,15 @@ r""" Points on elliptic curves -The base class ``EllipticCurvePoint_field``, derived from -``AdditiveGroupElement``, provides support for points on elliptic -curves defined over general fields. The derived classes -``EllipticCurvePoint_number_field`` and -``EllipticCurvePoint_finite_field`` provide further support for point -on curves defined over number fields (including the rational field +The base class :class:`EllipticCurvePoint` currently provides little +functionality of its own. Its derived class +:class:`EllipticCurvePoint_field` provides support for points on +elliptic curves over general fields. The derived classes +:class:`EllipticCurvePoint_number_field` and +:class:`EllipticCurvePoint_finite_field` provide further support for +points on curves over number fields (including the rational field `\QQ`) and over finite fields. -The class ``EllipticCurvePoint``, which is based on -``SchemeMorphism_point_projective_ring``, currently has little extra -functionality. - EXAMPLES: An example over `\QQ`:: @@ -107,7 +104,6 @@ - Mariah Lenox (March 2011) -- Added ``tate_pairing`` and ``ate_pairing`` functions to ``EllipticCurvePoint_finite_field`` class - """ # **************************************************************************** @@ -134,6 +130,8 @@ from sage.rings.real_mpfr import RealField from sage.rings.real_mpfr import RR import sage.groups.generic as generic + +from sage.structure.element import AdditiveGroupElement from sage.structure.sequence import Sequence from sage.structure.richcmp import richcmp @@ -153,14 +151,41 @@ PariError = () -class EllipticCurvePoint(SchemeMorphism_point_projective_ring): +class EllipticCurvePoint(AdditiveGroupElement, + SchemeMorphism_point_projective_ring): """ A point on an elliptic curve. """ - pass + def curve(self): + """ + Return the curve that this point is on. + + This is a synonym for :meth:`scheme`. + EXAMPLES:: -class EllipticCurvePoint_field(SchemeMorphism_point_abelian_variety_field): + sage: E = EllipticCurve('389a') + sage: P = E([-1, 1]) + sage: P.curve() + Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field + + sage: E = EllipticCurve(QQ, [1, 1]) + sage: P = E(0, 1) + sage: P.scheme() + Elliptic Curve defined by y^2 = x^3 + x + 1 over Rational Field + sage: P.scheme() == P.curve() + True + sage: x = polygen(ZZ, 'x') + sage: K. = NumberField(x^2 - 3,'a') # needs sage.rings.number_field + sage: P = E.base_extend(K)(1, a) # needs sage.rings.number_field + sage: P.scheme() # needs sage.rings.number_field + Elliptic Curve defined by y^2 = x^3 + x + 1 over Number Field in a with defining polynomial x^2 - 3 + """ + return self.scheme() + + +class EllipticCurvePoint_field(EllipticCurvePoint, + SchemeMorphism_point_abelian_variety_field): """ A point on an elliptic curve over a field. The point has coordinates in the base field. @@ -275,7 +300,6 @@ def __init__(self, curve, v, check=True): v = (R.zero(), R.one(), R.zero()) SchemeMorphism_point_abelian_variety_field.__init__(self, point_homset, v, check=check) - # AdditiveGroupElement.__init__(self, point_homset) self.normalize_coordinates() @@ -426,39 +450,6 @@ def __pari__(self): else: return pari([0]) - def scheme(self): - """ - Return the scheme of this point, i.e., the curve it is on. - This is synonymous with :meth:`curve` which is perhaps more - intuitive. - - EXAMPLES:: - - sage: E = EllipticCurve(QQ,[1,1]) - sage: P = E(0,1) - sage: P.scheme() - Elliptic Curve defined by y^2 = x^3 + x + 1 over Rational Field - sage: P.scheme() == P.curve() - True - sage: x = polygen(ZZ, 'x') - sage: K. = NumberField(x^2 - 3,'a') # needs sage.rings.number_field - sage: P = E.base_extend(K)(1, a) # needs sage.rings.number_field - sage: P.scheme() # needs sage.rings.number_field - Elliptic Curve defined by y^2 = x^3 + x + 1 - over Number Field in a with defining polynomial x^2 - 3 - """ - # The following text is just not true: it applies to the class - # EllipticCurvePoint, which appears to be never used, but does - # not apply to EllipticCurvePoint_field which is simply derived - # from AdditiveGroupElement. - # - # "Technically, points on curves in Sage are scheme maps from - # the domain Spec(F) where F is the base field of the curve to - # the codomain which is the curve. See also domain() and - # codomain()." - - return self.codomain() - def order(self): r""" Return the order of this point on the elliptic curve. @@ -497,19 +488,6 @@ def order(self): additive_order = order - def curve(self): - """ - Return the curve that this point is on. - - EXAMPLES:: - - sage: E = EllipticCurve('389a') - sage: P = E([-1,1]) - sage: P.curve() - Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field - """ - return self.scheme() - def __bool__(self): """ Return ``True`` if this is not the zero point on the curve.