Polynomial Rings and Ideals

Contents

Creation of Polynomial Rings and Accessing their Monomial Orders

Multivariate polynomial rings are created from a coefficient ring, the number of variables, and a monomial order. If no order is specified, the monomial order is taken to be the lexicographical order. This section is briefly repeated from Section Creation of Polynomial Rings in the multivariate polynomial rings chapter, so as to show how one can set up the polynomial ring in which to create an ideal.

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
    Global: BoolElt                     Default: false
Create a multivariate polynomial ring in n>0 variables 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).

By default, a non-global polynomial ring will be returned; if the parameter Global is set to true, then the unique global polynomial ring over R with n variables will be returned. This may be useful in some contexts, but a non-global result is returned by default since one often wishes to have several rings with the same numbers of variables but with different variable names (and create mappings between them, for example). Explicit coercion is always allowed between polynomial rings having the same number of variables (and suitable base rings), whether they are global or not, and the coercion maps the i-variable of one ring to the i-th variable of the other ring.

PolynomialRing(R, n, order) : Rng, RngIntElt, MonStgElt, ... -> RngMPol
PolynomialAlgebra(R, n, order) : Rng, RngIntElt, MonStgElt, ... -> RngMPol
Create a multivariate polynomial ring in n>0 variables 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.
PolynomialRing(R, n, T) : Rng, RngIntElt, Tup -> RngMPol
PolynomialAlgebra(R, n, T) : Rng, RngIntElt, Tup -> RngMPol
Create a multivariate polynomial ring in n>0 variables over the ring R with the order given by the tuple T on the monomials. T must be a tuple whose components match the valid arguments for the monomial orders in Section Representation and Monomial Orders (or a tuple returned by the following function MonomialOrder).
MonomialOrder(P) : RngMPol -> Tup
Given a polynomial ring P (or an ideal thereof), return a description of the monomial order of P. This is returned as a tuple which matches the relevant arguments listed for each possible order in Section Representation and Monomial Orders, so may be passed as the third argument to the function PolynomialRing above.
MonomialOrderWeightVectors(P) : RngMPol -> [ [ FldRatElt ] ]
Given a polynomial ring P of rank n (or an ideal thereof), return the weight vectors of the underlying monomial order as a sequence of n sequences of n rationals. See, for example, [CLO98, p. 153] for more information.
SetSparseMonomialMinRank(R) : RngIntElt ->
(Procedure.) Set the limit R so that when a multivariate polynomial ring P is created with at least R variables (i.e., has rank at least R), the sparse monomial representation is used for the monomials (R = 0 means that the sparse representation will never be used). The initial value of R is currently 20. The sparse representation saves time and memory for computations where there are large numbers of variables and the monomials are relatively sparse (have small degree).
GetSparseMonomialMinRank() : -> RngIntElt
Return the sparse monomial rank (as set by SetSparseMonomialMinRank).

Example GB_Order (H112E1)

We show how one can construct different polynomial rings with different orders.
> Z := IntegerRing();
> // Construct polynomial ring with DEFAULT lex order
> P<a,b,c,d> := PolynomialRing(Z, 4);
> MonomialOrder(P);
<"lex">
> MonomialOrderWeightVectors(P);
[
    [ 1, 0, 0, 0 ],
    [ 0, 1, 0, 0 ],
    [ 0, 0, 1, 0 ],
    [ 0, 0, 0, 1 ]
]
> // Construct polynomial ring with grevlex order
> P<a,b,c,d> := PolynomialRing(Z, 4, "grevlex");
> MonomialOrder(P);
<"grevlex">
> MonomialOrderWeightVectors(P);
[
    [ 1, 1, 1, 1 ],
    [ 1, 1, 1, 0 ],
    [ 1, 1, 0, 0 ],
    [ 1, 0, 0, 0 ]
]
> // Construct polynomial ring with block elimination and a > d > b > c
> P<a,b,c,d> := PolynomialRing(Z, 4, "elim", [1, 4], [2, 3]);
> MonomialOrder(P);
<"elim", [ 1, 4 ], [ 2, 3 ]>
> MonomialOrderWeightVectors(P);
[
    [ 1, 0, 0, 1 ],
    [ 1, 0, 0, 0 ],
    [ 0, 1, 1, 0 ],
    [ 0, 1, 0, 0 ]
]
> 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]);
> MonomialOrder(P);
<"weight", [ 100, 10, 1, 1, 10, 100, 1, 1, 1 ]>
> MonomialOrderWeightVectors(P);
[
    [ 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 Graded Polynomial Rings

It is possible within Magma to assign weights to the variables of a multivariate polynomial ring. This means that monomials of the ring then have a weighted degree with respect to the weights of the variables. Such a multivariate polynomial ring is called graded or weighted. A polynomial of the ring whose monomials all have the same weighted degree is called homogeneous. The polynomial ring can be decomposed as the direct sum of graded homogeneous components.

Suppose a polynomial ring P has n variables x1, ..., xn and the weights for the variables are d1, ..., dn respectively. Then for a monomial m = x1e1 ... xnen of P (with ei ≥0 for 1 ≤i ≤n), the weighted degree of m is defined to be ∑i=1n ei di.

A polynomial ring created without a specific weighting (using the default version of the PolynomialRing function or similar) has weight 1 for each variable so the weighted degree coincides with the total degree.

The following functions allow one to create and operate on elements of polynomial rings with specific weights for the variables.

PolynomialRing(R, Q) : Rng, [ RngIntElt ] -> RngMPol
PolynomialAlgebra(R, Q) : Rng, [ RngIntElt ] -> RngMPol
Given a ring R and a non-empty sequence Q of positive integers, create a multivariate polynomial ring in n=#Q variables over the ring R with the weighted degree of the i-th variable set to be Q[i] for each i. The rank n of the polynomial is determined by the length of the sequence Q. (The angle bracket notation can be used to assign names to the variables, just like in the usual invocation of the PolynomialRing function.)

As of V2.15, the default monomial order chosen is the grevlexw order with weights given by Q, since the Gröbner basis of an ideal w.r.t. this order tends to be smaller if the ideal is homogeneous w.r.t. the grading.

Grading(P) : RngMPol -> [ RngIntElt ]
VariableWeights(P) : RngMPol -> [ RngIntElt ]
Given a graded polynomial ring P (or an ideal thereof), return the variable weights of P as a sequence of n integers where n is the rank of P. If P was constructed without specific weights, the sequence containing n copies of the integer 1 is returned.
HomogeneousWeightsSearch(S) : [ RngMPol ] -> BoolElt, [ RngIntElt ]
Given a set or sequence S of polynomials from R[x1, ..., xn], try to find a sequence of positive weights W w.r.t. which S is homogeneous. If found, this function returns {true} and the sequence W of n weights; otherwise it returns {false}. If the parameter Approximate is set to {true} and no exact grading is found, the function attempts to find an sequence W of positive weights w.r.t. which S is approximately homogeneous (with the constant terms the polynomials in S ignored).

Element Operations Using the Grading

Degree(f) : RngMPolElt -> RngIntElt
WeightedDegree(f) : RngMPolElt -> RngIntElt
Given a polynomial f of the graded polynomial ring P, this function returns the weighted degree of f, which is the maximum of the weighted degrees of all monomials that occur in f. The weighted degree of a monomial m depends on the weights assigned to the variables of the polynomial ring P --- see the introduction of this section for details. Note that this is different from the natural total degree of f which ignores any weights.
LeadingWeightedDegree(f) : RngMPolElt -> RngIntElt
Given a polynomial f of the graded polynomial ring P, this function returns the leading weighted degree of f, which is the weighted degree of the leading monomial of f. The weighted degree of a monomial m depends on the weights assigned to the variables of the polynomial ring P --- see the introduction of this section for details.
IsHomogeneous(f) : RngMPolElt -> BoolElt
Given a polynomial f of the graded polynomial ring P, this function returns whether f is homogeneous with respect to the weights on the variables of P (i.e., whether the weighted degrees of the monomials of f are all equal).
HomogeneousComponent(f, d) : RngMPolElt, RngIntElt -> RngMPolElt
Given a polynomial f of the graded polynomial ring P, this function returns the weighted degree-d homogeneous component of f which is the sum of all the terms of f whose monomials have weighted degree d. d must be greater than or equal to 0. If f has no terms of weighted degree d, then the result is 0.
HomogeneousComponents(f) : RngMPolElt -> [ RngMPolElt ]
Given a polynomial f of the graded polynomial ring P, this function returns the weighted degree-d homogeneous component of f which is the sum of all the terms of f whose monomials have weighted degree d. d must be greater than or equal to 0. If f has no terms of weighted degree d, then the result is 0.
MonomialsOfDegree(P, d) : RngMPolElt, RngIntElt -> {@ RngMPolElt @}
Given a polynomial ring P and a non-negative integer d, return an indexed set consisting of all monomials in P with total degree d. If P is graded, the grading is ignored.
MonomialsOfWeightedDegree(P, d) : RngMPolElt, RngIntElt -> {@ RngMPolElt @}
Given a graded polynomial ring P and a non-negative integer d, return an indexed set consisting of all monomials in P with weighted degree d. If P has the trivial grading, then this function is equivalent to the function MonomialsOfDegree.

Example GB_Graded (H112E2)

We create a simple graded polynomial ring and perform various simple operations on it.
> P<x, y, z> := PolynomialRing(RationalField(), [1, 2, 4]);
> P;
Graded Polynomial ring of rank 3 over Rational Field
Order: Grevlex with weights [1, 2, 4]
Variables: x, y, z
Variable weights: [1, 2, 4]
> VariableWeights(P);
[ 1, 2, 4 ]
> Degree(x);
1
> Degree(y);
2
> Degree(z);
4
> Degree(x^2*y*z^3); // Weighted total degree
16
> TotalDegree(x^2*y*z^3); // Natural total degree
6
> IsHomogeneous(x);
true
> IsHomogeneous(x + y);
false
> IsHomogeneous(x^2 + y);
true
> I := ideal<P | x^2*y + z, (x^4 + z)^2, y^2 + z>;
> IsHomogeneous(I);
true
> MonomialsOfDegree(P, 4);
{@
    x^4,
    x^3*y,
    x^3*z,
    x^2*y^2,
    x^2*y*z,
    x^2*z^2,
    x*y^3,
    x*y^2*z,
    x*y*z^2,
    x*z^3,
    y^4,
    y^3*z,
    y^2*z^2,
    y*z^3,
    z^4
@}
> MonomialsOfWeightedDegree(P, 4);
{@
    x^4,
    x^2*y,
    y^2,
    z
@}

Creation of Ideals and Accessing their Bases

Within the general context of ideals of polynomial rings, the term "basis" will refer to an ordered sequence of polynomials which generate an ideal. (Thus a basis can contain duplicates and zero elements so is not like a basis of a vector space.)

One normally creates an ideal by the ideal constructor or Ideal function, described below. But it is also possible to create an ideal with a specific basis U and then find the coordinates of polynomials from the polynomial ring with respect to U (see the function Coordinates below). This is done by specifying a fixed basis with the IdealWithFixedBasis intrinsic function. In this case, when Magma computes the Gröbner basis of the ideal (see below), extra information is stored so that polynomials of the ideal can be rewritten in terms of the original fixed basis. However, the use of this feature makes the Gröbner basis computation much more expensive so an ideal should usually not be created with a fixed basis.

ideal<P | L> : RngMPol, List -> RngMPol
Given a multivariate polynomial ring P, return the ideal of P generated by the elements of P specified by the list L. Each term of the list L must be an expression defining an object of one of the following types:
(a)
An element of P;
(b)
A set or sequence of elements of P;
(c)
An ideal of P;
(d)
A set or sequence of ideals of P.
Ideal(B) : [ RngMPolElt ] -> RngMPol
Ideal(B) : { RngMPolElt } -> RngMPol
Given a set or sequence B of polynomials from a polynomial ring P, return the ideal of P generated by the elements of B with the given basis B. This is equivalent to the above ideal constructor, but is more convenient when one simply has a set or sequence of polynomials.
Ideal(f) : RngMPolElt -> RngMPol
Given a polynomial f from a polynomial ring P, return the principal ideal of P generated by f.
IdealWithFixedBasis(B) : [ RngMPolElt ] -> RngMPol
Given a sequence B of polynomials from a polynomial ring P, return the ideal of P generated by the elements of B with the given fixed basis B. When the function Coordinates is called, its result will be with respect to the entries of B instead of the Gröbner basis of I. WARNING: this function should only be used when it is desired to express polynomials of the ideal in terms of the elements of B, as the computation of the Gröbner basis in this case is very expensive, so it should be avoided if these expressions are not wanted.
Basis(I) : RngMPol -> [ RngMPolElt ]
Given an ideal I, return the current basis of I. If I has a fixed basis, that is returned; otherwise the current basis of I (whether it has been converted to a Gröbner basis or not -- see below) is returned.
BasisElement(I, i) : RngMPol, RngIntElt -> RngMPolElt
Given an ideal I together with an integer i, return the i-th element of the current basis of I. This the same as Basis(I)[i].
V2.28, 13 July 2023