The categories for elements in univariate polynomial rings and their quotients are are RngUPolElt and RngUPolResElt
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.
The list belows contains the general ring element predicates. Note that not all functions are available for every coefficient ring.
The coefficients of the polynomial p in R[x] in ascending order, as a sequence of elements of R.
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.
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.
Return the coefficient of the highest occurring power of x in p in R[x], as an element of the coefficient ring R.
Return the coefficient of the lowest occurring power of x in p in R[x], as an element of the coefficient ring R.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Given a polynomial p in P, return the derivative of p as an element of P.
Given a polynomial p in P and an integer n >= 0, return the n-th derivative of p as an element of P.
Given a polynomial p in P over a field of characteristic zero, return the formal integral of p as an element of P.
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.
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.
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.
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.
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.
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.
The reductum of a polynomial f, which is the polynomial obtained by removing the leading term of f.
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).
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.
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]