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

Element Operations

The categories for elements in univariate polynomial rings and their quotients are are RngUPolElt and RngUPolResElt

Subsections

Parent and Category

Parent(p) : RngUPolElt -> RngUPol
Category(p) : RngUPolElt -> Cat

Arithmetic Operators

The usual unary and binary ring operations are available for univariate 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 operators div and mod give results corresponding to the quotient and the remainder of division of the arguments. See the section on quotient and remainder for details.

+ a : RngUPolElt -> RngUPolElt
- a : RngUPolElt -> RngUPolElt
a + b : RngUPolElt, RngUPolElt -> RngUPolElt
a - b : RngUPolElt, RngUPolElt -> RngUPolElt
a * b : RngUPolElt, RngUPolElt -> RngUPolElt
a ^ k : RngUPolElt, RngIntElt -> RngUPolElt
a / b : RngUPolElt, RngElt -> FldFunUElt
a div b : RngUPolElt, RngUPolElt -> RngUPolElt
a mod b : RngUPolElt, RngUPolElt -> RngUPolElt
a +:= b : RngUPolElt, RngUPolElt -> RngUPolElt
a -:= b : RngUPolElt, RngUPolElt -> RngUPolElt
a *:= b : RngUPolElt, RngUPolElt -> RngUPolElt

Equality and Membership

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

Predicates on Ring Elements

The list belows contains the general ring element predicates. Note that not all functions are available for every coefficient ring.

IsZero(a) : RngUPolElt -> BoolElt
IsOne(a) : RngUPolElt -> BoolElt
IsMinusOne(a) : RngUPolElt -> BoolElt
IsNilpotent(a) : RngUPolElt -> BoolElt
IsIdempotent(a) : RngUPolElt -> BoolElt
IsUnit(a) : RngUPolElt -> BoolElt
IsZeroDivisor(a) : RngUPolElt -> BoolElt
IsRegular(a) : RngUPolElt -> BoolElt
IsIrreducible(a) : RngUPolElt -> BoolElt
IsPrime(a) : RngUPolElt -> BoolElt

Coefficients and Terms

Coefficients(p) : RngUPolElt -> [ RngElt ]
ElementToSequence(p) : RngUPolElt -> [ RngElt ]
Eltseq(p) : RngUPolElt -> [ RngElt ]
The coefficients of the polynomial p in R[x] in ascending order, as a sequence of elements of R.
Coefficient(p, i) : RngUPolElt, RngIntElt -> RngElt
Given a polynomial p in R[x] and an integer i >= 0, return the coefficient of the i-th power of x in f. (If i exceeds the degree of f then zero is returned.) The return value is an element of R.
MonomialCoefficient(p, m) : RngUPolElt, RngUPolElt -> RngElt
Given elements f and m of a polynomial ring P=R[x], where m is a monomial (that is, has exactly one non-zero base coefficient, which must be 1), return the coefficient of m in f, as an element of the coefficient ring R.
LeadingCoefficient(f) : RngUPolElt -> RngElt
Return the coefficient of the highest occurring power of x in p in R[x], as an element of the coefficient ring R.
TrailingCoefficient(p) : RngUPolElt -> RngElt
Return the coefficient of the lowest occurring power of x in p in R[x], as an element of the coefficient ring R.
Terms(p) : RngUPolElt -> [ RngUPolElt ]
Return the non-zero terms of the polynomial p in P=R[x] in ascending order with respect to the degree, as a sequence of elements of P with ascending degrees.
LeadingTerm(p) : RngUPolElt -> RngUPolElt
Return the term of p in P= R[x] with the highest occurring power of x, as an element of P. The coefficient of the result will be the leading coefficient of p.
TrailingTerm(p) : RngUPolElt -> RngUPolElt
Return the term of p in P= R[x] with the lowest occurring power of x, as an element of P. The coefficient of the result will be the trailing coefficient of p.
Round(p) : RngUPolElt -> RngUPolElt
Given a polynomial p in P= R[x] where R is a subring of the real field (the ring of integers Z, the rational field Q, or a real field), return the polynomial in Z[x] obtained from p by rounding all the coefficients of p.

Degree

Degree(p) : RngUPolElt -> RngIntElt
The degree of a polynomial p in R[x] that is, the exponent of the largest power of x that occurs with non-zero coefficient. Note that the zero polynomial will have degree -1.

Roots

Roots(p) : RngUPolElt -> [ < RngElt, RngIntElt> ]
Given a polynomial p over one of a certain collection of coefficient rings, this function returns a sequence of pairs of coefficient ring element and integer, where the ring element is a root of p in the coefficient ring, and the integer its multiplicity. Currently the coefficient rings that are allowed comprise complex and real fields, integers and rationals, finite fields and residue class rings with prime modulus.
Roots(p, S) : RngUPolElt -> [ < RngElt, RngIntElt> ]
Given a polynomial p over one of a certain collection of coefficient rings as well as a ring S into which the coefficients of p can be coerced automatically, this function returns a sequence of pairs of ring element and integer, where the ring element is a root of p in the ring S, and the integer its multiplicity. Currently the coefficient rings that are allowed comprise complex and real fields, integers and rationals, finite fields and residue class rings with prime modulus.
HasRoot(p) : RngUPolElt -> BoolElt, RngElt
Given a polynomial p over the coefficient ring R this function returns true iff p has a root in R. If the result is true, the function also returns a root of p as a second return value. Currently the coefficient rings that are allowed comprise complex and real fields, integers and rationals, finite fields and residue class rings with prime modulus. Note that particularly for finite fields, this method may be much faster than the computation of all roots of the polynomial.
HasRoot(p, S) : RngUPolElt, Rng -> BoolElt, RngElt
Given a polynomial p over the coefficient ring R and a ring S which contains R, this function returns true iff p has a root in S. If the result is true, the function also returns a root of p in S as a second return value. Currently the coefficient rings that are allowed comprise complex and real fields, integers and rationals, finite fields and residue class rings with prime modulus. Note that particularly for finite fields, this method may be much faster than the computation of all roots of the polynomial.

Derivative, Integral

Derivative(p) : RngUPolElt -> RngUPolElt
Given a polynomial p in P, return the derivative of p as an element of P.
Derivative(p, n) : RngUPolElt, RngIntElt -> RngUPolElt
Given a polynomial p in P and an integer n >= 0, return the n-th derivative of p as an element of P.
Integral(p) : RngUPolElt -> RngUPolElt
Given a polynomial p in P over a field of characteristic zero, return the formal integral of p as an element of P.

Evaluation, Interpolation

Evaluate(p, r) : RngUPolElt, RngElt -> RngElt
Given an element p of a polynomial ring P and an element r of a ring S, return the value of p evaluated at r. If r can be coerced into the coefficient ring R of P, the result will be an element of R. If r cannot be coerced to the coefficient ring, then an attempt is made to do a generic evaluation of p at r. In this case, the result will be an element of S.
Interpolation(I, V) : [ RngElt ], [ RngElt ] -> RngUPolElt
This function finds a univariate polynomial that evaluates to the values V in the interpolation points I. Let K be a field and n>0 an integer; given sequences I and V, both consisting of n elements of K, return the unique univariate polynomial p over K of degree less than n such that p(I[i]) = V[i] for each 1 <= i <= n.

Quotient and Remainder

Quotrem(f, g) : RngUPolElt, RngUPolElt -> RngUPolElt, RngUPolElt
Given elements f and g of the polynomial ring P=R[x], this function returns polynomials q (quotient) and r (remainder) in P such that f = q.g + r, and the degree of r is minimal. The leading coefficient of g has to be a non-zero divisor in R. If the leading coefficient of g is a unit, then the degree of r will be strictly less than that of g (taking the degree of 0 to be -1). Over the integers (R=Z) this will be true in general when the leading coefficient of g divides that of f.
f div g : RngUPolElt, RngUPolElt -> RngUPolElt
The quotient q of f by g, where f and g are in the polynomial ring P=R[x]. Magma calculates the polynomials q (quotient) and r (remainder) in P such that f = q * g + r, and the degree of r is minimal. The leading coefficient of g has to be a unit. If the leading coefficient of g is a unit in R, then the degree of r will be strictly less than that of g (taking the degree of 0 to be -1). Over the integers (R=Z) this will be true in general when the leading coefficient of g divides that of f.

To find r, use mod, and to find both q and r, use Quotrem.

ExactQuotient(f, g) : RngUPolElt, RngUPolElt -> RngUPolElt
Assuming that the polynomial f is exactly divisible by the polynomial g, return the exact quotient of f by g (as a polynomial in the same polynomial ring). An error results if g does not divide f exactly.
f mod g : RngUPolElt, RngUPolElt -> RngUPolElt
The remainder r upon division of f by g, where f and g are in the polynomial ring P=R[x]. Magma calculates the polynomials q (quotient) and r (remainder) in P such that f = q * g + r, and the degree of r is minimal. The leading coefficient of g has to be a non-zero divisor. If the leading coefficient of g is a unit in R, then the degree of r will be strictly less than that of g (taking the degree of 0 to be -1). Over the integers (R=Z) this will be true in general when the leading coefficient of g divides that of f.

To find q, use div, and to find both q and r, use Quotrem.

Reductum(f) : RngUPolElt -> RngUPolElt
The reductum of a polynomial f, which is the polynomial obtained by removing the leading term of f.
PseudoRemainder(f, g) : RngUPolElt, RngUPolElt -> RngUPolElt
Given polynomials f, g in P=R[x], where R is an integral domain, this function returns the pseudo-remainder r of f and g defined as follows. Let d be the maximum of 0 and deg(f) - deg(g) + 1, and let c be the leading coefficient of g; then r will be the unique polynomial in P such that c^d.f=q.g + r and the degree of r is less than that of g (possibly -1 for r=0).
EuclideanNorm(p) : RngUPol -> RngIntElt
Return the Euclidean norm of the univariate polynomial p in P, where the Euclidean norm is the function that makes P into a Euclidean ring, which is the degree function.

Modular Arithmetic

The following functions allow modular arithmetic for univariate polynomials over a field without the need to move into the quotient ring. See also the description of mod in the section on quotient and remainder.

Modexp(f, n, g) : RngUPolElt, RngIntElt, RngUPolElt -> RngUPolElt
Given univariate polynomials f and g in K[x] over a field K, return f^n mod g as an element of K[x]. Here n must be a non-negative integer, and g is allowed to be a constant polynomial.
[Next] [Prev] [Right] [Left] [Up] [Index] [Root]