monomials

Sorted list of monomials of a polynomial

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

monomials(p, <order>)
monomials(f, <vars>, <order>)

Description

monomials(p, order) returns the list of non-zero monomials of the polynomial p. The list is sorted with respect to the term ordering order.

monomials returns a list of all non-trivial 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.

Examples

Example 1

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:

Example 2

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:

Example 3

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:

Example 4

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:

Parameters

p

A polynomial of type DOM_POLY

f

A polynomial expression

vars

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

order

The term ordering: LexOrder, or DegreeOrder, or DegInvLexOrder, or a user-defined term ordering of type Dom::MonomOrdering. The default is the lexicographical ordering LexOrder.

Return Values

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.

Overloaded By

p

Was this topic helpful?