poly2list
Convert a polynomial to a list of terms
MuPAD® notebooks will be removed in a future release. 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.
poly2list(p
) poly2list(f
, <vars
>)
poly2list(p)
returns a term list containing
the coefficients and exponent vectors of the polynomial p
.
The returned term list is a list where each element represents
a monomial of the polynomial with nonzero 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.
The following expressions define univariate polynomials. Thus the term lists contain exponents and not exponent vectors:
poly2list(2*x^100 + 3*x^10 + 4)
poly2list(2*x*(x + 1)^2)
Specification of a list of indeterminates allows to distinguish symbolic parameters from the indeterminates:
poly2list(a*x^2 + b*x + c, [x])
In this example the polynomial is bivariate, thus exponent vectors are returned:
poly2list((x*(y + 1))^2, [x, y])
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)))

A polynomial of
type 
 

A list of indeterminates of the polynomial: typically, identifiers or indexed identifiers 
List containing the coefficients and exponent vectors of the
polynomial. FAIL
is
returned if a given expression cannot be converted to a polynomial.