[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Creation Functions

Creation Functions

Subsections

Creation of Structures

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
PolynomialAlgebra(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.
PolynomialRing(R, n, "lex") : Rng, RngIntElt, MonStgElt -> RngDPol
PolynomialAlgebra(R, n, "lex") : Rng, RngIntElt, MonStgElt -> RngDPol
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.
PolynomialRing(R, n, "grevlex") : Rng, RngIntElt, MonStgElt -> RngDPol
PolynomialAlgebra(R, n, "grevlex") : Rng, RngIntElt, MonStgElt -> RngDPol
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.
PolynomialRing(R, n, "glex") : Rng, RngIntElt, MonStgElt -> RngDPol
PolynomialAlgebra(R, n, "glex") : Rng, RngIntElt, MonStgElt -> RngDPol
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.
PolynomialRing(R, n, "elim", k) : Rng, RngIntElt, MonStgElt, RngIntElt
PolynomialAlgebra(R, n, "elim", k) : Rng, RngIntElt, MonStgElt, RngIntElt
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.

Example RngDPol_AssignNames (H23E2)

We show the use of angle brackets for generator names.

> 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^2
To 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^2
Alternatively, 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

Creation of Elements

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.

One(P) : RngDPol -> RngDPolElt
Identity(P) : RngDPol -> RngDPolElt
Zero(P) : RngDPol -> RngDPolElt
Representative(P) : RngDPol -> RngDPolElt
P . i : RngDPol, RngInt -> RngDPolElt
Return the i-th indeterminate for the polynomial ring P in n variables (1 <= i <= n) as an element of P.
elt< R | a > : RngDPol, RngElt -> RngDPolElt
R ! s : RngDPol, RngElt -> RngDPolElt
R ! s : RngDPol, [ RngElt ] -> RngDPolElt
elt< R | s > : RngDPol, [ RngElt ] -> RngDPolElt
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.
DistributivePolynomial(P, p, i) : RngDPol, RngUPolElt, RngIntElt -> RngDPolElt
DistributivePolynomial(P, p, v) : RngDPol, RngUPolElt, RngDPolElt -> RngDPolElt
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.

The inverse operation is performed by the UnivariatePolynomial function.

[Next] [Prev] [Right] [Left] [Up] [Index] [Root]