pdivide -- pseudo-division of
polynomials
Introductionpdivide(p, q) computes the pseudo-division
of the univariate polynomials p and q.
Call(s)pdivide(p, q <, mode>)
pdivide(f, g <, [x]> <, mode>)
Parametersp, q |
- | univariate polynomials of
type DOM_POLY. |
f, g |
- | arithmetical expressions |
x |
- | an identifier or an indexed identifier. Multivariate expressions are
regarded as univariate polynomials in the indeterminate
x. |
Optionsmode |
- | either Quo or Rem. With Quo, only the pseudo-quotient is returned; with Rem, only the pseudo-remainder is returned. |
Returnsa polynomial, or a polynomial expression, or a sequence of an
element of the coefficient ring of the input polynomials and two
polynomials/polynomial expressions, or the value FAIL.
p, q, f, g
Related
Functionscontent, degree, divide, factor, gcd, gcdex, ground, lcoeff, multcoeffs, poly
Detailspdivide(p, q) computes the
pseudo-division of the univariate polynomials p and
q. It returns the sequence b, s, r, where
b = lcoeff(q)^(degree(p) - degree(q) + 1) is an element of
the coefficient ring of the polynomials. The polynomials s
(the pseudo-quotient) and r (the pseudo-remainder) satisfy
b*p = s*q + r, degree(p)
= degree(s) +
degree(q), degree(r)
< degree(q).Polynomials must be of the same type, i.e., their variables and coefficient rings must be identical.
Expressions are internally converted to polynomials (see the
function poly). If no
indeterminate x is specified, all symbolic variables in
the expressions are regarded as indeterminates. FAIL is
returned if more than one indeterminate is found. FAIL is
also returned if the expressions cannot be converted to
polynomials.
The resulting polynomials have the same type as the first two
arguments, i.e., they are either polynomials of type DOM_POLY or polynomial
expressions.
divide, pdivide does not
require that the coefficient ring of the polynomials implements a
"_divide" slot: coefficients are
not divided in this algorithm.pdivide is a function of the system kernel.
Example
1This example shows the result of the pseudo-division of two polynomials:
>> p:= poly(x^3 + x + 1): q:= poly(3*x^2 + x + 1): [b, s, r] := [pdivide(p, q)]
[9, poly(3 x - 1, [x]), poly(7 x + 10, [x])]
The result satisfies the following equation:
>> multcoeffs(p, b) = s*q + r
3 3
poly(9 x + 9 x + 9, [x]) = poly(9 x + 9 x + 9, [x])
Pseudo-quotients and pseudo-remainders can be computed separately:
>> pdivide(p, q, Quo), pdivide(p, q, Rem)
poly(3 x - 1, [x]), poly(7 x + 10, [x])
>> delete p, q, b, s, r:
Example
2The coefficient ring can be an arbitrary ring, e.g., the residue class ring of integers modulo 8:
>> pdivide(poly(x^3 + x + 1, IntMod(8)),
poly(3*x^2 + x + 1, IntMod(8)))
1, poly(3 x - 1, [x], IntMod(8)), poly(- x + 2, [x], IntMod(8))
Example
3Here the input consists of multivariate polynomial
expressions which are regarded as univariate polynomials in
x:
>> pdivide(x^3 + x + y, a*x^2 + x + 1, [x])
2 2
a , a x - 1, a y + x (a (a - 1) + 1) + 1
Example
4The first argument cannot be converted to a polynomial.
The return value is FAIL:
>> pdivide(1/x, x)
FAIL