From b3002ef28b0b1f9ae39b1222c446625037420db9 Mon Sep 17 00:00:00 2001 From: Grayson Jorgenson Date: Wed, 25 May 2016 17:17:18 -0400 Subject: [PATCH 1/6] 20676: First pass at implementation. --- src/sage/schemes/plane_curves/affine_curve.py | 39 +++++++++++++++++++ .../schemes/plane_curves/projective_curve.py | 28 +++++++++++++ 2 files changed, 67 insertions(+) diff --git a/src/sage/schemes/plane_curves/affine_curve.py b/src/sage/schemes/plane_curves/affine_curve.py index d080ac7db89..72fd6931467 100644 --- a/src/sage/schemes/plane_curves/affine_curve.py +++ b/src/sage/schemes/plane_curves/affine_curve.py @@ -20,6 +20,7 @@ # http://www.gnu.org/licenses/ #***************************************************************************** +from sage.categories.homset import Hom from sage.interfaces.all import singular from sage.misc.all import add @@ -29,8 +30,10 @@ from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.schemes.affine.affine_space import is_AffineSpace + from sage.schemes.generic.algebraic_scheme import AlgebraicScheme_subscheme_affine +from sage.schemes.projective.projective_space import ProjectiveSpace from curve import Curve_generic @@ -46,6 +49,42 @@ 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): + r""" + Return the projective closure of this affine curve. + + OUTPUT: + + - a curve in projective space. + + EXAMPLES:: + + sage: A. = AffineSpace(CC,3) + sage: C = Curve([x-y,z-2]) + sage: C.projective_closure() + Projective Space Curve over Complex Field with 53 bits of precision defined by + x0 - x1, x2 + (-2.00000000000000)*x3 + + :: + + sage: A. = AffineSpace(QQ,3) + sage: C = Curve([y-x^2,z-x^3]) + sage: C.projective_closure() + Projective Space Curve over Rational Field defined by x0^2 - x1*x3, + x0*x1 - x2*x3, x1^2 - x0*x2 + """ + I = self.defining_ideal() + # compute a Groebner basis of this ideal with respect to a graded monomial order + R = self.ambient_space().coordinate_ring().change_ring(order='degrevlex') + n = self.ambient_space().dimension_relative() + P = ProjectiveSpace(self.ambient_space().base_ring(),n) + RH = P.coordinate_ring() + G = R.ideal([R(f) for f in I.gens()]).groebner_basis() + H = Hom(R,RH) + phi = H([RH.gens()[i] for i in range(0,n)]) + from constructor import Curve + return Curve([phi(f).homogenize(RH.gens()[n]) for f in G]) + class AffineCurve_generic(Curve_generic): def __init__(self, A, f): P = f.parent() diff --git a/src/sage/schemes/plane_curves/projective_curve.py b/src/sage/schemes/plane_curves/projective_curve.py index f29625978cc..ea0fd3530ff 100644 --- a/src/sage/schemes/plane_curves/projective_curve.py +++ b/src/sage/schemes/plane_curves/projective_curve.py @@ -22,9 +22,11 @@ # http://www.gnu.org/licenses/ #***************************************************************************** +from sage.categories.homset import Hom from sage.interfaces.all import singular from sage.misc.all import add, sage_eval from sage.rings.all import degree_lowest_rational_function +from sage.schemes.affine.affine_space import AffineSpace from sage.schemes.projective.projective_space import is_ProjectiveSpace @@ -42,6 +44,32 @@ 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): + r""" + Return the `i`th affine patch of this projective curve. + + OUTPUT: + + - a curve in affine space. + + EXAMPLES:: + + sage: P. = ProjectiveSpace(CC,3) + sage: C = Curve([y*z - x^2,w^2 - x*y]) + sage: C.affine_patch(0) + Affine Space Curve over Complex Field with 53 bits of precision defined by + x0*x1 - 1.00000000000000, x2^2 - x0 + """ + I = self.defining_ideal() + n = self.ambient_space().dimension_relative() + A = AffineSpace(self.ambient_space().base_ring(),n) + H = Hom(self.ambient_space().coordinate_ring(),A.coordinate_ring()) + l = list(A.coordinate_ring().gens()) + l.insert(i,1) + phi = H(l) + from constructor import Curve + return Curve([phi(f) for f in I.gens()]) + class ProjectiveCurve_generic(Curve_generic_projective): def __init__(self, A, f): if not (is_ProjectiveSpace(A) and A.dimension != 2): From 39dd215adb96f07bc67854c5debd1f1b49c08032 Mon Sep 17 00:00:00 2001 From: Grayson Jorgenson Date: Thu, 26 May 2016 03:51:31 -0400 Subject: [PATCH 2/6] 20676: Attempt to keep track of ambient spaces. --- src/sage/schemes/plane_curves/affine_curve.py | 22 ++++++++++++------- .../schemes/plane_curves/projective_curve.py | 14 +++++++----- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/sage/schemes/plane_curves/affine_curve.py b/src/sage/schemes/plane_curves/affine_curve.py index 72fd6931467..23c58a71e83 100644 --- a/src/sage/schemes/plane_curves/affine_curve.py +++ b/src/sage/schemes/plane_curves/affine_curve.py @@ -49,10 +49,15 @@ 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): + def projective_closure(self, i=0): r""" Return the projective closure of this affine curve. + INPUT: + + - ``i`` - the index of the affine coordinate chart of the projective space that the affine ambient space + of this curve embeds into. + OUTPUT: - a curve in projective space. @@ -63,27 +68,28 @@ def projective_closure(self): sage: C = Curve([x-y,z-2]) sage: C.projective_closure() Projective Space Curve over Complex Field with 53 bits of precision defined by - x0 - x1, x2 + (-2.00000000000000)*x3 + x1 - x2, (-2.00000000000000)*x0 + x3 :: sage: A. = AffineSpace(QQ,3) sage: C = Curve([y-x^2,z-x^3]) sage: C.projective_closure() - Projective Space Curve over Rational Field defined by x0^2 - x1*x3, - x0*x1 - x2*x3, x1^2 - x0*x2 + Projective Space Curve over Rational Field defined by + x1^2 - x0*x2, x1*x2 - x0*x3, x2^2 - x1*x3 """ I = self.defining_ideal() # compute a Groebner basis of this ideal with respect to a graded monomial order R = self.ambient_space().coordinate_ring().change_ring(order='degrevlex') - n = self.ambient_space().dimension_relative() - P = ProjectiveSpace(self.ambient_space().base_ring(),n) + P = self.ambient_space().projective_embedding(i).codomain() RH = P.coordinate_ring() G = R.ideal([R(f) for f in I.gens()]).groebner_basis() H = Hom(R,RH) - phi = H([RH.gens()[i] for i in range(0,n)]) + l = list(RH.gens()) + x = l.pop(i) + phi = H(l) from constructor import Curve - return Curve([phi(f).homogenize(RH.gens()[n]) for f in G]) + return Curve([phi(f).homogenize(x) for f in G]) class AffineCurve_generic(Curve_generic): def __init__(self, A, f): diff --git a/src/sage/schemes/plane_curves/projective_curve.py b/src/sage/schemes/plane_curves/projective_curve.py index ea0fd3530ff..e1c8f7fdf50 100644 --- a/src/sage/schemes/plane_curves/projective_curve.py +++ b/src/sage/schemes/plane_curves/projective_curve.py @@ -44,10 +44,15 @@ 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): 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 + with respect to. + OUTPUT: - a curve in affine space. @@ -61,11 +66,10 @@ def affine_patch(self,i): x0*x1 - 1.00000000000000, x2^2 - x0 """ I = self.defining_ideal() - n = self.ambient_space().dimension_relative() - A = AffineSpace(self.ambient_space().base_ring(),n) - H = Hom(self.ambient_space().coordinate_ring(),A.coordinate_ring()) + A = self.ambient_space().affine_patch(i) + H = Hom(self.ambient_space().coordinate_ring(), A.coordinate_ring()) l = list(A.coordinate_ring().gens()) - l.insert(i,1) + l.insert(i, A.coordinate_ring()(1)) phi = H(l) from constructor import Curve return Curve([phi(f) for f in I.gens()]) From 02349fe0fe9b2db2c4d3c66e19cf2de5e6591636 Mon Sep 17 00:00:00 2001 From: Grayson Jorgenson Date: Sun, 29 May 2016 16:32:42 -0400 Subject: [PATCH 3/6] 20676: projective_embedding revision and projective_closure. Also the addition of the groebner basis computation in projective embedding seemed to rearrange some output. --- src/sage/schemes/affine/affine_morphism.py | 6 +- src/sage/schemes/generic/algebraic_scheme.py | 64 ++++++++++++++++++-- 2 files changed, 61 insertions(+), 9 deletions(-) diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py index a741faeea68..3889485a32e 100644 --- a/src/sage/schemes/affine/affine_morphism.py +++ b/src/sage/schemes/affine/affine_morphism.py @@ -431,9 +431,9 @@ def homogenize(self, n): sage: f.homogenize(2) Scheme endomorphism of Closed subscheme of Projective Space of dimension 2 over Integer Ring defined by: - -x1^2 + x0*x2 - Defn: Defined on coordinates by sending (x0 : x1 : x2) to - (9*x1^2 : 3*x1*x2 : x2^2) + x1^2 - x0*x2 + Defn: Defined on coordinates by sending (x0 : x1 : x2) to + (9*x1^2 : 3*x1*x2 : x2^2) :: diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index 34cee2d60f0..a3c90139d8e 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -91,9 +91,9 @@ -x1^2 + x0*x2 To: Closed subscheme of Projective Space of dimension 3 over Rational Field defined by: - -x1^2 + x0*x2, - -x1*x2 + x0*x3, - -x2^2 + x1*x3 + x1^2 - x0*x2, + x1*x2 - x0*x3, + x2^2 - x1*x3 Defn: Defined on coordinates by sending (x0, x1, x2) to (1 : x0 : x1 : x2) @@ -1863,6 +1863,25 @@ def projective_embedding(self, i=None, PP=None): u0^2 - u2*u3 Defn: Defined on coordinates by sending (x, y, z) to (x : 1 : y : z) + + :: + + sage: A. = AffineSpace(3,QQ) + sage: X = A.subscheme([y-x^2,z-x^3]) + sage: X.projective_embedding() + Scheme morphism: + From: Closed subscheme of Affine Space of dimension 3 over Rational + Field defined by: + -x^2 + y, + -x^3 + z + To: Closed subscheme of Projective Space of dimension 3 over + Rational Field defined by: + x0^2 - x1*x3, + x0*x1 - x2*x3, + x1^2 - x0*x2 + Defn: Defined on coordinates by sending (x, y, z) to + (x : y : z : 1) + """ AA = self.ambient_space() n = AA.dimension_relative() @@ -1890,19 +1909,52 @@ def projective_embedding(self, i=None, PP=None): elif PP.dimension_relative() != n: raise ValueError("Projective Space must be of dimension %s"%(n)) PR = PP.coordinate_ring() + # 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() v = list(PP.gens()) z = v.pop(i) - R = AA.coordinate_ring() phi = R.hom(v,PR) v.append(z) - polys = self.defining_polynomials() - X = PP.subscheme([phi(f).homogenize(i) for f in polys ]) + X = PP.subscheme([phi(f).homogenize(i) for f in G]) v = list(R.gens()) v.insert(i, R(1)) phi = self.hom(v, X) self.__projective_embedding[i] = phi return phi + def projective_closure(self,i=None): + r""" + Return the projective closure of this affine subscheme. + + INPUT: + + - ``i`` -- (default: None) determines the embedding to use to compute the projective + closure of this affine subscheme. The embedding used is the one which has a 1 in the + i-th coordinate, numbered from 0. + + OUTPUT: + + - a projective subscheme. + + EXAMPLES:: + + sage: A. = AffineSpace(QQ,4) + sage: X = A.subscheme([x^2 - y, x*y - z, y^2 - w, x*z - w, y*z - x*w, z^2 - y*w]) + sage: X.projective_closure() + Closed subscheme of Projective Space of dimension 4 over Rational Field + defined by: + x0^2 - x1*x4, + x0*x1 - x2*x4, + x1^2 - x3*x4, + x0*x2 - x3*x4, + x1*x2 - x0*x3, + x2^2 - x1*x3 + """ + return self.projective_embedding(i).codomain() + def is_smooth(self, point=None): r""" Test whether the algebraic subscheme is smooth. From c6fe8401f1ddf7d53f6af060e5db2d9766f05ed3 Mon Sep 17 00:00:00 2001 From: Grayson Jorgenson Date: Sun, 29 May 2016 19:59:23 -0400 Subject: [PATCH 4/6] 20676: implemented curve-level functions. - curve-level functions to use affine patch, projective_embedding for projective/affine subschemes, respectively - small spacing fix in projective_embedding example --- src/sage/schemes/generic/algebraic_scheme.py | 4 +-- src/sage/schemes/plane_curves/affine_curve.py | 36 +++++++++---------- .../schemes/plane_curves/projective_curve.py | 23 ++++++------ 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/sage/schemes/generic/algebraic_scheme.py b/src/sage/schemes/generic/algebraic_scheme.py index a3c90139d8e..d2d91653678 100644 --- a/src/sage/schemes/generic/algebraic_scheme.py +++ b/src/sage/schemes/generic/algebraic_scheme.py @@ -1866,8 +1866,8 @@ def projective_embedding(self, i=None, PP=None): :: - sage: A. = AffineSpace(3,QQ) - sage: X = A.subscheme([y-x^2,z-x^3]) + sage: A. = AffineSpace(QQ, 3) + sage: X = A.subscheme([y - x^2, z - x^3]) sage: X.projective_embedding() Scheme morphism: From: Closed subscheme of Affine Space of dimension 3 over Rational diff --git a/src/sage/schemes/plane_curves/affine_curve.py b/src/sage/schemes/plane_curves/affine_curve.py index 64e89a96663..b92a6cc93e2 100644 --- a/src/sage/schemes/plane_curves/affine_curve.py +++ b/src/sage/schemes/plane_curves/affine_curve.py @@ -55,8 +55,8 @@ def projective_closure(self, i=0): INPUT: - - ``i`` - 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. OUTPUT: @@ -64,32 +64,30 @@ def projective_closure(self, i=0): EXAMPLES:: - sage: A. = AffineSpace(CC,3) - sage: C = Curve([x-y,z-2]) + sage: A. = AffineSpace(QQ, 3) + sage: C = Curve([y-x^2,z-x^3], A) sage: C.projective_closure() - Projective Space Curve over Complex Field with 53 bits of precision defined by - x1 - x2, (-2.00000000000000)*x0 + x3 + Projective Space Curve over Rational Field defined by x1^2 - x0*x2, + x1*x2 - x0*x3, x2^2 - x1*x3 :: - sage: A. = AffineSpace(QQ,3) - sage: C = Curve([y-x^2,z-x^3]) + sage: A. = AffineSpace(QQ, 3) + sage: C = Curve([y - x^2, z - x^3], A) sage: C.projective_closure() Projective Space Curve over Rational Field defined by x1^2 - x0*x2, x1*x2 - x0*x3, x2^2 - x1*x3 + + :: + + sage: A. = AffineSpace(CC, 2) + sage: C = Curve(y - x^3 + x - 1, A) + sage: C.projective_closure(1) + Projective Curve over Complex Field with 53 bits of precision defined by + x0^3 - x0*x1^2 + x1^3 - x1^2*x2 """ - I = self.defining_ideal() - # compute a Groebner basis of this ideal with respect to a graded monomial order - R = self.ambient_space().coordinate_ring().change_ring(order='degrevlex') - P = self.ambient_space().projective_embedding(i).codomain() - RH = P.coordinate_ring() - G = R.ideal([R(f) for f in I.gens()]).groebner_basis() - H = Hom(R,RH) - l = list(RH.gens()) - x = l.pop(i) - phi = H(l) from constructor import Curve - return Curve([phi(f).homogenize(x) for f in G]) + return Curve(AlgebraicScheme_subscheme_affine.projective_closure(self, i)) class AffineCurve_generic(AffineSpaceCurve_generic): def __init__(self, A, f): diff --git a/src/sage/schemes/plane_curves/projective_curve.py b/src/sage/schemes/plane_curves/projective_curve.py index 0f763f0fcae..d40126071aa 100644 --- a/src/sage/schemes/plane_curves/projective_curve.py +++ b/src/sage/schemes/plane_curves/projective_curve.py @@ -47,12 +47,12 @@ def __init__(self, A, X): def affine_patch(self, i): r""" - Return the `i`th affine patch of this projective curve. + 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 - with respect to. + with respect to. OUTPUT: @@ -60,20 +60,21 @@ def affine_patch(self, i): EXAMPLES:: - sage: P. = ProjectiveSpace(CC,3) - sage: C = Curve([y*z - x^2,w^2 - x*y]) + sage: P. = ProjectiveSpace(CC, 3) + sage: C = Curve([y*z - x^2, w^2 - x*y], P) sage: C.affine_patch(0) Affine Space Curve over Complex Field with 53 bits of precision defined by x0*x1 - 1.00000000000000, x2^2 - x0 + + :: + + sage: P. = ProjectiveSpace(QQ, 2) + sage: C = Curve(x^3 - x^2*y + y^3 - x^2*z, P) + sage: C.affine_patch(1) + Affine Curve over Rational Field defined by x0^3 - x0^2*x1 - x0^2 + 1 """ - I = self.defining_ideal() - A = self.ambient_space().affine_patch(i) - H = Hom(self.ambient_space().coordinate_ring(), A.coordinate_ring()) - l = list(A.coordinate_ring().gens()) - l.insert(i, A.coordinate_ring()(1)) - phi = H(l) from constructor import Curve - return Curve([phi(f) for f in I.gens()]) + return Curve(AlgebraicScheme_subscheme_projective.affine_patch(self, i)) class ProjectiveCurve_generic(ProjectiveSpaceCurve_generic): def __init__(self, A, f): From 0039d7b13dad64025ef70542f407bf3af7423e1a Mon Sep 17 00:00:00 2001 From: Grayson Jorgenson Date: Thu, 2 Jun 2016 16:33:55 -0400 Subject: [PATCH 5/6] 20676: Update example strings to match changes from 20697. --- src/sage/schemes/curves/affine_curve.py | 6 +++--- src/sage/schemes/curves/projective_curve.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sage/schemes/curves/affine_curve.py b/src/sage/schemes/curves/affine_curve.py index 469f943848e..3357b315569 100644 --- a/src/sage/schemes/curves/affine_curve.py +++ b/src/sage/schemes/curves/affine_curve.py @@ -109,7 +109,7 @@ def projective_closure(self, i=0): sage: A. = AffineSpace(QQ, 3) sage: C = Curve([y-x^2,z-x^3], A) sage: C.projective_closure() - Projective Space Curve over Rational Field defined by x1^2 - x0*x2, + Projective Curve over Rational Field defined by x1^2 - x0*x2, x1*x2 - x0*x3, x2^2 - x1*x3 :: @@ -117,7 +117,7 @@ def projective_closure(self, i=0): sage: A. = AffineSpace(QQ, 3) sage: C = Curve([y - x^2, z - x^3], A) sage: C.projective_closure() - Projective Space Curve over Rational Field defined by + Projective Curve over Rational Field defined by x1^2 - x0*x2, x1*x2 - x0*x3, x2^2 - x1*x3 :: @@ -125,7 +125,7 @@ def projective_closure(self, i=0): sage: A. = AffineSpace(CC, 2) sage: C = Curve(y - x^3 + x - 1, A) sage: C.projective_closure(1) - Projective Curve over Complex Field with 53 bits of precision defined by + Projective Plane Curve over Complex Field with 53 bits of precision defined by x0^3 - x0*x1^2 + x1^3 - x1^2*x2 """ from constructor import Curve diff --git a/src/sage/schemes/curves/projective_curve.py b/src/sage/schemes/curves/projective_curve.py index a7eb8c4f11f..05c3e1e6bf4 100644 --- a/src/sage/schemes/curves/projective_curve.py +++ b/src/sage/schemes/curves/projective_curve.py @@ -105,7 +105,7 @@ def affine_patch(self, i): sage: P. = ProjectiveSpace(CC, 3) sage: C = Curve([y*z - x^2, w^2 - x*y], P) sage: C.affine_patch(0) - Affine Space Curve over Complex Field with 53 bits of precision defined by + Affine Curve over Complex Field with 53 bits of precision defined by x0*x1 - 1.00000000000000, x2^2 - x0 :: @@ -113,7 +113,7 @@ def affine_patch(self, i): sage: P. = ProjectiveSpace(QQ, 2) sage: C = Curve(x^3 - x^2*y + y^3 - x^2*z, P) sage: C.affine_patch(1) - Affine Curve over Rational Field defined by x0^3 - x0^2*x1 - x0^2 + 1 + Affine Plane Curve over Rational Field defined by x0^3 - x0^2*x1 - x0^2 + 1 """ from constructor import Curve return Curve(AlgebraicScheme_subscheme_projective.affine_patch(self, i)) From 9262ae5923e1c14192b87314288902d50e08b104 Mon Sep 17 00:00:00 2001 From: Grayson Jorgenson Date: Sat, 4 Jun 2016 18:36:14 -0400 Subject: [PATCH 6/6] 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"""