## `pdivide` -- pseudo-division of polynomials

#### Introduction

`pdivide(`p, q`)` computes the pseudo-division of the univariate polynomials `p` and `q`.

#### Call(s)

`pdivide(p, q <, mode>)`
`pdivide(f, g <, [x]> <, mode>)`

#### Parameters

`p, 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`.

#### Options

`mode` | - | either Quo or Rem. With Quo, only the pseudo-quotient is returned; with Rem, only the pseudo-remainder is returned.

#### Returns

a 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`.

### Overloadable:

`p`, `q`, `f`, `g`

#### Related Functions

`content`, `degree`, `divide`, `factor`, `gcd`, `gcdex`, `ground`, `lcoeff`, `multcoeffs`, `poly`

#### Details

- `pdivide(`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).
- The first two arguments can be either polynomials or arithmetical expressions.

  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.

- In contrast to `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 1

This 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 2

The 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 3

Here 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 4

The first argument cannot be converted to a polynomial. The return value is `FAIL`:

    >> pdivide(1/x, x)

                                       FAIL

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000