Return affine space of dimension over the ring .
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 .
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
Bases: sage.schemes.generic.ambient_space.AmbientSpace, sage.schemes.generic.scheme.AffineScheme
Affine space of dimension over the ring .
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
Return an affine space over ring and otherwise the same as self.
INPUT:
OUTPUT:
Note
There is no need to have any relation between 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
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
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
Returns a morphism from this space into an ambient projective space of the same dimension.
INPUT:
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)
Return the list of -rational points on the affine space self, where 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.
Return the closed subscheme defined by X.
INPUT:
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
Returns True if x is an affine space, i.e., an ambient space , where is a ring and 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