Divide polynomials
This functionality does not run in MATLAB.
divide(p
,q
, <[x]
>, <order
>,options
) divide(p
,q
, <[x_{1}, x_{2}, …]
>, <order
>,options
) divide(p
,q_{1}, q_{2}, …
, <order
>,options
)
divide(p, q)
divides polynomials or polynomial
expressions p
and q
. By default,
the function returns the quotient s and
the remainder r,
such that p = s q + r.
Here degree(r)
< degree(q).
divide
(p, q_{1}, q_{2}, q_{3},
…, q_{n})
divides a polynomial or a polynomial expression p
by
polynomials or polynomial expressions q_{1}, q_{2}, q_{3},
…, q_{n}.
The function returns the quotients s_{1}, s_{2}, s_{3},
…, s_{n} and
the remainder r
, such that p = s_{1} q_{1} + s_{2} q_{2} + s_{3} q_{3} +
… + s_{4} q_{4} + r.
Here the leading coefficient of the remainder r
cannot
be divided by the leading coefficients of any of divisors q_{1}, q_{2}, q_{3},
…, q_{n}.
divide(p, q)
divides the polynomial or polynomial
expression p
by the polynomial or polynomial expression q
.
Use the Quo
option to return the quotient only.
Use the Rem
option to return the remainder only.
The divide
function operates on polynomials or polynomial expressions.
Polynomials must be of the same type: their variables and coefficient rings must be identical.
When you call divide
for polynomial expressions, MuPAD^{®} internally
converts these expressions to polynomials. See the poly
function. If you
do not specify the list of indeterminates, divide
treats
all symbolic variables in the expressions as indeterminates. If the
expressions cannot be converted to polynomials, the divide
function
returns FAIL
. See Example 1.
If you call divide
for polynomials, it returns
polynomials. If you call divide
for polynomial
expressions, the function returns polynomial expressions. See Example 2.
If you divide polynomial expressions that contain more than
one variable, you can specify particular variables to be treated as
variables. The divide
function treats all other
variables as symbolic parameters. By default, divide
assumes
that all variables in polynomial expressions are variables, and none
of them is a symbolic parameter. See Example 3.
divide
(p, q_{1}, q_{2}, q_{3},
…, q_{n})
divides a polynomial or a polynomial expression p
by
polynomials or polynomial expressions q_{1}, q_{2}, q_{3},
…, q_{n}.
The function returns quotients s_{1}, s_{2}, s_{3},
…, s_{n} and
remainder r
, such that p = s_{1} q_{1} + s_{2} q_{2} + s_{3} q_{3} +
… + s_{4} q_{4} + r.
Here the leading coefficient of the remainder r
cannot
be divided by the leading coefficients of any of the divisors q_{1}, q_{2}, q_{3},
…, q_{n}.
See Example 6.
When dividing a polynomial by one or more polynomials, you can select the term ordering. The ordering accepts the following values:
LexOrder
sets the lexicographical
ordering.
DegreeOrder
sets the total degree
ordering. When using this ordering, MuPAD sorts the terms of
a polynomial according to the total degree of each term (the sum of
the exponents of the variables).
DegInvLexOrder
sets the total degree
inverse lexicographic ordering. When using this ordering, MuPAD sorts
the terms of a polynomial according to the total degree of each term
(the sum of the exponents of the variables). If the several terms
have equal total degrees, MuPAD sorts them using the inverse
lexicographic ordering.
your custom term ordering of type Dom::MonomOrdering
.
The coefficient ring of the polynomials must implement the "_divide"
method. MuPAD uses this method internally
to divide coefficients. If the coefficients cannot be divided, this
method must return FAIL
.
For polynomial expressions, divide
internally
calls the poly
function,
which converts an expression to a polynomial. If you do not specify
the indeterminate of an expression, MuPAD assumes that all variables
are indeterminates. For example, The divide
function
cannot divide the following polynomial expressions because it assumes
that both x
and y
are indeterminates:
divide(x/y, x)
If you specify that only x
is an indeterminate,
the result is:
divide(x/y, x, [x])
The divide
divides polynomials or polynomial
expressions. When you divide polynomials, the function returns polynomials:
divide(poly(x^3 + x + 1, [x]), poly(x^2 + x + 1, [x]))
When you divide polynomial expressions, MuPAD internally converts these expressions to polynomials, divides these polynomials, and then converts the result of division to polynomial expressions:
divide(x^3 + x + 1, x^2 + x + 1)
When dividing multivariate polynomials, you can specify the
list of variables. The divide
function assumes
all other variables are symbolic parameters. For example, divide the
following two polynomial expressions specifying that both x
and y
are
variables:
divide(x^2  2*x  y, y*x  1, [x, y])
Divide the same polynomial expressions specifying that only x
is
a variable. MuPAD assumes that y
is a symbolic
parameter:
divide(x^2  2*x  y, y*x  1, [x])
Now, divide these expressions specifying that only y
is
a variable. MuPAD assumes that x
is a symbolic
parameter:
divide(x^2  2*x  y, y*x  1, [y])
By default, the divide
function treats polynomial
expressions with more than one variable as multivariate polynomial
expressions. The function does not assume that any of the variables
are symbolic parameters:
divide(x^2  2*x  y, y*x  1)
By default, divide
returns the quotient and
the remainder of the division of polynomials:
divide(x^3 + x + 1, x^2 + x + 1)
To return the quotient only, use the Quo
option:
divide(x^3 + x + 1, x^2 + x + 1, Quo)
To return the remainder only, use the Rem
option:
divide(x^3 + x + 1, x^2 + x + 1, Rem)
Suppose, you want to get the result of the division only when
the exact division is possible. To return the quotient s
of
the exact division of polynomials or polynomial expressions, use the Exact
option:
divide(x^4 + 12*x^3 + 28*x^2 + 204*x + 187, x + 11, Exact)
When exact division without remainder is impossible, the divide
function
with the Exact
option returns FAIL
:
divide(x^4 + 12*x^3 + 28*x^2 + 204*x + 187, x + 12, Exact)
The divide
function allows you to divide
a polynomial (or polynomial expression) by multiple polynomials (or
polynomial expressions):
divide(4*x^4 + 2*x^2 + 1, x^3  x + 1, x  1)
When dividing a polynomial by multiple polynomials, you can select the term ordering:
divide(x^2+y^3+1, xy^2, y, LexOrder)
divide(x^2+y^3+1, xy^2, y, DegreeOrder)

Univariate or multivariate polynomials or polynomial expressions. 

Univariate or multivariate polynomials or polynomial expressions. 

The indeterminate of the polynomial: typically, an identifier or an indexed
identifier. 

The indeterminates of the polynomial: typically, identifiers or indexed
identifiers. 

The term ordering when dividing one multivariate polynomial
by one or more multivariate polynomials: 

Return the quotient 

Return the quotient 
Polynomial, a polynomial expression, a sequence of polynomials
or polynomial expressions, or the value FAIL
.
p
, q