polynomialReduce

Remainder (and quotients) of dividing a polynomial by a set of polynomials.

Category: Mathematics > Polynomials

Syntax

r = polynomialReduce(p, G)

Remainder of p divided by the polynomials G.

[r, q] = polynomialReduce(p, G, vars)

Also returns the quotients, for the variables vars.

Description

The function performs multivariate polynomial division. With a single variable and a single divisor it is ordinary long division: x^3 + 1 divided by x + 2 leaves the remainder -7 and the quotient x^2 - 2*x + 4. With several divisors the remainder can depend on the order of the divisors unless G is a Groebner basis (see gbasis).

The remainder is the first output, followed by the quotients.

Input arguments

p
Symbolic polynomial to divide.
G
Divisor or vector of divisors.
vars
Variables of the polynomials (optional).

Output arguments

r
The remainder, a polynomial none of whose terms is divisible by a leading term of G.
q
Quotients, such that p = sum(q.*G) + r.

Example

Division by x + 2

syms x
[r, q] = polynomialReduce(x^3 + 1, x + 2)
polynomialReduce(x^3 + x, x^2 + 1)
Output
r = -7
q = x^2 - 2*x + 4
ans = 0

See also

gbasis deconv quorem resultant