Path: blob/master/sage/schemes/generic/notes/divisor_stein-joyner.txt
4128 views
"""nodoctest1Divisors23AUTHORS:4-- William Stein5-- David Kohel6-- David Joyner78EXAMPLES:9sage: x,y,z = ProjectiveSpace(2, GF(5), names='xyz').gens()10sage: C = Curve(y^2*z^7 - x^9 - x*z^8)11sage: pts = C.rational_points(); pts12[(0 : 0 : 1), (0 : 1 : 0), (2 : 2 : 1), (2 : 3 : 1), (3 : 1 : 1), (3 : 4 : 1)]13sage: D = C.divisor(pts[0])*3 - C.divisor(pts[1]) + C.divisor(pts[5])*10; D143*(0 : 0 : 1) - (0 : 1 : 0) + 10*(3 : 4 : 1)15sage: D[1][0]16-117sage: D[1][1]18(0 : 1 : 0)19sage: C.divisor([(3, pts[0]), (-1, pts[1]), (10,pts[5])])203*(0 : 0 : 1) - (0 : 1 : 0) + 10*(3 : 4 : 1)21"""2223#*******************************************************************************24# Copyright (C) 2005 David Kohel <[email protected]>25# Copyright (C) 2005 William Stein26#27# Distributed under the terms of the GNU General Public License (GPL)28#29# The full text of the GPL is available at:30#31# http://www.gnu.org/licenses/32#*******************************************************************************333435from sage.structure.all import FormalSum3637from sage.groups.group import AbelianGroup3839from sage.rings.all import Z4041class Divisor_generic(FormalSum):42def scheme(self):43"""44Return the scheme that this divisor is on.4546EXAMPLES:47sage: x,y = AffineSpace(2, GF(5), names='xyz').gens()48sage: C = Curve(y^2 - x^9 - x)49sage: pts = C.rational_points(); pts50[(0, 0), (2, 2), (2, 3), (3, 1), (3, 4)]51sage: D = C.divisor(pts[0])*3 - C.divisor(pts[1]); D523*(0, 0) - (2, 2)53sage: D.scheme()54Closed subscheme of Affine Space of dimension 2 over55Finite Field of size 5 defined by:56xyz_1^2 + 4*xyz_0 + 4*xyz_0^957"""58return self.parent().scheme()5960class Divisor_curve_points(Divisor_generic):61r"""62For any curve $C$, use \code{C.divisor(v)} to construct a divisor63on $C$. Here $v$ can be either64\begin{itemize}65\item a rational point on $C$66\item a list of rational points67\item a list of 2-tuples $(c,P)$, where $c$ is68an integer and $P$ is a rational point.69\end{itemize}7071TODO: Divisors shouldn't be restricted to rational points. The72problem is that the divisor group is the formal sum of the group73of points on the curve, and there's no implemented notion of point74on $E/K$ that has coordinates in $L$. This is what should75be implemented, by adding an appropriate class to76\code{schemes/generic/morphism.py}.7778EXAMPLES:79sage: E = EllipticCurve([0, 0, 1, -1, 0])80sage: P = E(0,0)81sage: 10*P82(161/16 : -2065/64 : 1)83sage: D = E.divisor(P)84sage: D85(0 : 0 : 1)86sage: 10*D8710*(0 : 0 : 1)88sage: E.divisor([P, P])892*(0 : 0 : 1)90sage: E.divisor([(3,P), (-4,5*P)])913*(0 : 0 : 1) - 4*(1/4 : -5/8 : 1)92"""93def __init__(self, v, check=True, reduce=True):94"""95INPUT:96v -- a list of pairs (c, P), where c is an integer97and P is a point on a curve. The P's must98all lie on the same curve.99100To create the 0 divisor use [(0, P)], so as to give101the curve.102"""103if not isinstance(v, (list, tuple)):104v = [(1,v)]105106if len(v) < 1:107raise ValueError, "v (=%s) must have length at least 1"%v108109if not (isinstance(v[0], tuple) and len(v[0]) == 2):110C = v[0].scheme()111else:112C = v[0][1].scheme()113if check:114w = []115for t in v:116if isinstance(t, tuple) and len(t) == 2:117w.append((Z(t[0]), C(t[1])))118else:119w.append((Z(1), C(t)))120v = w121122Divisor_generic.__init__(self, v, check=False, reduce=True,123parent = DivisorGroup(C))124125126127class DivisorGroup(AbelianGroup):128def __init__(self, scheme):129self.__scheme = scheme130131def _repr_(self):132return "Group of Divisors on %s"%self.__scheme133134def __cmp__(self, right):135if not isinstance(right, DivisorGroup):136return -1137return cmp(self.__scheme, right.__scheme)138139def scheme(self):140return self.__scheme141142class DivisorGroup_curve_points(DivisorGroup):143def __call__(self, v):144return Divisor_curve_points(v)145146147148