Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
20676: First pass at implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Grayson Jorgenson committed May 25, 2016
1 parent abc779b commit b3002ef
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/sage/schemes/plane_curves/affine_curve.py
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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.<x,y,z> = 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.<x,y,z> = 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()
Expand Down
28 changes: 28 additions & 0 deletions src/sage/schemes/plane_curves/projective_curve.py
Expand Up @@ -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

Expand All @@ -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.<x,y,z,w> = 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):
Expand Down

0 comments on commit b3002ef

Please sign in to comment.