Subschemes of affine space - Schemes

Skip to content
Back to top
View this page
Edit this page

# Subschemes of affine space

AUTHORS:

- David Kohel, William Stein (2005): initial version

- Ben Hutz (2013): affine subschemes

class sage.schemes.affine.affine_subscheme.AlgebraicScheme_subscheme_affine(A, polynomials, embedding_center=None, embedding_codomain=None, embedding_images=None)

  Bases: `AlgebraicScheme_subscheme`

  An algebraic subscheme of affine space.

  INPUT:

  - `A` – ambient affine space

  - `polynomials` – single polynomial, ideal or iterable of defining polynomials

  EXAMPLES:

  Sage

      sage: A3.<x, y, z> = AffineSpace(QQ, 3)
      sage: A3.subscheme([x^2 - y*z])
      Closed subscheme of Affine Space of dimension 3 over Rational Field defined by:
        x^2 - y*z

  Python

      >>> from sage.all import *
      >>> A3 = AffineSpace(QQ, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = A3._first_ngens(3)
      >>> A3.subscheme([x**Integer(2) - y*z])
      Closed subscheme of Affine Space of dimension 3 over Rational Field defined by:
        x^2 - y*z

  dimension()

    Return the dimension of the affine algebraic subscheme.

    EXAMPLES:

    Sage

        sage: # needs sage.libs.singular
        sage: A.<x,y> = AffineSpace(2, QQ)
        sage: A.subscheme([]).dimension()
        2
        sage: A.subscheme([x]).dimension()
        1
        sage: A.subscheme([x^5]).dimension()
        1
        sage: A.subscheme([x^2 + y^2 - 1]).dimension()
        1
        sage: A.subscheme([x*(x-1), y*(y-1)]).dimension()
        0

    Python

        >>> from sage.all import *
        >>> # needs sage.libs.singular
        >>> A = AffineSpace(Integer(2), QQ, names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> A.subscheme([]).dimension()
        2
        >>> A.subscheme([x]).dimension()
        1
        >>> A.subscheme([x**Integer(5)]).dimension()
        1
        >>> A.subscheme([x**Integer(2) + y**Integer(2) - Integer(1)]).dimension()
        1
        >>> A.subscheme([x*(x-Integer(1)), y*(y-Integer(1))]).dimension()
        0

    Something less obvious:

    Sage

        sage: A.<x,y,z,w> = AffineSpace(4, QQ)
        sage: X = A.subscheme([x^2, x^2*y^2 + z^2, z^2 - w^2, 10*x^2 + w^2 - z^2])
        sage: X
        Closed subscheme of Affine Space of dimension 4 over Rational Field defined by:
          x^2,
          x^2*y^2 + z^2,
          z^2 - w^2,
          10*x^2 - z^2 + w^2
        sage: X.dimension()                                                         # needs sage.libs.singular
        1

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(Integer(4), QQ, names=('x', 'y', 'z', 'w',)); (x, y, z, w,) = A._first_ngens(4)
        >>> X = A.subscheme([x**Integer(2), x**Integer(2)*y**Integer(2) + z**Integer(2), z**Integer(2) - w**Integer(2), Integer(10)*x**Integer(2) + w**Integer(2) - z**Integer(2)])
        >>> X
        Closed subscheme of Affine Space of dimension 4 over Rational Field defined by:
          x^2,
          x^2*y^2 + z^2,
          z^2 - w^2,
          10*x^2 - z^2 + w^2
        >>> X.dimension()                                                         # needs sage.libs.singular
        1

  intersection_multiplicity(X, P)

    Return the intersection multiplicity of this subscheme and the subscheme `X` at the point `P`.

    The intersection of this subscheme with `X` must be proper, that is \(\mathrm{codim}(self\cap X) = \mathrm{codim}(self) + \mathrm{codim}(X)\), and must also be finite. We use Serre’s Tor formula to compute the intersection multiplicity. If \(I\), \(J\) are the defining ideals of `self`, `X`, respectively, then this is \(\sum_{i=0}^{\infty}(-1)^i\mathrm{length}(\mathrm{Tor}_{\mathcal{O}_{A,p}}^{i} (\mathcal{O}_{A,p}/I,\mathcal{O}_{A,p}/J))\) where \(A\) is the affine ambient space of these subschemes.

    INPUT:

    - `X` – subscheme in the same ambient space as this subscheme

    - `P` – a point in the intersection of this subscheme with `X`

    OUTPUT: integer

    EXAMPLES:

    Sage

        sage: A.<x,y> = AffineSpace(QQ, 2)
        sage: C = Curve([y^2 - x^3 - x^2], A)                                       # needs sage.libs.singular
        sage: D = Curve([y^2 + x^3], A)                                             # needs sage.libs.singular
        sage: Q = A([0,0])
        sage: C.intersection_multiplicity(D, Q)                                     # needs sage.libs.singular
        4

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(2), names=('x', 'y',)); (x, y,) = A._first_ngens(2)
        >>> C = Curve([y**Integer(2) - x**Integer(3) - x**Integer(2)], A)                                       # needs sage.libs.singular
        >>> D = Curve([y**Integer(2) + x**Integer(3)], A)                                             # needs sage.libs.singular
        >>> Q = A([Integer(0),Integer(0)])
        >>> C.intersection_multiplicity(D, Q)                                     # needs sage.libs.singular
        4

    Sage

        sage: # needs sage.rings.number_field
        sage: R.<a> = QQ[]
        sage: K.<b> = NumberField(a^6 - 3*a^5 + 5*a^4 - 5*a^3 + 5*a^2 - 3*a + 1)
        sage: A.<x,y,z,w> = AffineSpace(K, 4)
        sage: X = A.subscheme([x*y, y*z + 7, w^3 - x^3])
        sage: Y = A.subscheme([x - z^3 + z + 1])
        sage: Q = A([0,
        ....:        -7*b^5 + 21*b^4 - 28*b^3 + 21*b^2 - 21*b + 14,
        ....:        -b^5 + 2*b^4 - 3*b^3 + 2*b^2 - 2*b,
        ....:        0])
        sage: X.intersection_multiplicity(Y, Q)                                     # needs sage.libs.singular
        3

    [Python]

        >>> from sage.all import *
        >>> # needs sage.rings.number_field
        >>> R = QQ['a']; (a,) = R._first_ngens(1)
        >>> K = NumberField(a**Integer(6) - Integer(3)*a**Integer(5) + Integer(5)*a**Integer(4) - Integer(5)*a**Integer(3) + Integer(5)*a**Integer(2) - Integer(3)*a + Integer(1), names=('b',)); (b,) = K._first_ngens(1)
        >>> A = AffineSpace(K, Integer(4), names=('x', 'y', 'z', 'w',)); (x, y, z, w,) = A._first_ngens(4)
        >>> X = A.subscheme([x*y, y*z + Integer(7), w**Integer(3) - x**Integer(3)])
        >>> Y = A.subscheme([x - z**Integer(3) + z + Integer(1)])
        >>> Q = A([Integer(0),
        ...        -Integer(7)*b**Integer(5) + Integer(21)*b**Integer(4) - Integer(28)*b**Integer(3) + Integer(21)*b**Integer(2) - Integer(21)*b + Integer(14),
        ...        -b**Integer(5) + Integer(2)*b**Integer(4) - Integer(3)*b**Integer(3) + Integer(2)*b**Integer(2) - Integer(2)*b,
        ...        Integer(0)])
        >>> X.intersection_multiplicity(Y, Q)                                     # needs sage.libs.singular
        3

    Sage

        sage: A.<x,y,z> = AffineSpace(QQ, 3)
        sage: X = A.subscheme([z^2 - 1])
        sage: Y = A.subscheme([z - 1, y - x^2])
        sage: Q = A([1,1,1])
        sage: X.intersection_multiplicity(Y, Q)                                     # needs sage.libs.singular
        Traceback (most recent call last):
        ...
        TypeError: the intersection of this subscheme and (=Closed subscheme of Affine Space of dimension 3
        over Rational Field defined by: z - 1, -x^2 + y) must be proper and finite

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
        >>> X = A.subscheme([z**Integer(2) - Integer(1)])
        >>> Y = A.subscheme([z - Integer(1), y - x**Integer(2)])
        >>> Q = A([Integer(1),Integer(1),Integer(1)])
        >>> X.intersection_multiplicity(Y, Q)                                     # needs sage.libs.singular
        Traceback (most recent call last):
        ...
        TypeError: the intersection of this subscheme and (=Closed subscheme of Affine Space of dimension 3
        over Rational Field defined by: z - 1, -x^2 + y) must be proper and finite

    Sage

        sage: A.<x,y,z,w,t> = AffineSpace(QQ, 5)
        sage: X = A.subscheme([x*y, t^2*w, w^3*z])
        sage: Y = A.subscheme([y*w + z])
        sage: Q = A([0,0,0,0,0])
        sage: X.intersection_multiplicity(Y, Q)                                     # needs sage.libs.singular
        Traceback (most recent call last):
        ...
        TypeError: the intersection of this subscheme and (=Closed subscheme of Affine Space of dimension 5
        over Rational Field defined by: y*w + z) must be proper and finite

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(5), names=('x', 'y', 'z', 'w', 't',)); (x, y, z, w, t,) = A._first_ngens(5)
        >>> X = A.subscheme([x*y, t**Integer(2)*w, w**Integer(3)*z])
        >>> Y = A.subscheme([y*w + z])
        >>> Q = A([Integer(0),Integer(0),Integer(0),Integer(0),Integer(0)])
        >>> X.intersection_multiplicity(Y, Q)                                     # needs sage.libs.singular
        Traceback (most recent call last):
        ...
        TypeError: the intersection of this subscheme and (=Closed subscheme of Affine Space of dimension 5
        over Rational Field defined by: y*w + z) must be proper and finite

  is_smooth(point=None)

    Test whether the algebraic subscheme is smooth.

    INPUT:

    - `point` – a point or `None` (default). The point to test smoothness at

    OUTPUT:

    boolean; if no point was specified, returns whether the algebraic subscheme is smooth everywhere. Otherwise, smoothness at the specified point is tested.

    EXAMPLES:

    Sage

        sage: A2.<x,y> = AffineSpace(2, QQ)
        sage: cuspidal_curve = A2.subscheme([y^2 - x^3])
        sage: cuspidal_curve
        Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
          -x^3 + y^2
        sage: smooth_point = cuspidal_curve.point([1,1])
        sage: smooth_point in cuspidal_curve
        True
        sage: singular_point = cuspidal_curve.point([0,0])
        sage: singular_point in cuspidal_curve
        True
        sage: cuspidal_curve.is_smooth(smooth_point)                                # needs sage.libs.singular
        True
        sage: cuspidal_curve.is_smooth(singular_point)                              # needs sage.libs.singular
        False
        sage: cuspidal_curve.is_smooth()                                            # needs sage.libs.singular
        False

    Python

        >>> from sage.all import *
        >>> A2 = AffineSpace(Integer(2), QQ, names=('x', 'y',)); (x, y,) = A2._first_ngens(2)
        >>> cuspidal_curve = A2.subscheme([y**Integer(2) - x**Integer(3)])
        >>> cuspidal_curve
        Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
          -x^3 + y^2
        >>> smooth_point = cuspidal_curve.point([Integer(1),Integer(1)])
        >>> smooth_point in cuspidal_curve
        True
        >>> singular_point = cuspidal_curve.point([Integer(0),Integer(0)])
        >>> singular_point in cuspidal_curve
        True
        >>> cuspidal_curve.is_smooth(smooth_point)                                # needs sage.libs.singular
        True
        >>> cuspidal_curve.is_smooth(singular_point)                              # needs sage.libs.singular
        False
        >>> cuspidal_curve.is_smooth()                                            # needs sage.libs.singular
        False

  multiplicity(P)

    Return the multiplicity of `P` on this subscheme.

    This is computed as the multiplicity of the local ring of this subscheme corresponding to `P`. This subscheme must be defined over a field. An error is raised if `P` is not a point on this subscheme.

    INPUT:

    - `P` – a point on this subscheme

    OUTPUT: integer

    EXAMPLES:

    Sage

        sage: A.<x,y,z,w> = AffineSpace(QQ, 4)
        sage: X = A.subscheme([z*y - x^7, w - 2*z])
        sage: Q1 = A([1,1/3,3,6])
        sage: X.multiplicity(Q1)                                                    # needs sage.libs.singular
        1
        sage: Q2 = A([0,0,0,0])
        sage: X.multiplicity(Q2)                                                    # needs sage.libs.singular
        2

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(4), names=('x', 'y', 'z', 'w',)); (x, y, z, w,) = A._first_ngens(4)
        >>> X = A.subscheme([z*y - x**Integer(7), w - Integer(2)*z])
        >>> Q1 = A([Integer(1),Integer(1)/Integer(3),Integer(3),Integer(6)])
        >>> X.multiplicity(Q1)                                                    # needs sage.libs.singular
        1
        >>> Q2 = A([Integer(0),Integer(0),Integer(0),Integer(0)])
        >>> X.multiplicity(Q2)                                                    # needs sage.libs.singular
        2

    Sage

        sage: A.<x,y,z,w,v> = AffineSpace(GF(23), 5)
        sage: C = A.curve([x^8 - y, y^7 - z, z^3 - 1, w^5 - v^3])                   # needs sage.libs.singular sage.schemes
        sage: Q = A([22,1,1,0,0])
        sage: C.multiplicity(Q)                                                     # needs sage.libs.singular sage.schemes
        3

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(GF(Integer(23)), Integer(5), names=('x', 'y', 'z', 'w', 'v',)); (x, y, z, w, v,) = A._first_ngens(5)
        >>> C = A.curve([x**Integer(8) - y, y**Integer(7) - z, z**Integer(3) - Integer(1), w**Integer(5) - v**Integer(3)])                   # needs sage.libs.singular sage.schemes
        >>> Q = A([Integer(22),Integer(1),Integer(1),Integer(0),Integer(0)])
        >>> C.multiplicity(Q)                                                     # needs sage.libs.singular sage.schemes
        3

    Sage

        sage: # needs sage.rings.number_field
        sage: K.<a> = QuadraticField(-1)
        sage: A.<x,y,z,w,t> = AffineSpace(K, 5)
        sage: X = A.subscheme([y^7 - x^2*z^5 + z^3*t^8 - x^2*y^4*z - t^8])
        sage: Q1 = A([1,1,0,1,-1])
        sage: X.multiplicity(Q1)                                                    # needs sage.libs.singular
        1
        sage: Q2 = A([0,0,0,-a,0])
        sage: X.multiplicity(Q2)                                                    # needs sage.libs.singular
        7

    Python

        >>> from sage.all import *
        >>> # needs sage.rings.number_field
        >>> K = QuadraticField(-Integer(1), names=('a',)); (a,) = K._first_ngens(1)
        >>> A = AffineSpace(K, Integer(5), names=('x', 'y', 'z', 'w', 't',)); (x, y, z, w, t,) = A._first_ngens(5)
        >>> X = A.subscheme([y**Integer(7) - x**Integer(2)*z**Integer(5) + z**Integer(3)*t**Integer(8) - x**Integer(2)*y**Integer(4)*z - t**Integer(8)])
        >>> Q1 = A([Integer(1),Integer(1),Integer(0),Integer(1),-Integer(1)])
        >>> X.multiplicity(Q1)                                                    # needs sage.libs.singular
        1
        >>> Q2 = A([Integer(0),Integer(0),Integer(0),-a,Integer(0)])
        >>> X.multiplicity(Q2)                                                    # needs sage.libs.singular
        7

    Check that Issue #27479 is fixed:

    Sage

        sage: A1.<x> = AffineSpace(QQ, 1)
        sage: X = A1.subscheme([x^1789 + x])
        sage: Q = X([0])
        sage: X.multiplicity(Q)                                                     # needs sage.libs.singular
        1

    [Python]

        >>> from sage.all import *
        >>> A1 = AffineSpace(QQ, Integer(1), names=('x',)); (x,) = A1._first_ngens(1)
        >>> X = A1.subscheme([x**Integer(1789) + x])
        >>> Q = X([Integer(0)])
        >>> X.multiplicity(Q)                                                     # needs sage.libs.singular
        1

  projective_closure(i=None, PP=None)

    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.

    - `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

    EXAMPLES:

    Sage

        sage: A.<x,y,z,w> = 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()                                                # needs sage.libs.singular
        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

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(4), names=('x', 'y', 'z', 'w',)); (x, y, z, w,) = A._first_ngens(4)
        >>> X = A.subscheme([x**Integer(2) - y, x*y - z, y**Integer(2) - w,
        ...                  x*z - w, y*z - x*w, z**Integer(2) - y*w])
        >>> X.projective_closure()                                                # needs sage.libs.singular
        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

    Sage

        sage: A.<x,y,z> = AffineSpace(QQ, 3)
        sage: P.<a,b,c,d> = ProjectiveSpace(QQ, 3)
        sage: X = A.subscheme([z - x^2 - y^2])
        sage: X.projective_closure(1, P).ambient_space() == P                       # needs sage.libs.singular
        True

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
        >>> P = ProjectiveSpace(QQ, Integer(3), names=('a', 'b', 'c', 'd',)); (a, b, c, d,) = P._first_ngens(4)
        >>> X = A.subscheme([z - x**Integer(2) - y**Integer(2)])
        >>> X.projective_closure(Integer(1), P).ambient_space() == P                       # needs sage.libs.singular
        True

  projective_embedding(i=None, PP=None)

    Return 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 coordinate); determines which projective embedding to compute. The embedding is that 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

    EXAMPLES:

    Sage

        sage: A.<x, y, z> = AffineSpace(3, ZZ)
        sage: S = A.subscheme([x*y - z])
        sage: S.projective_embedding()                                              # needs sage.libs.singular
        Scheme morphism:
          From: Closed subscheme of Affine Space of dimension 3 over Integer Ring
                defined by: x*y - z
          To:   Closed subscheme of Projective Space of dimension 3 over Integer Ring
                defined by: x0*x1 - x2*x3
          Defn: Defined on coordinates by sending (x, y, z) to (x : y : z : 1)

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(Integer(3), ZZ, names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
        >>> S = A.subscheme([x*y - z])
        >>> S.projective_embedding()                                              # needs sage.libs.singular
        Scheme morphism:
          From: Closed subscheme of Affine Space of dimension 3 over Integer Ring
                defined by: x*y - z
          To:   Closed subscheme of Projective Space of dimension 3 over Integer Ring
                defined by: x0*x1 - x2*x3
          Defn: Defined on coordinates by sending (x, y, z) to (x : y : z : 1)

    Sage

        sage: A.<x, y, z> = AffineSpace(3, ZZ)
        sage: P = ProjectiveSpace(3, ZZ, 'u')
        sage: S = A.subscheme([x^2 - y*z])
        sage: S.projective_embedding(1, P)                                          # needs sage.libs.singular
        Scheme morphism:
          From: Closed subscheme of Affine Space of dimension 3 over Integer Ring
                defined by: x^2 - y*z
          To:   Closed subscheme of Projective Space of dimension 3 over Integer Ring
                defined by: u0^2 - u2*u3
          Defn: Defined on coordinates by sending (x, y, z) to (x : 1 : y : z)

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(Integer(3), ZZ, names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
        >>> P = ProjectiveSpace(Integer(3), ZZ, 'u')
        >>> S = A.subscheme([x**Integer(2) - y*z])
        >>> S.projective_embedding(Integer(1), P)                                          # needs sage.libs.singular
        Scheme morphism:
          From: Closed subscheme of Affine Space of dimension 3 over Integer Ring
                defined by: x^2 - y*z
          To:   Closed subscheme of Projective Space of dimension 3 over Integer Ring
                defined by: u0^2 - u2*u3
          Defn: Defined on coordinates by sending (x, y, z) to (x : 1 : y : z)

    Sage

        sage: A.<x,y,z> = AffineSpace(QQ, 3)
        sage: X = A.subscheme([y - x^2, z - x^3])
        sage: X.projective_embedding()                                              # needs sage.libs.singular
        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)

    Python

        >>> from sage.all import *
        >>> A = AffineSpace(QQ, Integer(3), names=('x', 'y', 'z',)); (x, y, z,) = A._first_ngens(3)
        >>> X = A.subscheme([y - x**Integer(2), z - x**Integer(3)])
        >>> X.projective_embedding()                                              # needs sage.libs.singular
        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)

    When taking a closed subscheme of an affine space with a projective embedding, the subscheme inherits the embedding:

    Sage

        sage: A.<u,v> = AffineSpace(2, QQ, default_embedding_index=1)
        sage: X = A.subscheme(u - v)                                                # needs sage.libs.singular
        sage: X.projective_embedding()                                              # needs sage.libs.singular
        Scheme morphism:
          From: Closed subscheme of Affine Space of dimension 2 over Rational Field
                defined by: u - v
          To:   Closed subscheme of Projective Space of dimension 2 over Rational Field
                defined by: x0 - x2
          Defn: Defined on coordinates by sending (u, v) to (u : 1 : v)
        sage: phi = X.projective_embedding()                                        # needs sage.libs.singular
        sage: psi = A.projective_embedding()
        sage: phi(X(2, 2)) == psi(A(X(2, 2)))                                       # needs sage.libs.singular
        True

    [Python]

        >>> from sage.all import *
        >>> A = AffineSpace(Integer(2), QQ, default_embedding_index=Integer(1), names=('u', 'v',)); (u, v,) = A._first_ngens(2)
        >>> X = A.subscheme(u - v)                                                # needs sage.libs.singular
        >>> X.projective_embedding()                                              # needs sage.libs.singular
        Scheme morphism:
          From: Closed subscheme of Affine Space of dimension 2 over Rational Field
                defined by: u - v
          To:   Closed subscheme of Projective Space of dimension 2 over Rational Field
                defined by: x0 - x2
          Defn: Defined on coordinates by sending (u, v) to (u : 1 : v)
        >>> phi = X.projective_embedding()                                        # needs sage.libs.singular
        >>> psi = A.projective_embedding()
        >>> phi(X(Integer(2), Integer(2))) == psi(A(X(Integer(2), Integer(2))))                                       # needs sage.libs.singular
        True

class sage.schemes.affine.affine_subscheme.AlgebraicScheme_subscheme_affine_field(A, polynomials, embedding_center=None, embedding_codomain=None, embedding_images=None)

  Bases: `AlgebraicScheme_subscheme_affine`

  Algebraic subschemes of projective spaces defined over fields.

  tangent_space(p)

    Return the tangent space at the point `p`.

    The points of the tangent space are the tangent vectors at `p`.

    INPUT:

    - `p` – a rational point

    EXAMPLES:

    Sage

        sage: A3.<x,y,z> = AffineSpace(3, QQ)
        sage: X = A3.subscheme(z - x*y)
        sage: X.tangent_space(A3.origin())                                          # needs sage.libs.singular
        Closed subscheme of Affine Space of dimension 3 over Rational Field
         defined by:
          z
        sage: X.tangent_space(X(1,1,1))                                             # needs sage.libs.singular
        Closed subscheme of Affine Space of dimension 3 over Rational Field
         defined by:
          -x - y + z

    Python

        >>> from sage.all import *
        >>> A3 = AffineSpace(Integer(3), QQ, names=('x', 'y', 'z',)); (x, y, z,) = A3._first_ngens(3)
        >>> X = A3.subscheme(z - x*y)
        >>> X.tangent_space(A3.origin())                                          # needs sage.libs.singular
        Closed subscheme of Affine Space of dimension 3 over Rational Field
         defined by:
          z
        >>> X.tangent_space(X(Integer(1),Integer(1),Integer(1)))                                             # needs sage.libs.singular
        Closed subscheme of Affine Space of dimension 3 over Rational Field
         defined by:
          -x - y + z

    Tangent space at a point may have higher dimension than the dimension of the point.

    Sage

        sage: # needs sage.libs.singular
        sage: C = Curve([x + y + z, x^2 - y^2*z^2 + z^3])
        sage: C.singular_points()
        [(0, 0, 0)]
        sage: p = C(0,0,0)
        sage: C.tangent_space(p)
        Closed subscheme of Affine Space of dimension 3 over Rational Field
         defined by:
          x + y + z
        sage: _.dimension()
        2
        sage: q = C(1,0,-1)
        sage: C.tangent_space(q)
        Closed subscheme of Affine Space of dimension 3 over Rational Field
         defined by:
          x + y + z,
          2*x + 3*z
        sage: _.dimension()
        1

    [Python]

        >>> from sage.all import *
        >>> # needs sage.libs.singular
        >>> C = Curve([x + y + z, x**Integer(2) - y**Integer(2)*z**Integer(2) + z**Integer(3)])
        >>> C.singular_points()
        [(0, 0, 0)]
        >>> p = C(Integer(0),Integer(0),Integer(0))
        >>> C.tangent_space(p)
        Closed subscheme of Affine Space of dimension 3 over Rational Field
         defined by:
          x + y + z
        >>> _.dimension()
        2
        >>> q = C(Integer(1),Integer(0),-Integer(1))
        >>> C.tangent_space(q)
        Closed subscheme of Affine Space of dimension 3 over Rational Field
         defined by:
          x + y + z,
          2*x + 3*z
        >>> _.dimension()
        1