Multivariate polynomial rings are created from
a coefficient ring and the number of indeterminates.
Magma also allows the choice of various orderings on the monomials. These
become significant when constructing Gr"obner bases (see the section
below on ideals and Gr"obner bases).
PolynomialRing(R, n) : Rng, RngIntElt -> RngDPol
Create a multivariate polynomial ring in n>0 indeterminates over the ring R. The ring is regarded as an R-algebra via the usual identification of elements of R and the constant polynomials. The lexicographical ordering on the monomials is used for this default construction (see next function). The angle bracket notation can be used to assign names to the indeterminates: P<x, y> := PolynomialRing(R, 2); etc.
Create a multivariate polynomial ring in n>0 indeterminates over the ring R with the lexicographic ordering (lex) on the monomials. In this ordering, the i-th variable is greater than the (i + 1)-th variable for 1 <= i < n.
Create a multivariate polynomial ring in n>0 indeterminates over the ring R with the graded-reverse-lexicographic ordering (grevlex) on the monomials. In this ordering, monomials are compared with respect to total degree first, and then the variables are compared with respect to the inverse lexicographical order in reverse order. Thus the i-th variable is greater than the (i + 1)-th variable for 1 <= i < n.
Create a multivariate polynomial ring in n>0 indeterminates over the ring R with the graded-lexicographic ordering (glex) on the monomials. In this ordering, monomials are compared with respect to total degree first, and then the variables are compared with respect to the lexicographical order. Thus the i-th variable is greater than the (i + 1)-th variable for 1 <= i < n.
Create a multivariate polynomial ring in n>0 indeterminates over the ring R with the k-fold elimination ordering (elim) on the monomials (1 <= k < n). In this ordering, monomials are compared so that any monomial containing the first k variables is greater than any monomial not containing the first k variables (the order is constructed as the concatenation of two block grevlex orderings). Thus the first k variables are "eliminated". The i-th variable is greater than the (i + 1)-th variable for 1 <= i < n.
> Z := Integers(); > S := PolynomialRing(Z, 2);If we define S this way, we can only refer to the indeterminates by S.1 and S.2 (see below). So we could assign these generators to variables, say x and y, as follows:
> x := S.1; > y := S.2;In this case it is easy to construct polynomials, but printing is slightly awkward:
> f := x^3*y +3*y^2; > print f; $.1^3*$.2 + 3*$.2^2To overcome that, it is possible to assign names to the indeterminates that are used in the printing routines, using the AssignNames function, before assigning to x and y.
> AssignNames(~S, ["x", "y"]); > x := S.1; y := S.2; > f := x^3*y +3*y^2; > print f; x^3*y + 3*y^2Alternatively, we use the angle brackets to assign generator names that will be used in printing as well:
> S<x, y> := PolynomialRing(Z, 2); > f := x^3*y +3*y^2; > print f; x^3*y + 3*y^2
The easiest way to create polynomials in a given ring is to use the angle bracket construction to attach names to the indeterminates, and to use these names to express polynomials (see the examples). Below we list other options.
Return the i-th indeterminate for the polynomial ring P in n variables (1 <= i <= n) as an element of P.
This element constructor can only be used for trivial purposes in multivariate polynomial rings: given a polynomial ring P=R[x_1, ..., x_(n)] and an element a that can be coerced into the coefficient ring R, the constant polynomial a is returned; if a is in P already it will be returned unchanged.
Given a multivariate polynomial ring P=R[x_1, ..., x_n], as well as a polynomial p in a univariate polynomial ring R[x] over the same coefficient ring R, return an element q of P corresponding to p in the indeterminate v=x_i; that is, q in P is defined by q=sum_j p_jx_i^j where p=sum_j p_jx^j. The indeterminate x_i can either be specified as a polynomial v=x_i in P, or by simply providing the integer i with 1 <= i <= n.[Next] [Prev] [Right] [Left] [Up] [Index] [Root]The inverse operation is performed by the UnivariatePolynomial function.