Polynomial Pseudo-Division
Date: 2020-10-07 18:10:00

Up | Next | Prev | PrevTail | Tail

### 9.7 Polynomial Pseudo-Division

The polynomial division discussed above is normally most useful for a univariate polynomial over a ﬁeld, otherwise the division is likely to fail giving trivially a zero quotient and a remainder equal to the dividend. (A ring of univariate polynomials is a Euclidean domain only if the coeﬃcient ring is a ﬁeld.) For example, over the integers:

divide(x^2 + y^2, 2(x - y));
2 2
{0,x + y }

The division of a polynomial u(x) of degree m by a polynomial v(x) of degree n ≤ m can be performed over any commutative ring with identity (such as the integers, or any polynomial ring) if the polynomial u(x) is ﬁrst multiplied by lc(v,x)m−n+1 (where lc denotes the leading coeﬃcient). This is called pseudo-division. The polynomial pseudo-division operators pseudo_divide, pseudo_quotient (or pseudo_div) and pseudo_remainder are implemented as preﬁx operators (only). When multivariate polynomials are pseudo-divided it is important which variable is taken as the main variable, because the leading coeﬃcient of the divisor is computed with respect to this variable. Therefore, if this is allowed to default and there is any ambiguity, i.e. the polynomials are multivariate or contain more than one kernel, the pseudo-division operators output a warning message to indicate which kernel has been selected as the main variable – it is the ﬁrst kernel found in the internal forms of the dividend and divisor. (As usual, the warning can be turned oﬀ by setting the switch msg to oﬀ.) For example

pseudo_divide(x^2 + y^2, x - y);
*** Main division variable selected is x
2
{x + y,2*y }
pseudo_divide(x^2 + y^2, x - y, x);
2
{x + y,2*y }
pseudo_divide(x^2 + y^2, x - y, y);
2
{ - (x + y),2*x }

If the leading coeﬃcient of the divisor is a unit (invertible element) of the coeﬃcient ring then division and pseudo-division should be identical, otherwise they are not, e.g.

divide(x^2 + y^2, 2(x - y));
2 2
{0,x + y }
pseudo_divide(x^2 + y^2, 2(x - y));
*** Main division variable selected is x
2
{2*(x + y),8*y }

The pseudo-division gives essentially the same result as would division over the ﬁeld of fractions of the coeﬃcient ring (apart from the overall factors [contents] of the quotient and remainder), e.g.

on rational;
divide(x^2 + y^2, 2(x - y));
1 2
{---*(x + y),2*y }
2
pseudo_divide(x^2 + y^2, 2(x - y));
*** Main division variable selected is x
2
{2*(x + y),8*y }

Polynomial division and pseudo-division can only be applied to what REDUCE regards as polynomials, i.e. rational expressions with denominator 1, e.g.

off rational;
pseudo_divide((x^2 + y^2)/2, x - y);
2 2
x + y
***** --------- invalid as polynomial
2

Pseudo-division is implemented in the polydiv package using an algorithm (D. E. Knuth 1981, Seminumerical Algorithms, Algorithm R, page 407) that does not perform any actual division at all (which proves that it applies over a ring). It is more eﬃcient than the naive algorithm, and it also has the advantage that it works over coeﬃcient domains in which REDUCE may not be able to perform in practice divisions that are possible mathematically. An example of this is coeﬃcient domains involving algebraic numbers, such as the integers extended by , as illustrated in the ﬁle polydiv.tst.

The implementation attempts to be reasonably eﬃcient, except that it always computes the quotient internally even when only the remainder is required (as does the standard remainder operator).

Up | Next | Prev | PrevTail | Front