Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/schemes/generic/notes/divisor_stein-joyner.txt
4128 views
1
"""nodoctest
2
Divisors
3
4
AUTHORS:
5
-- William Stein
6
-- David Kohel
7
-- David Joyner
8
9
EXAMPLES:
10
sage: x,y,z = ProjectiveSpace(2, GF(5), names='xyz').gens()
11
sage: C = Curve(y^2*z^7 - x^9 - x*z^8)
12
sage: pts = C.rational_points(); pts
13
[(0 : 0 : 1), (0 : 1 : 0), (2 : 2 : 1), (2 : 3 : 1), (3 : 1 : 1), (3 : 4 : 1)]
14
sage: D = C.divisor(pts[0])*3 - C.divisor(pts[1]) + C.divisor(pts[5])*10; D
15
3*(0 : 0 : 1) - (0 : 1 : 0) + 10*(3 : 4 : 1)
16
sage: D[1][0]
17
-1
18
sage: D[1][1]
19
(0 : 1 : 0)
20
sage: C.divisor([(3, pts[0]), (-1, pts[1]), (10,pts[5])])
21
3*(0 : 0 : 1) - (0 : 1 : 0) + 10*(3 : 4 : 1)
22
"""
23
24
#*******************************************************************************
25
# Copyright (C) 2005 David Kohel <[email protected]>
26
# Copyright (C) 2005 William Stein
27
#
28
# Distributed under the terms of the GNU General Public License (GPL)
29
#
30
# The full text of the GPL is available at:
31
#
32
# http://www.gnu.org/licenses/
33
#*******************************************************************************
34
35
36
from sage.structure.all import FormalSum
37
38
from sage.groups.group import AbelianGroup
39
40
from sage.rings.all import Z
41
42
class Divisor_generic(FormalSum):
43
def scheme(self):
44
"""
45
Return the scheme that this divisor is on.
46
47
EXAMPLES:
48
sage: x,y = AffineSpace(2, GF(5), names='xyz').gens()
49
sage: C = Curve(y^2 - x^9 - x)
50
sage: pts = C.rational_points(); pts
51
[(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)]
52
sage: D = C.divisor(pts[0])*3 - C.divisor(pts[1]); D
53
3*(0, 0) - (2, 2)
54
sage: D.scheme()
55
Closed subscheme of Affine Space of dimension 2 over
56
Finite Field of size 5 defined by:
57
xyz_1^2 + 4*xyz_0 + 4*xyz_0^9
58
"""
59
return self.parent().scheme()
60
61
class Divisor_curve_points(Divisor_generic):
62
r"""
63
For any curve $C$, use \code{C.divisor(v)} to construct a divisor
64
on $C$. Here $v$ can be either
65
\begin{itemize}
66
\item a rational point on $C$
67
\item a list of rational points
68
\item a list of 2-tuples $(c,P)$, where $c$ is
69
an integer and $P$ is a rational point.
70
\end{itemize}
71
72
TODO: Divisors shouldn't be restricted to rational points. The
73
problem is that the divisor group is the formal sum of the group
74
of points on the curve, and there's no implemented notion of point
75
on $E/K$ that has coordinates in $L$. This is what should
76
be implemented, by adding an appropriate class to
77
\code{schemes/generic/morphism.py}.
78
79
EXAMPLES:
80
sage: E = EllipticCurve([0, 0, 1, -1, 0])
81
sage: P = E(0,0)
82
sage: 10*P
83
(161/16 : -2065/64 : 1)
84
sage: D = E.divisor(P)
85
sage: D
86
(0 : 0 : 1)
87
sage: 10*D
88
10*(0 : 0 : 1)
89
sage: E.divisor([P, P])
90
2*(0 : 0 : 1)
91
sage: E.divisor([(3,P), (-4,5*P)])
92
3*(0 : 0 : 1) - 4*(1/4 : -5/8 : 1)
93
"""
94
def __init__(self, v, check=True, reduce=True):
95
"""
96
INPUT:
97
v -- a list of pairs (c, P), where c is an integer
98
and P is a point on a curve. The P's must
99
all lie on the same curve.
100
101
To create the 0 divisor use [(0, P)], so as to give
102
the curve.
103
"""
104
if not isinstance(v, (list, tuple)):
105
v = [(1,v)]
106
107
if len(v) < 1:
108
raise ValueError, "v (=%s) must have length at least 1"%v
109
110
if not (isinstance(v[0], tuple) and len(v[0]) == 2):
111
C = v[0].scheme()
112
else:
113
C = v[0][1].scheme()
114
if check:
115
w = []
116
for t in v:
117
if isinstance(t, tuple) and len(t) == 2:
118
w.append((Z(t[0]), C(t[1])))
119
else:
120
w.append((Z(1), C(t)))
121
v = w
122
123
Divisor_generic.__init__(self, v, check=False, reduce=True,
124
parent = DivisorGroup(C))
125
126
127
128
class DivisorGroup(AbelianGroup):
129
def __init__(self, scheme):
130
self.__scheme = scheme
131
132
def _repr_(self):
133
return "Group of Divisors on %s"%self.__scheme
134
135
def __cmp__(self, right):
136
if not isinstance(right, DivisorGroup):
137
return -1
138
return cmp(self.__scheme, right.__scheme)
139
140
def scheme(self):
141
return self.__scheme
142
143
class DivisorGroup_curve_points(DivisorGroup):
144
def __call__(self, v):
145
return Divisor_curve_points(v)
146
147
148