Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/schemes/jacobians/abstract_jacobian.py
8821 views
1
"""
2
Base class for Jacobians of curves
3
"""
4
5
#*******************************************************************************
6
# Copyright (C) 2005 William Stein
7
# Distributed under the terms of the GNU General Public License (GPL)
8
# http://www.gnu.org/licenses/
9
#*******************************************************************************
10
11
from sage.categories.fields import Fields
12
_Fields = Fields()
13
from sage.schemes.generic.scheme import Scheme, is_Scheme
14
15
def is_Jacobian(J):
16
"""
17
Return True if `J` is of type Jacobian_generic.
18
19
EXAMPLES::
20
21
sage: from sage.schemes.jacobians.abstract_jacobian import Jacobian, is_Jacobian
22
sage: P2.<x, y, z> = ProjectiveSpace(QQ, 2)
23
sage: C = Curve(x^3 + y^3 + z^3)
24
sage: J = Jacobian(C)
25
sage: is_Jacobian(J)
26
True
27
28
::
29
30
sage: E = EllipticCurve('37a1')
31
sage: is_Jacobian(E)
32
False
33
"""
34
return isinstance(J, Jacobian_generic)
35
36
def Jacobian(C):
37
"""
38
EXAMPLES::
39
40
sage: from sage.schemes.jacobians.abstract_jacobian import Jacobian
41
sage: P2.<x, y, z> = ProjectiveSpace(QQ, 2)
42
sage: C = Curve(x^3 + y^3 + z^3)
43
sage: Jacobian(C)
44
Jacobian of Projective Curve over Rational Field defined by x^3 + y^3 + z^3
45
"""
46
try:
47
return C.jacobian()
48
except AttributeError:
49
return Jacobian_generic(C)
50
51
class Jacobian_generic(Scheme):
52
"""
53
Base class for Jacobians of projective curves.
54
55
The input must be a projective curve over a field.
56
57
EXAMPLES::
58
59
sage: from sage.schemes.jacobians.abstract_jacobian import Jacobian
60
sage: P2.<x, y, z> = ProjectiveSpace(QQ, 2)
61
sage: C = Curve(x^3 + y^3 + z^3)
62
sage: J = Jacobian(C); J
63
Jacobian of Projective Curve over Rational Field defined by x^3 + y^3 + z^3
64
"""
65
def __init__(self, C):
66
"""
67
TESTS::
68
69
sage: from sage.schemes.jacobians.abstract_jacobian import Jacobian_generic
70
sage: P2.<x, y, z> = ProjectiveSpace(QQ, 2)
71
sage: C = Curve(x^3 + y^3 + z^3)
72
sage: J = Jacobian_generic(C); J
73
Jacobian of Projective Curve over Rational Field defined by x^3 + y^3 + z^3
74
sage: type(J)
75
<class 'sage.schemes.jacobians.abstract_jacobian.Jacobian_generic_with_category'>
76
77
Note: this is an abstract parent, so we skip element tests::
78
79
sage: TestSuite(J).run(skip =["_test_an_element",\
80
"_test_elements",\
81
"_test_elements_eq_reflexive",\
82
"_test_elements_eq_symmetric",\
83
"_test_elements_eq_transitive",\
84
"_test_elements_neq",\
85
"_test_some_elements"])
86
87
::
88
89
sage: Jacobian_generic(ZZ)
90
Traceback (most recent call last):
91
...
92
TypeError: Argument (=Integer Ring) must be a scheme.
93
sage: Jacobian_generic(P2)
94
Traceback (most recent call last):
95
...
96
ValueError: C (=Projective Space of dimension 2 over Rational Field) must have dimension 1.
97
sage: P2.<x, y, z> = ProjectiveSpace(Zmod(6), 2)
98
sage: C = Curve(x + y + z)
99
sage: Jacobian_generic(C)
100
Traceback (most recent call last):
101
...
102
TypeError: C (=Projective Curve over Ring of integers modulo 6 defined by x + y + z) must be defined over a field.
103
"""
104
if not is_Scheme(C):
105
raise TypeError, "Argument (=%s) must be a scheme."%C
106
if C.base_ring() not in _Fields:
107
raise TypeError, "C (=%s) must be defined over a field."%C
108
if C.dimension() != 1:
109
raise ValueError, "C (=%s) must have dimension 1."%C
110
self.__curve = C
111
Scheme.__init__(self, C.base_scheme())
112
113
def __cmp__(self, J):
114
"""
115
Compare the Jacobian self to `J`. If `J` is a Jacobian, then
116
self and `J` are equal if and only if their curves are equal.
117
118
EXAMPLES::
119
120
sage: from sage.schemes.jacobians.abstract_jacobian import Jacobian
121
sage: P2.<x, y, z> = ProjectiveSpace(QQ, 2)
122
sage: J1 = Jacobian(Curve(x^3 + y^3 + z^3))
123
sage: J1 == J1
124
True
125
sage: J1 == P2
126
False
127
sage: J1 != P2
128
True
129
sage: J2 = Jacobian(Curve(x + y + z))
130
sage: J1 == J2
131
False
132
sage: J1 != J2
133
True
134
"""
135
if not is_Jacobian(J):
136
return cmp(type(self), type(J))
137
return cmp(self.curve(), J.curve())
138
139
def _repr_(self):
140
"""
141
Return a string representation of this Jacobian.
142
143
EXAMPLES::
144
145
sage: from sage.schemes.jacobians.abstract_jacobian import Jacobian
146
sage: P2.<x, y, z> = ProjectiveSpace(QQ, 2)
147
sage: J = Jacobian(Curve(x^3 + y^3 + z^3)); J
148
Jacobian of Projective Curve over Rational Field defined by x^3 + y^3 + z^3
149
sage: J._repr_()
150
'Jacobian of Projective Curve over Rational Field defined by x^3 + y^3 + z^3'
151
"""
152
return "Jacobian of %s"%self.__curve
153
154
def _point(self):
155
"""
156
Return the Hom-set from some affine scheme to ``self``.
157
158
OUTPUT:
159
160
This method always raises a ``NotImplementedError``; it is
161
only abstract.
162
163
EXAMPLES::
164
165
sage: from sage.schemes.jacobians.abstract_jacobian import Jacobian
166
sage: P2.<x, y, z> = ProjectiveSpace(QQ, 2)
167
sage: J = Jacobian(Curve(x^3 + y^3 + z^3))
168
sage: J._point()
169
Traceback (most recent call last):
170
...
171
NotImplementedError
172
"""
173
raise NotImplementedError
174
175
def curve(self):
176
"""
177
Return the curve of which self is the Jacobian.
178
179
EXAMPLES::
180
181
sage: from sage.schemes.jacobians.abstract_jacobian import Jacobian
182
sage: P2.<x, y, z> = ProjectiveSpace(QQ, 2)
183
sage: J = Jacobian(Curve(x^3 + y^3 + z^3))
184
sage: J.curve()
185
Projective Curve over Rational Field defined by x^3 + y^3 + z^3
186
"""
187
return self.__curve
188
189
def change_ring(self, R):
190
r"""
191
Return the Jacobian over the ring `R`.
192
193
INPUT:
194
195
- ``R`` -- a field. The new base ring.
196
197
OUTPUT:
198
199
The Jacobian over the ring `R`.
200
201
EXAMPLES::
202
203
sage: R.<x> = QQ['x']
204
sage: H = HyperellipticCurve(x^3-10*x+9)
205
sage: Jac = H.jacobian(); Jac
206
Jacobian of Hyperelliptic Curve over Rational
207
Field defined by y^2 = x^3 - 10*x + 9
208
sage: Jac.change_ring(RDF)
209
Jacobian of Hyperelliptic Curve over Real Double
210
Field defined by y^2 = x^3 - 10.0*x + 9.0
211
"""
212
return self.curve().change_ring(R).jacobian()
213
214
def base_extend(self, R):
215
r"""
216
Return the natural extension of ``self`` over `R`
217
218
INPUT:
219
220
- ``R`` -- a field. The new base field.
221
222
OUTPUT:
223
224
The Jacobian over the ring `R`.
225
226
EXAMPLES::
227
228
sage: R.<x> = QQ['x']
229
sage: H = HyperellipticCurve(x^3-10*x+9)
230
sage: Jac = H.jacobian(); Jac
231
Jacobian of Hyperelliptic Curve over Rational Field defined by y^2 = x^3 - 10*x + 9
232
sage: F.<a> = QQ.extension(x^2+1)
233
sage: Jac.base_extend(F)
234
Jacobian of Hyperelliptic Curve over Number Field in a with defining
235
polynomial x^2 + 1 defined by y^2 = x^3 - 10*x + 9
236
"""
237
if R not in _Fields:
238
raise ValueError('Not a field: '+str(R))
239
if self.base_ring() is R:
240
return self
241
if not R.has_coerce_map_from(self.base_ring()):
242
raise ValueError('no natural map from the base ring (=%s) to R (=%s)!'
243
% (self.base_ring(), R))
244
return self.change_ring(R)
245
246