Affine \(n\) space over a ring

sage.schemes.affine.affine_space.AffineSpace(n, R=None, names='x', ambient_projective_space=None, default_embedding_index=None)

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.affine.affine_space.AffineSpace_field(n, R, names, ambient_projective_space, default_embedding_index)

Bases: sage.schemes.affine.affine_space.AffineSpace_generic

curve(F)

Return a curve defined by F in this affine space.

INPUT:

  • F – a polynomial, or a list or tuple of polynomials in the coordinate ring of this affine space.

EXAMPLES:

sage: A.<x,y,z> = AffineSpace(QQ, 3)
sage: A.curve([y - x^4, z - y^5])
Affine Curve over Rational Field defined by -x^4 + y, -y^5 + z
points_of_bounded_height(**kwds)

Returns an iterator of the points in this affine space of absolute height of at most the given bound.

Bound check is strict for the rational field. Requires this space to be affine space over a number field. Uses the Doyle-Krumm algorithm 4 (algorithm 5 for imaginary quadratic) for computing algebraic numbers up to a given height [Doyle-Krumm].

The algorithm requires floating point arithmetic, so the user is allowed to specify the precision for such calculations. Additionally, due to floating point issues, points slightly larger than the bound may be returned. This can be controlled by lowering the tolerance.

INPUT:

kwds:

  • bound - a real number
  • tolerance - a rational number in (0,1] used in doyle-krumm algorithm-4
  • precision - the precision to use for computing the elements of bounded height of number fields

OUTPUT:

  • an iterator of points in self

EXAMPLES:

sage: A.<x,y> = AffineSpace(QQ, 2)
sage: list(A.points_of_bounded_height(bound=3))
[(0, 0), (1, 0), (-1, 0), (1/2, 0), (-1/2, 0), (2, 0), (-2, 0), (0, 1),
(1, 1), (-1, 1), (1/2, 1), (-1/2, 1), (2, 1), (-2, 1), (0, -1), (1, -1),
(-1, -1), (1/2, -1), (-1/2, -1), (2, -1), (-2, -1), (0, 1/2), (1, 1/2),
(-1, 1/2), (1/2, 1/2), (-1/2, 1/2), (2, 1/2), (-2, 1/2), (0, -1/2), (1, -1/2),
(-1, -1/2), (1/2, -1/2), (-1/2, -1/2), (2, -1/2), (-2, -1/2), (0, 2), (1, 2),
(-1, 2), (1/2, 2), (-1/2, 2), (2, 2), (-2, 2), (0, -2), (1, -2), (-1, -2), (1/2, -2),
(-1/2, -2), (2, -2), (-2, -2)]
sage: u = QQ['u'].0
sage: A.<x,y> = AffineSpace(NumberField(u^2 - 2, 'v'), 2)
sage: len(list(A.points_of_bounded_height(bound=2, tolerance=0.1)))
529
weil_restriction()

Compute the Weil restriction of this affine space over some extension field.

If the field is a finite field, then this computes the Weil restriction to the prime subfield.

OUTPUT: Affine space of dimension d * self.dimension_relative()
over the base field of self.base_ring().

EXAMPLES:

sage: R.<x> = QQ[]
sage: K.<w> = NumberField(x^5-2)
sage: AK.<x,y> = AffineSpace(K, 2)
sage: AK.weil_restriction()
Affine Space of dimension 10 over Rational Field
sage: R.<x> = K[]
sage: L.<v> = K.extension(x^2+1)
sage: AL.<x,y> = AffineSpace(L, 2)
sage: AL.weil_restriction()
Affine Space of dimension 4 over Number Field in w with defining
polynomial x^5 - 2
class sage.schemes.affine.affine_space.AffineSpace_finite_field(n, R, names, ambient_projective_space, default_embedding_index)

Bases: sage.schemes.affine.affine_space.AffineSpace_field

sage.schemes.affine.affine_space.AffineSpace_generic

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 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
sage.schemes.affine.affine_space.is_AffineSpace(x)

Returns True if x is an affine space.

EXAMPLES:

sage: from sage.schemes.affine.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