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) returns a term list containing
the coefficients and exponent vectors of the polynomial
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
vars)): First, the polynomial expression
converted to a polynomial in the variables
the expressions. Then that polynomial is converted to a term list.
If the variables
vars are not given, the free identifiers
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)))
List containing the coefficients and exponent vectors of the
returned if a given expression cannot be converted to a polynomial.