## `poly2list` -- convert a polynomial to a list of terms

#### Introduction

`poly2list(`p`)` returns a term list containing the coefficients and exponent vectors of the polynomial `p`.

#### Call(s)

`poly2list(p)`
`poly2list(f <, vars>)`

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

#### Returns

a list containing the coefficients and exponent vectors of the polynomial. `FAIL` is returned if a given expression cannot be converted to a polynomial.

#### Related Functions

`coeff`, `coerce`, `degree`, `degreevec`, `lcoeff`, `poly`, `tcoeff`

#### Details

- The returned term list is a list where each element represents a monomial of the polynomial with non-zero coefficient. The monomials are also represented as lists, each containing two elements: The first element is the coefficient and the second the exponent or exponent vector of the monomial. If the polynomial is univariate, exponents are returned, otherwise exponent vectors are returned. Exponent vectors have the same form as returned by the function `degreevec`. A zero polynomial results in an empty list.

- The elements of the term list are sorted lexicographically according to the exponent vectors. This is also the ordering used internally for the terms of polynomials.
- `poly2list``(f, vars)` is equivalent to `poly2list``(poly(f, vars))`: First, the polynomial expression `f` is converted to a polynomial in the variables `vars` over the expressions. Then that polynomial is converted to a term list. If the variables `vars` are not given, the free identifiers contained in `f` are used as variables. See `poly` about details on how the expression is converted to a polynomial. `FAIL` is returned if the expression cannot be converted to a polynomial.
- `poly2list` is a function of the system kernel.

#### Example 1

The following expressions define univariate polynomials. Thus the term lists contain exponents and not exponent vectors:

    >> poly2list(2*x^100 + 3*x^10 + 4)

                            [[2, 100], [3, 10], [4, 0]]

    >> poly2list(2*x*(x + 1)^2)

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

Specification of a list of indeterminates allows to distinguish symbolic parameters from the indeterminates:

    >> poly2list(a*x^2 + b*x + c, [x])

                             [[a, 2], [b, 1], [c, 0]]

#### Example 2

In this example the polynomial is bivariate, thus exponent vectors are returned:

    >> poly2list((x*(y + 1))^2, [x, y])

                      [[1, [2, 2]], [2, [2, 1]], [1, [2, 0]]]

#### Example 3

In this example a polynomial of domain type `DOM_POLY` is given. This form must be used if the polynomial has coefficients that does not consist of expressions:

    >> poly2list(poly(-4*x + 5*y - 5, [x, y], IntMod(7)))

                     [[3, [1, 0]], [-2, [0, 1]], [2, [0, 0]]]

#### Changes

- no changes

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