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
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.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
EXAMPLES:
sage: AffineSpace(QQ, 3, 'a') == AffineSpace(ZZ, 3, 'a')
False
sage: AffineSpace(ZZ,1, 'a') == AffineSpace(ZZ, 0, 'a')
False
sage: loads(AffineSpace(ZZ, 1, 'x').dumps()) == AffineSpace(ZZ, 1, 'x')
True
EXAMPLES:
sage: AffineSpace(3, Zp(5), 'y')
Affine Space of dimension 3 over 5-adic Ring with capped relative precision 20
Return iterator over the elements of this affine space when defined over a finite field.
EXAMPLES:
sage: FF = FiniteField(3)
sage: AA = AffineSpace(FF, 0)
sage: [ x for x in AA ]
[()]
sage: AA = AffineSpace(FF, 1, 'Z')
sage: [ x for x in AA ]
[(0), (1), (2)]
sage: AA.<z,w> = AffineSpace(FF, 2)
sage: [ x for x in AA ]
[(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1), (0, 2), (1, 2), (2, 2)]
AUTHOR:
EXAMPLES:
sage: A = AffineSpace(1, QQ, 'x')
sage: A^5
Affine Space of dimension 5 over Rational Field
Return True if defines a point on the scheme self; raise a
TypeError otherwise.
EXAMPLES:
sage: A = AffineSpace(3, ZZ)
sage: A._check_satisfies_equations([1, 1, 0])
True
sage: A._check_satisfies_equations((0, 1, 0))
True
sage: A._check_satisfies_equations([0, 0, 0])
True
sage: A._check_satisfies_equations([1, 2, 3, 4, 5])
...
TypeError: The list v=[1, 2, 3, 4, 5] must have 3 components
sage: A._check_satisfies_equations([1/2, 1, 1])
...
TypeError: The components of v=[1/2, 1, 1] must be elements of Integer Ring
sage: A._check_satisfies_equations(5)
...
TypeError: The argument v=5 must be a list or tuple
Return a LaTeX representation of this affine space.
EXAMPLES:
sage: print latex(AffineSpace(1, ZZ, 'x'))
\mathbf{A}_{\Bold{Z}}^1
TESTS:
sage: AffineSpace(3, Zp(5), 'y')._latex_()
'\\mathbf{A}_{\\ZZ_{5}}^3'
Return a LaTeX representation of the generic point corresponding to the list of polys on this affine space.
If polys is None, the representation of the generic point of the affine space is returned.
EXAMPLES:
sage: A.<x, y> = AffineSpace(2, ZZ)
sage: A._latex_generic_point([y-x^2])
'\left(- x^{2} + y\right)'
sage: A._latex_generic_point()
'\left(x, y\right)'
Return a string representation of this affine space.
EXAMPLES:
sage: AffineSpace(1, ZZ, 'x')
Affine Space of dimension 1 over Integer Ring
TESTS:
sage: AffineSpace(3, Zp(5), 'y')._repr_()
'Affine Space of dimension 3 over 5-adic Ring with capped relative precision 20'
Return a string representation of the generic point corresponding to the list of polys on this affine space.
If polys is None, the representation of the generic point of the affine space is returned.
EXAMPLES:
sage: A.<x, y> = AffineSpace(2, ZZ)
sage: A._repr_generic_point([y-x^2])
'(-x^2 + y)'
sage: A._repr_generic_point()
'(x, y)'
Return a valid tuple of polynomial functions on self given by
. Raise an error if
does not consist of valid
functions.
EXAMPLES:
sage: A.<x, y, z> = AffineSpace(3, ZZ)
sage: A._validate([x*y-z, 1])
(x*y - z, 1)
sage: A._validate([x, y, 1/3*z])
...
ValueError: The arguments [x, y, 1/3*z] are not valid polynomial functions on this affine space
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