poly2list
-- convert a
polynomial to a list of termspoly2list(
p)
returns a term list
containing the coefficients and exponent vectors of the polynomial
p
.
poly2list(p)
poly2list(f <, vars>)
p |
- | a polynomial of type
DOM_POLY |
f |
- | a polynomial expression |
vars |
- | a list of indeterminates of the polynomial: typically, identifiers or indexed identifiers |
a list containing the coefficients and exponent vectors of the
polynomial. FAIL
is
returned if a given expression cannot be converted to a polynomial.
coeff
, coerce
, degree
, degreevec
, lcoeff
, poly
, tcoeff
degreevec
. A zero polynomial
results in an empty list.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.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]]
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]]]
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]]]