This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Exponents of the leading term 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.


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


degreevec(p) returns a list with the exponents of the leading term of the polynomial p.

For a polynomial in the variables x1, x2, …, xn with the leading term x1e1x2e2 … xnen, the exponent vector [e1, e2, …, en] is returned.

degreevec returns a list of zeroes for the zero polynomial.

If the first argument f is not element of a polynomial domain, then degreevec converts the expression internally to a polynomial of type DOM_POLY via poly(f). If a list of indeterminates is specified, the polynomial poly(f, vars) is considered. FAIL is returned if f cannot be converted to a polynomial.


Example 1

The leading term of the following polynomial expression (with respect to the main variable x) is x4:

degreevec(x^4 + x^2*y^3 + 2, [x, y])

With the main variable y, the leading term is x2y3:

degreevec(x^4 + x^2*y^3 + 2, [y, x])

For polynomials of type DOM_POLY, the indeterminates are an integral part of the data type:

degreevec(poly(x^4 + x^2*y^3 + 2, [x, y])),
degreevec(poly(x^4 + x^2*y^3 + 2, [y, x]))

Example 2

For a univariate polynomial, the standard term orderings regard the same term as "leading":

degreevec(poly(x^2*z + x*z^3 + 1, [x]), LexOrder), 
degreevec(poly(x^2*z + x*z^3 + 1, [x]), DegreeOrder),
degreevec(poly(x^2*z + x*z^3 + 1, [x]), DegInvLexOrder)

In the multivariate case, different polynomial orderings may yield different leading exponent vectors:

degreevec(poly(x^2*z + x*z^3 + 1, [x, z])),
degreevec(poly(x^2*z + x*z^3 + 1, [x, z]), DegreeOrder)

degreevec(x^3 + x*y^2*z - 5*y^4, [x, y, z], LexOrder),
degreevec(x^3 + x*y^2*z - 5*y^4, [x, y, z], DegreeOrder),
degreevec(x^3 + x*y^2*z - 5*y^4, [x, y, z], DegInvLexOrder)

Example 3

The exponent vector of the zero polynomial is a list of zeroes:

degreevec(0, [x, y, z])



A polynomial of type DOM_POLY


A polynomial expression


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


The term ordering: either 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 nonnegative integers. FAIL is returned if the input cannot be converted to a polynomial.

Overloaded By

f, p

Was this topic helpful?