## `degreevec` -- the exponents of the leading term of a polynomial

#### Introduction

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

#### Call(s)

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

#### Parameters

`p` | - | a polynomial of type `DOM_POLY`
`order` | - | 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.
`f` | - | a polynomial expression
`vars` | - | a list of indeterminates of the polynomial: typically, identifiers or indexed identifiers

#### Returns

a list of nonnegative integers. `FAIL` is returned if the input cannot be converted to a polynomial.

### Overloadable:

`p`, `f`

#### Related Functions

`coeff`, `degree`, `ground`, `lcoeff`, `ldegree`, `lmonomial`, `lterm`, `nterms`, `nthcoeff`, `nthmonomial`, `nthterm`, `poly`, `poly2list`, `tcoeff`

#### Details

- 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.
- For a polynomial in the variables x1, x2, .. with the leading term x1^e1*x2^e2*..., the exponent vector [e1, e2, ..] is returned.
- `degreevec` returns a list of zeroes for the zero polynomial.
- For the orderings LexOrder, DegreeOrder and DegInvLexOrder, the result is computed by a fast kernel function. Other orderings are handled by slower library functions.

#### Example 1

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

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

                                      [4, 0]

With the main variable `y`, the leading term is x^2y^3:

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

                                      [3, 2]

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]))

                                  [4, 0], [3, 2]

#### 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)

                                   [2], [2], [2]

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)

                                  [2, 1], [1, 3]

    >> 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)

                          [3, 0, 0], [1, 2, 1], [0, 4, 0]

#### Example 3

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

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

                                     [0, 0, 0]

#### Changes

- Now it is possible to specify user defined term orderings.
- In previous MuPAD releases, `degreevec` was a kernel function.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000