
divide - divides polynomials

Calling sequence:
divide(poly_1, poly_2 [ , opt ])
divide(expr_1, expr_2 [ , indets ]  [ , opt ])
indets  ---> [ expr ...]

Parameter:
poly_1, poly_2          --  polynomials
expr, expr_1, expr_2    --  expressions
opt                     --  one of the options Quo, Rem or Exact

Overloading:

1,2

Summary:

divide(p,q) divides the univariate polynomial p by the polynomial q. If no
option is given then the quotient s and the remainder r are calculated such
that p = s q + r. The sequence consisting of the quotient s and the remainder
r is returned. The function returns FAIL if division is not possible.

 o  If the identifier Quo is given as the option opt then only the quotient s
    is calculated.

  o  If the identifier Rem is given as option then only the remainder r is
     returned.

divide(p,q,Exact) divides the multivariate polynomial p by q. The quotient
p/q is returned as the result. If p cannot be divided by q then the function
returns FAIL.

If the arguments are polynomials with coefficients from a domain  then this
domain must contain the method divex ("divide exact\). With this method
the coefficients are then divided. If the domain elements cannot be divided
then the method must return FAIL.

The first two arguments can be either polynomials or expressionsand optionally
a listof variables. If the arguments are expressions, these are converted into
polynomials (see function poly).  divide returns FAIL if the expressions
cannot be converted. Both polynomials must be of the same type, i.e. their
variables and coefficient rings must be identical.  The result has the same
type as the first two arguments. divide is a kernel function.

>>  divide(x^3+x+1, x^2+x+1);

      x - 1, x + 2

>>  divide(a*x^3+x+1, x^2+x+1, [x], Quo);

      a*x - a

>>  divide(a*x^3+x+1, x^2+x+1, [x], Rem);

      x + a + 1

>>  p := poly(x^2-x*y-x+y, [x,y]): q := poly(x-1, [x,y]):
    divide(p, q, Exact);

      poly(x-y, [x,y])

See also:  content , multcoeffs , pdivide , poly

