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

Element Operations

Subsections

Parent and Category

The categories for elements in multivariate polynomial rings and their quotients are RngMPolElt and RngMPolResElt.

Parent(f) : RngMPolElt -> RngMPol
Category(f) : RngMPolElt -> Cat

Arithmetic Operators

The usual unary and binary ring operations are available for multivariate polynomials, with the following notable restrictions.

Since inverses cannot generally be obtained in polynomial rings, division (using /) of polynomials is not allowed, and neither are negative powers. For polynomial rings over fields division by elements of the coefficient field are allowed.

The operator div has slightly different semantics from the univariate case: if b divides a, that is, if there exists a polynomial q in P such that a = b.q in P then q will be the result of a div b, but if such polynomial does not exist an error is returned.

+ a : RngMPolElt -> RngMPolElt
- a : RngMPolElt -> RngMPolElt
a + b : RngMPolElt, RngMPolElt -> RngMPolElt
a - b : RngMPolElt, RngMPolElt -> RngMPolElt
a * b : RngMPolElt, RngMPolElt -> RngMPolElt
a ^ k : RngMPolElt, RngIntElt -> RngMPolElt
a / b : RngMPolElt, RngMPolElt -> FldFunMElt
a div b : RngMPolElt, RngMPolElt -> RngMPolElt
a +:= b : RngMPolElt, RngMPolElt -> RngMPolElt
a -:= b : RngMPolElt, RngMPolElt -> RngMPolElt
a *:= b : RngMPolElt, RngMPolElt -> RngMPolElt
a div:= b : RngMPolElt, RngMPolElt -> RngMPolElt

Equality and Membership

a eq b : RngMPolElt, RngMPolElt -> BoolElt
a ne b : RngMPolElt, RngMPolElt -> BoolElt
a in R : RngMPolElt, Rng -> BoolElt
a notin R : RngMPolElt, Rng -> BoolElt

Predicates on Ring Elements

The list belows contains the general ring element predicates. Also, the IsDivisibleBy function allows a divisibility test. Note that not all functions are available for every coefficient ring.

IsZero(f) : RngMPolElt -> BoolElt
IsOne(f) : RngMPolElt -> BoolElt
IsMinusOne(f) : RngMPolElt -> BoolElt
IsNilpotent(f) : RngMPolElt -> BoolElt
IsIdempotent(f) : RngMPolElt -> BoolElt
IsUnit(f) : RngMPolElt -> BoolElt
IsZeroDivisor(f) : RngMPolElt -> BoolElt
IsRegular(f) : RngMPolElt -> BoolElt
IsIrreducible(f) : RngMPolElt -> BoolElt
IsPrime(f) : RngMPolElt -> BoolElt
IsDivisibleBy(a, b) : RngMPolElt, RngMPolElt -> BoolElt, RngMPolElt
Given elements a, b in a multivariate polynomial ring P, this function returns true if and only if the polynomial a is divisible by b in P, that is, if and only if there exists q in P such that a=q.b. It true is returned, the quotient polynomial q is also returned.

Univariate Polynomials

IsUnivariate(f) : RngMPolElt -> BoolElt, RngUPolElt, RngIntElt
Given a multivariate polynomial f in R[x_1, ..., x_n], this function returns true if and only if f is in fact a univariate polynomial in one of its indeterminates x_1, ..., x_n. If true is returned, then the function also returns a univariate version u of f and (the first) i such that f is univariate in x_i. Note that there will only be ambiguity about i if f is a constant polynomial. The univariate polynomial u will be an element of R[x] with the same coefficients as f.
IsUnivariate(f, i) : RngMPolElt, RngIntElt -> BoolElt, RngUPolElt
IsUnivariate(f, v) : RngMPolElt, RngMPolElt -> BoolElt, RngUPolElt
Given a multivariate polynomial f in R[x_1, ..., x_n], this function returns true if and only if f is in fact a univariate polynomial in x_i. If true is returned, then the function also returns a univariate version u of f, which will be an element of the univariate polynomial ring R[x] with the same coefficients as f. The indeterminate x_i should either be specified as a (polynomial) argument v or as an integer i.
UnivariatePolynomial(f) : RngMPolElt -> RngUPolElt
Given a multivariate polynomial f in R[x_1, ..., x_n], which is known to be a univariate polynomial in x_i for some i with 1 <= i <= n, return a univariate version u of f, which will be an element of the univariate polynomial ring R[x] with the same coefficients as f.

Coefficients, Monomials and Terms

Many of the functions in this section come in three different forms: one in which no variable is specified, which usually returns values in the coefficient ring, and two in which a particular variable is referred, either by name or by number, and these usually return values in the polynomial ring itself.

Coefficients(f) : RngMPolElt -> [ RngElt ]
Given a multivariate polynomial f with coefficients in R, this function returns a sequence of `base' coefficients, that is, a sequence of elements of R occurring as coefficients of the monomials in f. Note that the monomials are ordered, and that the sequence of coefficients corresponds exactly to the sequence of monomials returned by Monomials(f).
Coefficients(f, i) : RngMPolElt, RngIntElt -> [ RngElt ]
Coefficients(f, v) : RngMPolElt, RngMPolElt -> [ RngElt ]
Given a multivariate polynomial f in P = R[x_1, ..., x_n], this function returns a sequence of coefficients with respect to a given variable v=x_i, that is, the function returns a sequence of elements of P that form the coefficients of the powers of v (in ascending order) when f is regarded as a polynomial sum_j c_j x_i^j; note that the variable x_i itself will not occur in the coefficients. There are two ways to indicate with respect to which variable the coefficients are to be taken: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P).
Coefficient(f, i, k) : RngMPolElt, RngIntElt, RngIntElt -> RngElt
Coefficient(f, v, k) : RngMPolElt, RngMPolElt, RngIntElt -> RngElt
Given a multivariate polynomial f in P = R[x_1, ..., x_n], this function returns the coefficient of v^k=x_i^k, that is, the function returns the element of P that forms the coefficient of the k-th power of x_i, when f is regarded as a polynomial sum_j c_j x_i^j; note that the variable x_i itself will not occur in the coefficient. There are two ways to indicate with respect to which variable the coefficient is to be taken: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P).
LeadingCoefficient(f) : RngMPolElt -> RngElt
Given a multivariate polynomial f with coefficients in R, this function returns the leading coefficient of f as an element of R; this is the coefficient of the leading monomial of f, that is, the first among the monomials occurring in f with respect to the ordering of monomials used in P.
LeadingCoefficient(f, i) : RngMPolElt, RngIntElt -> RngElt
LeadingCoefficient(f, v) : RngMPolElt, RngMPolElt -> RngElt
Given a multivariate polynomial f in P = R[x_1, ..., x_n], this function returns the element of P that forms the coefficient of the largest power of v=x_i that occurs with non-zero coefficient in f, when f is regarded as a polynomial sum_j c_j x_i^j; note that the variable x_i itself will not occur in the coefficient. There are two ways to indicate with respect to which variable the leading coefficient is to be taken: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P).
Length(f) : RngMPolElt -> RngIntElt
Given a multivariate polynomial f, return the length of f, i.e., the number of terms of f.
TrailingCoefficient(f) : RngMPolElt -> RngElt
Given a multivariate polynomial f with coefficients in R, this function returns the trailing coefficient of f as an element of R; this is the coefficient of the trailing monomial of f, that is, the last among the monomials occurring in f with respect to the ordering of monomials used in P.
TrailingCoefficient(f, i) : RngMPolElt, RngIntElt -> RngElt
TrailingCoefficient(f, v) : RngMPolElt, RngMPolElt -> RngElt
Given a multivariate polynomial f in P = R[x_1, ..., x_n], this function returns the element of P that forms the coefficient of the least power of v=x_i that occurs with non-zero coefficient in f, when f is regarded as a polynomial sum_j c_j x_i^j; note that the variable x_i itself will not occur in the coefficient. There are two ways to indicate with respect to which variable the leading coefficient is to be taken: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P).
MonomialCoefficient(f, m) : RngMPolElt, RngMPolElt -> RngElt
Given a multivariate polynomial f and a monomial m, both in P in R[x_1, ..., x_n], this function returns the coefficient with which m occurs in f as an element of R.
Monomials(f) : RngMPolElt -> [ RngMPolElt ]
Given a multivariate polynomial f in P, this function returns a sequence of monomials, that is, a sequence of monomial elements of P occurring in f. Note that the monomials in P are ordered, and that the sequence of monomials corresponds exactly to the sequence of coefficients returned by Coefficients(f).
LeadingMonomial(f) : RngMPolElt -> RngMPolElt
Given a multivariate polynomial f in P this function returns the leading monomial of f, that is, the first monomial element of P that occurs in f, with respect to the ordering of monomials used in P.
Terms(f) : RngMPolElt -> [ RngMPolElt ]
Given a multivariate polynomial f in P, this function returns the sequence of (non-zero) terms of f as elements of P. The terms are ordered according to the ordering on the monomials in P. Consequently the i-th element of this sequence of terms will be equal to the product of the i-th element of the sequence of coefficients and the i-th element of the sequence of monomials.
Terms(f, i) : RngMPolElt, RngIntElt -> [ RngMPolElt ]
Terms(f, v) : RngMPolElt, RngMPolElt -> [ RngMPolElt ]
Given a multivariate polynomial f in P = R[x_1, ..., x_n], this function returns a sequence of terms with respect to a given variable v=x_i, that is, the function returns a sequence of elements of P that form the terms (ascending order) of f regarded as a polynomial sum_j c_j x_i^j. There are two ways to indicate with respect to which variable the terms are to be ordered: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P).
Term(f, i, k) : RngMPolElt, RngIntElt, RngIntElt -> RngMPolElt
Term(f, v, k) : RngMPolElt, RngMPolElt, RngIntElt -> RngMPolElt
Given a multivariate polynomial f in P = R[x_1, ..., x_n], this function returns the k-th term of f (with k >= 0), that is, the function returns the term of f involving the k-th power of x_i, when f is regarded as a polynomial sum_j c_j x_i^j. There are two ways to indicate with respect to which variable the term is to be taken: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P).
LeadingTerm(f) : RngMPolElt -> RngMPolElt
Given a multivariate polynomial f in P, this function returns the leading term of f as an element of P; this is the product of the leading monomial and the leading coefficient that is, the first among the monomial terms occurring in f with respect to the ordering of monomials used in P.
LeadingTerm(f, i) : RngMPolElt, RngIntElt -> RngMPolElt
LeadingTerm(f, v) : RngMPolElt, RngMPolElt -> RngMPolElt
Given a multivariate polynomial f in P = R[x_1, ..., x_n], this function returns the element of P that forms the leading term of f when f is regarded as a polynomial sum_j c_j x_i^j. Thus it is the term involving the largest power of x_i that occurs with non-zero coefficient. There are two ways to indicate with respect to which variable the leading coefficient is to be taken: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P).
TrailingTerm(f) : RngMPolElt -> RngElt
Given a multivariate polynomial f in P, this function returns the trailing term of f as an element of P; this is the last among the monomial terms occurring in f with respect to the ordering of monomials used in P.
TrailingTerm(f, i) : RngMPolElt, RngIntElt -> RngElt
TrailingTerm(f, v) : RngMPolElt, RngMPolElt -> RngElt
Given a multivariate polynomial f in P = R[x_1, ..., x_n], this function returns the element of P that forms the trailing term of f when f is regarded as a polynomial sum_j c_j x_i^j. Thus it is the term involving the least power of x_i that occurs with non-zero coefficient. There are two ways to indicate with respect to which variable the leading coefficient is to be taken: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P).

Example RngMPol_Coefficients (H29E4)

In this and the next example we illustrate the coefficient and term functions, using the polynomial in three variables x, y, z over the rational field that is given by f=(2x + y)z^3 + 11xyz + x^2y^2.

> R<x, y, z> := PolynomialAlgebra(RationalField(), 3);
> f := (2*x+y)*z^3+11*x*y*z+x^2*y^2;
> f;
x^2*y^2 + 11*x*y*z + 2*x*z^3 + y*z^3
> Coefficients(f);
[ 1, 11, 2, 1 ]
> Monomials(f);
[
   x^2*y^2,
   x*y*z,
   x*z^3,
   y*z^3
]
> Terms(f);
[
   x^2*y^2,
   11*x*y*z,
   2*x*z^3,
   y*z^3
]
> Coefficients(f, y);
[
   2*x*z^3,
   11*x*z + z^3,
   x^2
]
> Terms(f, 2);    
[
   2*x*z^3,
   11*x*y*z + y*z^3,
   x^2*y^2
]
> MonomialCoefficient(f, x*y*z);
11
> LeadingTerm(f);
x^2*y^2
> LeadingTerm(f, z);
2*x*z^3 + y*z^3
> LeadingCoefficient(f, z);
2*x + y

Degrees

Degree(f, i) : RngMPolElt, RngIntElt -> RngIntElt
Degree(f, v) : RngMPolElt, RngMPolElt -> RngIntElt
Given a multivariate polynomial f in P = R[x_1, ..., x_n], this function returns the degree of f in v^k=x_i^k, that is, the function returns the degree of f when it is regarded as a polynomial sum_j c_j x_i^j. The resulting integer is thus the largest power of x_i occurring in any monomial of f. There are two ways to indicate with respect to which variable the degree is to be taken: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P). If f is the zero polynomial, the return value is always -1.
TotalDegree(f) : RngMPolElt -> RngIntElt
Given a multivariate polynomial f in P = R[x_1, ..., x_n], this function returns the total degree of f, which is the maximum of the total degrees of all monomials that occur in f. The total degree of a monomial m is the sum of the exponents of the indeterminates that make up m. Note that this ignores the weights on the variables if there are any (see the section on graded polynomial rings below). If f is the zero polynomial, the return value is -1.
LeadingTotalDegree(f) : RngMPolElt -> RngIntElt
Given a multivariate polynomial f in P = R[x_1, ..., x_n], this function returns the leading total degree of f, which is the total degree of the leading monomial of f. If f is the zero polynomial, the return value is -1.

Derivative, Integral

Derivative(f, i) : RngMPolElt, RngIntElt -> RngMPolElt
Derivative(f, v) : RngMPolElt, RngMPolElt -> RngMPolElt
Given a multivariate polynomial f in P, return the derivative of f with respect to the variable v=x_i, as an element of P. There are two ways to indicate with respect to which variable the derivative is to be taken: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P).
Derivative(f, k, i) : RngMPolElt, RngIntElt -> RngMPolElt
Derivative(f, k, v) : RngMPolElt, RngMPolElt -> RngMPolElt
Given a multivariate polynomial f in P and an integer k > 0, return the k-th derivative of f with respect to the variable v=x_i, as an element of P. There are two ways to indicate with respect to which variable the derivative is to be taken: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P).
Integral(f, i) : RngMPolElt, RngIntElt -> RngMPolElt
Integral(f, v) : RngMPolElt, RngMPolElt -> RngMPolElt
Given a multivariate polynomial f in P over a field of characteristic zero, return the formal integral of f with respect to v=x_i as an element of P. There are two ways to indicate with respect to which variable the integral is to be taken: either one specifies i, the integer 1 <= i <= n that is the number of the variable (upon creation of P, corresponding to P.i) or the variable v itself (as an element of P).
JacobianMatrix ( [ f ] ) : [ RngMPolElt ] -> RngMPol
Creates the matrix with (i, j)'th entry the partial derivative of the i'th polynomial in the list with the j'th indeterminate of its parent ring.

Evaluation, Interpolation

Evaluate(f, s) : RngMPolElt, [ RngElt ] -> RngElt
Given an element f of a polynomial ring P=R[x_1, ..., x_n] and a sequence of ring elements s of length n, return the value of f at s, that is, obtained by taking x_i=s[i]. If the elements of s can be lifted into the coefficient ring R, then the result will be an element of R. If the elements of s cannot be lifted to the coefficient ring, then an attempt is made to do a generic evaluation of f at s. In this case, the result will be of the same type as the elements of s.
Evaluate(f, i, r) : RngMPolElt, RngMPolElt, RngElt -> RngMPolElt
Evaluate(f, v, r) : RngMPolElt, RngMPolElt, RngElt -> RngMPolElt
Given an element f of a multivariate polynomial ring P and a ring element r return the value of f when the variable v=x_i is evaluated at r. If r can be coerced into the coefficient ring of P, the result will be an element in P again. Otherwise the other variables of P must be coercible into the parent of r, and the result will have the same parent as r.
Interpolation(I, V, i) : [ RngElt ], [ RngMPolElt ], RngIntElt -> RngMPolElt
Interpolation(I, V, v) : [ RngElt ], [ RngMPolElt ], RngIntElt -> RngMPolElt
Let K be a field, and P=K[x_1, ..., x_n] a multivariate polynomial ring over K; let v=x_i be the i-th indeterminate of P. Given a sequence I of elements of K (the interpolation points) and a sequence V of elements of P (the interpolation values), both sequences of length k>0, return the unique polynomial f in P of degree less than k in the variable x_i such that f(I[j]) = V[j], for j=1, ..., k. The variable x_i may not occur anywhere in the values V. There are two ways to indicate with respect to which variable to interpolate: either one specifies i, the integer 1 <= i <= n that is the number of the variable or the variable v itself (as a polynomial).

Example RngMPol_Interpolate (H29E5)

We define P=Q[x, y, z], and give an example of interpolation. In the first we find a polynomial that, when evaluated in the first variable x in the rational points 1, 2, 3 yields y, z, y + z respectively. We check the result by evaluating.

> Q := RationalField();
> P<x, y, z> := PolynomialRing(Q, 3);
> f := Interpolation([Q | 1,2,3], [y,z,y+z], 1);
> f;
x^2*y - 1/2*x^2*z - 4*x*y + 5/2*x*z + 4*y - 2*z
> [ Evaluate(f, 1, v) : v in [1,2,3] ];
[
   y,
   z,
   y + z
]

Quotient and Reductum

f div g : RngMPolElt, RngMPolElt -> RngMPolElt
ExactQuotient(f, g) : RngMPolElt, RngMPolElt -> RngMPolElt
The quotient of the multivariate polynomial f by g in R[x_1, ..., x_n], provided the result lies in P again. Here R must be a domain. If a polynomial q in P exists such that f=q.g then it will be returned, but if does not exist an error results.
Reductum(f) : RngMPolElt -> RngMPolElt
The reductum of a polynomial f, which is the polynomial obtained by removing the leading term of f.
Reductum(f, i) : RngMPolElt, RngIntElt -> RngMPolElt
Reductum(f, v) : RngMPolElt, RngMPolElt -> RngMPolElt
The reductum of a multivariate polynomial f in R[x_1, ..., x_n] obtained by removing the leading term with respect to the variable v=x_i. Here either v must be specified as a polynomial, or x_i must be specified by providing the integer i, with 1 <= i <= n.
[Next] [Prev] [Right] [Left] [Up] [Index] [Root]