Affine n space over a ring.

sage.schemes.generic.affine_space.AffineSpace(n, R=None, names='x')

Return affine space of dimension n over the ring R.

EXAMPLES: The dimension and ring can be given in either order.

sage: AffineSpace(3, QQ, 'x')
Affine Space of dimension 3 over Rational Field
sage: AffineSpace(5, QQ, 'x')
Affine Space of dimension 5 over Rational Field
sage: A = AffineSpace(2, QQ, names='XY'); A
Affine Space of dimension 2 over Rational Field
sage: A.coordinate_ring()
Multivariate Polynomial Ring in X, Y over Rational Field

Use the divide operator for base extension.

sage: AffineSpace(5, names='x')/GF(17)
Affine Space of dimension 5 over Finite Field of size 17

The default base ring is \ZZ.

sage: AffineSpace(5, names='x')
Affine Space of dimension 5 over Integer Ring

There is also an affine space associated to each polynomial ring.

sage: R = GF(7)['x,y,z']
sage: A = AffineSpace(R); A
Affine Space of dimension 3 over Finite Field of size 7
sage: A.coordinate_ring() is R
True
class sage.schemes.generic.affine_space.AffineSpace_generic(n, R, names)

Bases: sage.schemes.generic.ambient_space.AmbientSpace, sage.schemes.generic.scheme.AffineScheme

Affine space of dimension n over the ring R.

EXAMPLES:

sage: X.<x,y,z> = AffineSpace(3, QQ)
sage: X.base_scheme()
Spectrum of Rational Field
sage: X.base_ring()
Rational Field
sage: X.category()
Category of schemes over Spectrum of Rational Field
sage: X.structure_morphism ()
Scheme morphism:
  From: Affine Space of dimension 3 over Rational Field
  To:   Spectrum of Rational Field
  Defn: Structure map

Loading and saving:

sage: loads(X.dumps()) == X
True

We create several other examples of affine spaces.

sage: AffineSpace(5, PolynomialRing(QQ, 'z'), 'Z')
Affine Space of dimension 5 over Univariate Polynomial Ring in z over Rational Field
sage: AffineSpace(RealField(), 3, 'Z')
Affine Space of dimension 3 over Real Field with 53 bits of precision
sage: AffineSpace(Qp(7), 2, 'x')
Affine Space of dimension 2 over 7-adic Field with capped relative precision 20

Even 0-dimensional affine spaces are supported.

sage: AffineSpace(0)
Affine Space of dimension 0 over Integer Ring
change_ring(R)

Return an affine space over ring R and otherwise the same as self.

INPUT:

  • R – commutative ring

OUTPUT:

  • affine space over R

Note

There is no need to have any relation between R and the base ring of self, if you want to have such a relation, use self.base_extend(R) instead.

EXAMPLES:

sage: A.<x, y, z> = AffineSpace(3, ZZ)
sage: AQ = A.change_ring(QQ); AQ
Affine Space of dimension 3 over Rational Field
sage: AQ.change_ring(GF(5))
Affine Space of dimension 3 over Finite Field of size 5
coordinate_ring()

Return the coordinate ring of this scheme, if defined.

EXAMPLES:

sage: R = AffineSpace(2, GF(9,'alpha'), 'z').coordinate_ring(); R
Multivariate Polynomial Ring in z0, z1 over Finite Field in alpha of size 3^2
sage: AffineSpace(3, R, 'x').coordinate_ring()
Multivariate Polynomial Ring in x0, x1, x2 over Multivariate Polynomial Ring in z0, z1 over Finite Field in alpha of size 3^2
ngens()

Return the number of generators of self, i.e. the number of variables in the coordinate ring of self.

EXAMPLES:

sage: AffineSpace(3, QQ).ngens()
3
sage: AffineSpace(7, ZZ).ngens()
7
projective_embedding(i=None, PP=None)

Returns a morphism from this space into an ambient projective space of the same dimension.

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., codomain of morphism; this is constructed if it is not given.

EXAMPLES:

sage: AA = AffineSpace(2, QQ, 'x')
sage: pi = AA.projective_embedding(0); pi
Scheme morphism:
  From: Affine Space of dimension 2 over Rational Field
  To:   Projective Space of dimension 2 over Rational Field
  Defn: Defined on coordinates by sending (x0, x1) to
        (1 : x0 : x1)
sage: z = AA(3,4)
sage: pi(z)
(1/4 : 3/4 : 1)
sage: pi(AA(0,2))
(1/2 : 0 : 1)
sage: pi = AA.projective_embedding(1); pi
Scheme morphism:
  From: Affine Space of dimension 2 over Rational Field
  To:   Projective Space of dimension 2 over Rational Field
  Defn: Defined on coordinates by sending (x0, x1) to
        (x0 : 1 : x1)
sage: pi(z)
(3/4 : 1/4 : 1)
sage: pi = AA.projective_embedding(2)
sage: pi(z)
(3 : 4 : 1)
rational_points(F=None)

Return the list of F-rational points on the affine space self, where F is a given finite field, or the base ring of self.

EXAMPLES:

sage: A = AffineSpace(1, GF(3))
sage: A.rational_points()
[(0), (1), (2)]
sage: A.rational_points(GF(3^2, 'b'))
[(0), (2*b), (b + 1), (b + 2), (2), (b), (2*b + 2), (2*b + 1), (1)]

sage: AffineSpace(2, ZZ).rational_points(GF(2))
[(0, 0), (1, 0), (0, 1), (1, 1)]

TESTS:

sage: AffineSpace(2, QQ).rational_points()
...
TypeError: Base ring (= Rational Field) must be a finite field.
sage: AffineSpace(1, GF(3)).rational_points(ZZ)
...
TypeError: Second argument (= Integer Ring) must be a finite field.
subscheme(X)

Return the closed subscheme defined by X.

INPUT:

  • X - a list or tuple of equations

EXAMPLES:

sage: A.<x,y> = AffineSpace(QQ, 2)
sage: X = A.subscheme([x, y^2, x*y^2]); X
Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
  x,
  y^2,
  x*y^2
sage: X.defining_polynomials ()
(x, y^2, x*y^2)
sage: I = X.defining_ideal(); I
Ideal (x, y^2, x*y^2) of Multivariate Polynomial Ring in x, y over Rational Field
sage: I.groebner_basis()
[y^2, x]
sage: X.dimension()
0
sage: X.base_ring()
Rational Field
sage: X.base_scheme()
Spectrum of Rational Field
sage: X.structure_morphism()
Scheme morphism:
  From: Closed subscheme of Affine Space of dimension 2 over Rational Field defined by:
  x,
  y^2,
  x*y^2
  To:   Spectrum of Rational Field
  Defn: Structure map
sage: X.dimension()
0
sage.schemes.generic.affine_space.is_AffineSpace(x)

Returns True if x is an affine space, i.e., an ambient space \mathbb{A}^n_R, where R is a ring and n\geq 0 is an integer.

EXAMPLES:

sage: from sage.schemes.generic.affine_space import is_AffineSpace
sage: is_AffineSpace(AffineSpace(5, names='x'))
True
sage: is_AffineSpace(AffineSpace(5, GF(9,'alpha'), names='x'))
True
sage: is_AffineSpace(Spec(ZZ))
False

Previous topic

Ambient Spaces

Next topic

Projective n space over a ring.

This Page