Path: blob/master/src/sage/schemes/elliptic_curves/weierstrass_transform.py
8821 views
"""1Morphism to bring a genus-one curve into Weierstrass form23You should use4:func:`~sage.schemes.elliptic_curves.constructor.EllipticCurve_from_cubic`5or6:func:`~sage.schemes.elliptic_curves.constructor.EllipticCurve_from_curve`7to construct the transformation starting with a cubic or with a genus8one curve.910EXAMPLES::1112sage: R.<u,v,w> = QQ[]13sage: f = EllipticCurve_from_cubic(u^3 + v^3 + w^3, [1,-1,0], morphism=True); f14Scheme morphism:15From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:16u^3 + v^3 + w^317To: Elliptic Curve defined by y^2 + 2*x*y + 1/3*y18= x^3 - x^2 - 1/3*x - 1/27 over Rational Field19Defn: Defined on coordinates by sending (u : v : w) to20(-w : -v + w : 3*u + 3*v)2122sage: finv = f.inverse(); finv23Scheme morphism:24From: Elliptic Curve defined by y^2 + 2*x*y + 1/3*y25= x^3 - x^2 - 1/3*x - 1/27 over Rational Field26To: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:27u^3 + v^3 + w^328Defn: Defined on coordinates by sending (x : y : z) to29(x + y + 1/3*z : -x - y : -x)3031sage: (u^3 + v^3 + w^3)(f.inverse().defining_polynomials()) * f.inverse().post_rescaling()32-x^3 + x^2*z + 2*x*y*z + y^2*z + 1/3*x*z^2 + 1/3*y*z^2 + 1/27*z^33334sage: E = finv.domain()35sage: E.defining_polynomial()(f.defining_polynomials()) * f.post_rescaling()36u^3 + v^3 + w^33738sage: f([1,-1,0])39(0 : 1 : 0)40sage: f([1,0,-1])41(1/3 : -1/3 : 1)42sage: f([0,1,-1])43(1/3 : -2/3 : 1)44"""4546##############################################################################47# Copyright (C) 2013 Volker Braun <[email protected]>48#49# Distributed under the terms of the GNU General Public License (GPL)50#51# The full text of the GPL is available at:52#53# http://www.gnu.org/licenses/54##############################################################################555657from sage.schemes.generic.morphism import SchemeMorphism_polynomial5859from sage.categories.morphism import Morphism60from constructor import EllipticCurve61from sage.categories.homset import Hom626364class WeierstrassTransformation(SchemeMorphism_polynomial):6566def __init__(self, domain, codomain, defining_polynomials, post_multiplication):67r"""68A morphism of a a genus-one curve to/from the Weierstrass form.6970INPUT:7172- ``domain``, ``codomain`` -- two schemes, one of which is an73elliptic curve.7475- ``defining_polynomials`` -- triplet of polynomials that76define the transformation.7778- ``post_multiplication`` -- a polynomial to homogeneously79rescale after substituting the defining polynomials.8081EXAMPLES::8283sage: P2.<u,v,w> = ProjectiveSpace(2,QQ)84sage: C = P2.subscheme(u^3 + v^3 + w^3)85sage: E = EllipticCurve([2, -1, -1/3, 1/3, -1/27])86sage: from sage.schemes.elliptic_curves.weierstrass_transform import WeierstrassTransformation87sage: f = WeierstrassTransformation(C, E, [w, -v-w, -3*u-3*v], 1); f88Scheme morphism:89From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:90u^3 + v^3 + w^391To: Elliptic Curve defined by y^2 + 2*x*y - 1/3*y = x^3 - x^2 + 1/3*x - 1/2792over Rational Field93Defn: Defined on coordinates by sending (u : v : w) to94(w : -v - w : -3*u - 3*v)9596sage: f([-1, 1, 0])97(0 : 1 : 0)98sage: f([-1, 0, 1])99(1/3 : -1/3 : 1)100sage: f([ 0,-1, 1])101(1/3 : 0 : 1)102103sage: A2.<a,b> = AffineSpace(2,QQ)104sage: C = A2.subscheme(a^3 + b^3 + 1)105sage: f = WeierstrassTransformation(C, E, [1, -b-1, -3*a-3*b], 1); f106Scheme morphism:107From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:108a^3 + b^3 + 1109To: Elliptic Curve defined by y^2 + 2*x*y - 1/3*y110= x^3 - x^2 + 1/3*x - 1/27 over Rational Field111Defn: Defined on coordinates by sending (a, b) to112(1 : -b - 1 : -3*a - 3*b)113sage: f([-1,0])114(1/3 : -1/3 : 1)115sage: f([0,-1])116(1/3 : 0 : 1)117"""118Hom = domain.Hom(codomain)119super(WeierstrassTransformation, self).__init__(Hom, defining_polynomials)120self._post = post_multiplication121122def post_rescaling(self):123"""124Return the homogeneous rescaling to apply after the coordinate125substitution.126127OUTPUT:128129A polyomial. See the example below.130131EXAMPLES::132133sage: R.<a,b,c> = QQ[]134sage: cubic = a^3+7*b^3+64*c^3135sage: P = [2,2,-1]136sage: f = EllipticCurve_from_cubic(cubic, P, morphism=True).inverse()137sage: f.post_rescaling()1381/60480/(180*x^2*z)139140So here is what it does. If we just plug in the coordinate141transformation, we get the defining polynomial up to142scale. This method returns the overall rescaling of the143equation to bring the result into the standard form::144145sage: cubic(f.defining_polynomials())146-10886400*x^5*z - 256690425600*x^4*z^2 - 7859980800*x^3*y*z^2147+ 10886400*x^2*y^2*z^2 - 238085568000000*x^2*y*z^3148sage: cubic(f.defining_polynomials()) * f.post_rescaling()149-x^3 - 23579*x^2*z - 722*x*y*z + y^2*z - 21870000*y*z^2150"""151return self._post152153154def WeierstrassTransformationWithInverse(domain, codomain,155defining_polynomials, post_multiplication,156inv_defining_polynomials, inv_post_multiplication):157"""158Construct morphism of a a genus-one curve to/from the Weierstrass159form with its inverse.160161EXAMPLES::162163sage: R.<u,v,w> = QQ[]164sage: f = EllipticCurve_from_cubic(u^3 + v^3 + w^3, [1,-1,0], morphism=True); f165Scheme morphism:166From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:167u^3 + v^3 + w^3168To: Elliptic Curve defined by y^2 + 2*x*y + 1/3*y169= x^3 - x^2 - 1/3*x - 1/27 over Rational Field170Defn: Defined on coordinates by sending (u : v : w) to171(-w : -v + w : 3*u + 3*v)172"""173fwd = WeierstrassTransformationWithInverse_class(174domain, codomain, defining_polynomials, post_multiplication)175inv = WeierstrassTransformationWithInverse_class(176codomain, domain, inv_defining_polynomials, inv_post_multiplication)177fwd._inverse = inv178inv._inverse = fwd179return fwd180181182class WeierstrassTransformationWithInverse_class(WeierstrassTransformation):183184def inverse(self):185"""186Return the inverse.187188OUTPUT:189190A morphism in the opposite direction. This may be a rational191inverse or an analytic inverse.192193EXAMPLES::194195sage: R.<u,v,w> = QQ[]196sage: f = EllipticCurve_from_cubic(u^3 + v^3 + w^3, [1,-1,0], morphism=True)197sage: f.inverse()198Scheme morphism:199From: Elliptic Curve defined by y^2 + 2*x*y + 1/3*y200= x^3 - x^2 - 1/3*x - 1/27 over Rational Field201To: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:202u^3 + v^3 + w^3203Defn: Defined on coordinates by sending (x : y : z) to204(x + y + 1/3*z : -x - y : -x)205"""206return self._inverse207208209210211