Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/schemes/elliptic_curves/weierstrass_transform.py
8821 views
1
"""
2
Morphism to bring a genus-one curve into Weierstrass form
3
4
You should use
5
:func:`~sage.schemes.elliptic_curves.constructor.EllipticCurve_from_cubic`
6
or
7
:func:`~sage.schemes.elliptic_curves.constructor.EllipticCurve_from_curve`
8
to construct the transformation starting with a cubic or with a genus
9
one curve.
10
11
EXAMPLES::
12
13
sage: R.<u,v,w> = QQ[]
14
sage: f = EllipticCurve_from_cubic(u^3 + v^3 + w^3, [1,-1,0], morphism=True); f
15
Scheme morphism:
16
From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:
17
u^3 + v^3 + w^3
18
To: Elliptic Curve defined by y^2 + 2*x*y + 1/3*y
19
= x^3 - x^2 - 1/3*x - 1/27 over Rational Field
20
Defn: Defined on coordinates by sending (u : v : w) to
21
(-w : -v + w : 3*u + 3*v)
22
23
sage: finv = f.inverse(); finv
24
Scheme morphism:
25
From: Elliptic Curve defined by y^2 + 2*x*y + 1/3*y
26
= x^3 - x^2 - 1/3*x - 1/27 over Rational Field
27
To: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:
28
u^3 + v^3 + w^3
29
Defn: Defined on coordinates by sending (x : y : z) to
30
(x + y + 1/3*z : -x - y : -x)
31
32
sage: (u^3 + v^3 + w^3)(f.inverse().defining_polynomials()) * f.inverse().post_rescaling()
33
-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^3
34
35
sage: E = finv.domain()
36
sage: E.defining_polynomial()(f.defining_polynomials()) * f.post_rescaling()
37
u^3 + v^3 + w^3
38
39
sage: f([1,-1,0])
40
(0 : 1 : 0)
41
sage: f([1,0,-1])
42
(1/3 : -1/3 : 1)
43
sage: f([0,1,-1])
44
(1/3 : -2/3 : 1)
45
"""
46
47
##############################################################################
48
# Copyright (C) 2013 Volker Braun <[email protected]>
49
#
50
# Distributed under the terms of the GNU General Public License (GPL)
51
#
52
# The full text of the GPL is available at:
53
#
54
# http://www.gnu.org/licenses/
55
##############################################################################
56
57
58
from sage.schemes.generic.morphism import SchemeMorphism_polynomial
59
60
from sage.categories.morphism import Morphism
61
from constructor import EllipticCurve
62
from sage.categories.homset import Hom
63
64
65
class WeierstrassTransformation(SchemeMorphism_polynomial):
66
67
def __init__(self, domain, codomain, defining_polynomials, post_multiplication):
68
r"""
69
A morphism of a a genus-one curve to/from the Weierstrass form.
70
71
INPUT:
72
73
- ``domain``, ``codomain`` -- two schemes, one of which is an
74
elliptic curve.
75
76
- ``defining_polynomials`` -- triplet of polynomials that
77
define the transformation.
78
79
- ``post_multiplication`` -- a polynomial to homogeneously
80
rescale after substituting the defining polynomials.
81
82
EXAMPLES::
83
84
sage: P2.<u,v,w> = ProjectiveSpace(2,QQ)
85
sage: C = P2.subscheme(u^3 + v^3 + w^3)
86
sage: E = EllipticCurve([2, -1, -1/3, 1/3, -1/27])
87
sage: from sage.schemes.elliptic_curves.weierstrass_transform import WeierstrassTransformation
88
sage: f = WeierstrassTransformation(C, E, [w, -v-w, -3*u-3*v], 1); f
89
Scheme morphism:
90
From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:
91
u^3 + v^3 + w^3
92
To: Elliptic Curve defined by y^2 + 2*x*y - 1/3*y = x^3 - x^2 + 1/3*x - 1/27
93
over Rational Field
94
Defn: Defined on coordinates by sending (u : v : w) to
95
(w : -v - w : -3*u - 3*v)
96
97
sage: f([-1, 1, 0])
98
(0 : 1 : 0)
99
sage: f([-1, 0, 1])
100
(1/3 : -1/3 : 1)
101
sage: f([ 0,-1, 1])
102
(1/3 : 0 : 1)
103
104
sage: A2.<a,b> = AffineSpace(2,QQ)
105
sage: C = A2.subscheme(a^3 + b^3 + 1)
106
sage: f = WeierstrassTransformation(C, E, [1, -b-1, -3*a-3*b], 1); f
107
Scheme morphism:
108
From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
109
a^3 + b^3 + 1
110
To: Elliptic Curve defined by y^2 + 2*x*y - 1/3*y
111
= x^3 - x^2 + 1/3*x - 1/27 over Rational Field
112
Defn: Defined on coordinates by sending (a, b) to
113
(1 : -b - 1 : -3*a - 3*b)
114
sage: f([-1,0])
115
(1/3 : -1/3 : 1)
116
sage: f([0,-1])
117
(1/3 : 0 : 1)
118
"""
119
Hom = domain.Hom(codomain)
120
super(WeierstrassTransformation, self).__init__(Hom, defining_polynomials)
121
self._post = post_multiplication
122
123
def post_rescaling(self):
124
"""
125
Return the homogeneous rescaling to apply after the coordinate
126
substitution.
127
128
OUTPUT:
129
130
A polyomial. See the example below.
131
132
EXAMPLES::
133
134
sage: R.<a,b,c> = QQ[]
135
sage: cubic = a^3+7*b^3+64*c^3
136
sage: P = [2,2,-1]
137
sage: f = EllipticCurve_from_cubic(cubic, P, morphism=True).inverse()
138
sage: f.post_rescaling()
139
1/60480/(180*x^2*z)
140
141
So here is what it does. If we just plug in the coordinate
142
transformation, we get the defining polynomial up to
143
scale. This method returns the overall rescaling of the
144
equation to bring the result into the standard form::
145
146
sage: cubic(f.defining_polynomials())
147
-10886400*x^5*z - 256690425600*x^4*z^2 - 7859980800*x^3*y*z^2
148
+ 10886400*x^2*y^2*z^2 - 238085568000000*x^2*y*z^3
149
sage: cubic(f.defining_polynomials()) * f.post_rescaling()
150
-x^3 - 23579*x^2*z - 722*x*y*z + y^2*z - 21870000*y*z^2
151
"""
152
return self._post
153
154
155
def WeierstrassTransformationWithInverse(domain, codomain,
156
defining_polynomials, post_multiplication,
157
inv_defining_polynomials, inv_post_multiplication):
158
"""
159
Construct morphism of a a genus-one curve to/from the Weierstrass
160
form with its inverse.
161
162
EXAMPLES::
163
164
sage: R.<u,v,w> = QQ[]
165
sage: f = EllipticCurve_from_cubic(u^3 + v^3 + w^3, [1,-1,0], morphism=True); f
166
Scheme morphism:
167
From: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:
168
u^3 + v^3 + w^3
169
To: Elliptic Curve defined by y^2 + 2*x*y + 1/3*y
170
= x^3 - x^2 - 1/3*x - 1/27 over Rational Field
171
Defn: Defined on coordinates by sending (u : v : w) to
172
(-w : -v + w : 3*u + 3*v)
173
"""
174
fwd = WeierstrassTransformationWithInverse_class(
175
domain, codomain, defining_polynomials, post_multiplication)
176
inv = WeierstrassTransformationWithInverse_class(
177
codomain, domain, inv_defining_polynomials, inv_post_multiplication)
178
fwd._inverse = inv
179
inv._inverse = fwd
180
return fwd
181
182
183
class WeierstrassTransformationWithInverse_class(WeierstrassTransformation):
184
185
def inverse(self):
186
"""
187
Return the inverse.
188
189
OUTPUT:
190
191
A morphism in the opposite direction. This may be a rational
192
inverse or an analytic inverse.
193
194
EXAMPLES::
195
196
sage: R.<u,v,w> = QQ[]
197
sage: f = EllipticCurve_from_cubic(u^3 + v^3 + w^3, [1,-1,0], morphism=True)
198
sage: f.inverse()
199
Scheme morphism:
200
From: Elliptic Curve defined by y^2 + 2*x*y + 1/3*y
201
= x^3 - x^2 - 1/3*x - 1/27 over Rational Field
202
To: Closed subscheme of Projective Space of dimension 2 over Rational Field defined by:
203
u^3 + v^3 + w^3
204
Defn: Defined on coordinates by sending (x : y : z) to
205
(x + y + 1/3*z : -x - y : -x)
206
"""
207
return self._inverse
208
209
210
211