Sorted list of monomials of a polynomial
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
monomials(p
, <order
>) monomials(f
, <vars
>, <order
>)
monomials(p, order)
returns the list of nonzero
monomials of the polynomial p
. The list is sorted
with respect to the term ordering order
.
monomials
returns a list of all nontrivial
monomials of the polynomial given. The monomials are sorted according
to the term ordering given. The list is empty if the polynomial is
zero.
A polynomial expression f
is first converted
to a polynomial with the variables given by vars
.
If no variables are given, they are searched for in f
.
See poly
about
details of the conversion. The result is returned as list of polynomial
expressions. FAIL
is
returned if f
cannot be converted to a polynomial.
The result of monomials
is not fully evaluated.
It can be evaluated by the functions mapcoeffs
and eval
. Cf. Example 4.
We give some self explaining examples:
p := poly(100*x^100 + 49*x^49 + 7*x^7, [x]): monomials(p)
monomials(poly(0, [x]))
delete p:
We demonstrate the effect of various term orders:
p := poly(5*x^4 + 4*x^3*y*z^2 + 3*x^2*y^3*z + 2, [x, y, z]): monomials(p)
monomials(p, DegreeOrder)
monomials(p, DegInvLexOrder)
delete p:
This example features a user defined term ordering. Here we use the reverse lexicographical order on 3 indeterminates:
order := Dom::MonomOrdering(RevLex(3)): p := poly(5*x^4 + 4*x^3*y*z^2 + 3*x^2*y^3*z + 2, [x, y, z]): monomials(p, order)
delete order, p:
We demonstrate the evaluation strategy of monomials
:
p := poly(3*x^3 + 6*x^2*y^2 + 2, [x]): y := 4: monomials(p)
Evaluation is enforced by eval
:
map(%, mapcoeffs, eval)
delete p, y:

A polynomial of
type 
 

A list of indeterminates of the polynomial: typically, identifiers or indexed identifiers 

The term ordering: 
List of polynomials of the same type as p
.
A list of expressions is returned if an expression is given. The list
is empty if the polynomial is zero.
p