[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Creation of Polynomial Rings and Creation of Polynomials

Creation of Polynomial Rings and Creation of Polynomials

Subsections

Creation of Polynomial Rings

Multivariate polynomial rings are created from a coefficient ring, the number of indeterminates, and a monomial order. If no order is specified, the monomial order is taken to be the lexicographical order. Please note that the Gröbner basis of an ideal with respect to the lexicographical order is often much more complicated and difficult to compute than the Gröbner basis of the same ideal with respect to other monomial orders (e.g. the grevlex order), so it may be preferable to use another order if the Gröbner basis with respect to any order is desired (see also the function EasyIdeal below). Yet the lexicographical order is the most natural order and is often the desired order so that is why it is used by default if no specific order is given.

PolynomialRing(R, n) : Rng, RngIntElt -> RngMPol
PolynomialAlgebra(R, n) : Rng, RngIntElt -> RngMPol
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, order) : Rng, RngIntElt, MonStgElt, ... -> RngMPol
PolynomialAlgebra(R, n, order) : Rng, RngIntElt, MonStgElt, ... -> RngMPol
Create a multivariate polynomial ring in n>0 indeterminates over the ring R with the given order order on the monomials. See the section on monomial orders for the valid values for the argument order. The angle bracket notation can be used to assign names to the indeterminates: P<x, y> := PolynomialRing(R, 2); etc.

Example RngMPol_AssignNames (H29E2)

We show the use of angle brackets for generator names.

> Z := IntegerRing();
> 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;
> 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;
> 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;
> f;
x^3*y + 3*y^2

Example RngMPol_Order (H29E3)

We show how one can construct different polynomial rings with different orders.

> Z := IntegerRing();
> // Construct polynomial ring with block elimination and a > d > b > c
> P<a,b,c,d> := PolynomialRing(Z, 4, "elim", [1, 4], [2, 3]);
> a + b + c + d;
a + d + b + c
> a + d^10 + b + c^10;
d^10 + a + c^10 + b
> a + d^10 + b + c;   
d^10 + a + b + c
> // Construct polynomial ring with weight order and x > y > z
> P<x,y,z> := PolynomialRing(Z, 3, "weight", [100,10,1, 1,10,100, 1,1,1]);
> x + y + z;
x + y + z
> (x+y^2+z^3)^4;
x^4 + 4*x^3*y^2 + 4*x^3*z^3 + 6*x^2*y^4 + 12*x^2*y^2*z^3 +
    6*x^2*z^6 + 4*x*y^6 + 12*x*y^4*z^3 + 12*x*y^2*z^6 +
    4*x*z^9 + y^8 + 4*y^6*z^3 + 6*y^4*z^6 +
    4*y^2*z^9 + z^12

Creation of Polynomials

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) : RngMPol -> RngMPolElt
Identity(P) : RngMPol -> RngMPolElt
Zero(P) : RngMPol -> RngMPolElt
Representative(P) : RngMPol -> RngMPolElt
P . i : RngMPol, RngInt -> RngMPolElt
Return the i-th indeterminate for the polynomial ring P in n variables (1 <= i <= n) as an element of P.
elt< R | a > : RngMPol, RngElt -> RngMPolElt
R ! s : RngMPol, RngElt -> RngMPolElt
R ! s : RngMPol, [ RngElt ] -> RngMPolElt
elt< R | s > : RngMPol, [ RngElt ] -> RngMPolElt
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.
MultivariatePolynomial(P, f, i) : RngMPol, RngUPolElt, RngIntElt -> RngMPolElt
MultivariatePolynomial(P, f, v) : RngMPol, RngUPolElt, RngMPolElt -> RngMPolElt
Given a multivariate polynomial ring P=R[x_1, ..., x_n], as well as a polynomial f in a univariate polynomial ring R[x] over the same coefficient ring R, return an element q of P corresponding to f in the indeterminate v=x_i; that is, q in P is defined by q=sum_j f_jx_i^j where f=sum_j f_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]