From 9262ae5923e1c14192b87314288902d50e08b104 Mon Sep 17 00:00:00 2001 From: Grayson Jorgenson Date: Sat, 4 Jun 2016 18:36:14 -0400 Subject: [PATCH] 20676: changes from review, and spacing fixes. --- src/sage/schemes/curves/affine_curve.py | 19 +++++++++++++---- src/sage/schemes/curves/projective_curve.py | 16 +++++++++++--- src/sage/schemes/generic/algebraic_scheme.py | 22 ++++++++++++++++---- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/sage/schemes/curves/affine_curve.py b/src/sage/schemes/curves/affine_curve.py index 3357b315569..b797fe181b5 100644 --- a/src/sage/schemes/curves/affine_curve.py +++ b/src/sage/schemes/curves/affine_curve.py @@ -91,14 +91,17 @@ def __init__(self, A, X): if d != 1: raise ValueError("defining equations (=%s) define a scheme of dimension %s != 1"%(X,d)) - def projective_closure(self, i=0): + def projective_closure(self, i=0, PP=None): r""" Return the projective closure of this affine curve. INPUT: - - ``i`` - (default: 0) the index of the affine coordinate chart of the projective space that the affine ambient space - of this curve embeds into. + - ``i`` -- (default: 0) the index of the affine coordinate chart of the projective space that the affine + ambient space of this curve embeds into. + + - ``PP`` -- (default: None) ambient projective space to compute the projective closure in. This is + constructed if it is not given. OUTPUT: @@ -127,9 +130,17 @@ def projective_closure(self, i=0): sage: C.projective_closure(1) Projective Plane Curve over Complex Field with 53 bits of precision defined by x0^3 - x0*x1^2 + x1^3 - x1^2*x2 + + :: + + sage: A. = AffineSpace(QQ, 2) + sage: P. = ProjectiveSpace(QQ, 2) + sage: C = Curve([y - x^2], A) + sage: C.projective_closure(1, P).ambient_space() == P + True """ from constructor import Curve - return Curve(AlgebraicScheme_subscheme_affine.projective_closure(self, i)) + return Curve(AlgebraicScheme_subscheme_affine.projective_closure(self, i, PP)) class AffinePlaneCurve(AffineCurve): def __init__(self, A, f): diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index 05c3e1e6bf4..2d64ba6fbe5 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -87,15 +87,17 @@ def __init__(self, A, X): if d != 1: raise ValueError("defining equations (=%s) define a scheme of dimension %s != 1"%(X,d)) - def affine_patch(self, i): + def affine_patch(self, i, AA=None): r""" Return the i-th affine patch of this projective curve. INPUT: - - ``i`` - affine coordinate chart of the projective ambient space of this curve to compute affine patch + - ``i`` -- affine coordinate chart of the projective ambient space of this curve to compute affine patch with respect to. + - ``AA`` -- (default: None) ambient affine space, this is constructed if it is not given. + OUTPUT: - a curve in affine space. @@ -114,9 +116,17 @@ def affine_patch(self, i): sage: C = Curve(x^3 - x^2*y + y^3 - x^2*z, P) sage: C.affine_patch(1) Affine Plane Curve over Rational Field defined by x0^3 - x0^2*x1 - x0^2 + 1 + + :: + + sage: A. = AffineSpace(QQ, 2) + sage: P. = ProjectiveSpace(QQ, 2) + sage: C = Curve([u^2 - v^2], P) + sage: C.affine_patch(1, A).ambient_space() == A + True """ from constructor import Curve - return Curve(AlgebraicScheme_subscheme_projective.affine_patch(self, i)) + return Curve(AlgebraicScheme_subscheme_projective.affine_patch(self, i, AA)) class ProjectivePlaneCurve(ProjectiveCurve): def __init__(self, A, f): diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index cbb99b5d2b9..d22bd8ecc91 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -1825,6 +1825,9 @@ def projective_embedding(self, i=None, PP=None): Returns a morphism from this affine scheme into an ambient projective space of the same dimension. + The codomain of this morphism is the projective closure of this affine scheme in ``PP``, + if given, or otherwise in a new projective space that is constructed. + INPUT: - ``i`` -- integer (default: dimension of self = last @@ -1912,8 +1915,8 @@ def projective_embedding(self, i=None, PP=None): # Groebner basis w.r.t. a graded monomial order computed here to ensure # after homogenization, the basis elements will generate the defining # ideal of the projective closure of this affine subscheme - R = AA.coordinate_ring().change_ring(order='degrevlex') - G = R.ideal([R(f) for f in self.defining_polynomials()]).groebner_basis() + R = AA.coordinate_ring() + G = self.defining_ideal().groebner_basis() v = list(PP.gens()) z = v.pop(i) phi = R.hom(v,PR) @@ -1925,7 +1928,7 @@ def projective_embedding(self, i=None, PP=None): self.__projective_embedding[i] = phi return phi - def projective_closure(self,i=None): + def projective_closure(self, i=None, PP=None): r""" Return the projective closure of this affine subscheme. @@ -1935,6 +1938,9 @@ def projective_closure(self,i=None): closure of this affine subscheme. The embedding used is the one which has a 1 in the i-th coordinate, numbered from 0. + - ``PP`` -- (default: None) ambient projective space, i.e., ambient space + of codomain of morphism; this is constructed if it is not given. + OUTPUT: - a projective subscheme. @@ -1952,8 +1958,16 @@ def projective_closure(self,i=None): x0*x2 - x3*x4, x1*x2 - x0*x3, x2^2 - x1*x3 + + :: + + sage: A. = AffineSpace(QQ, 3) + sage: P. = ProjectiveSpace(QQ, 3) + sage: X = A.subscheme([z - x^2 - y^2]) + sage: X.projective_closure(1, P).ambient_space() == P + True """ - return self.projective_embedding(i).codomain() + return self.projective_embedding(i, PP).codomain() def is_smooth(self, point=None): r"""