PolynomialTools[CoefficientVector] - return a Vector of coefficients from a univariate polynomial
PolynomialTools[CoefficientList] - return a list of coefficients from a univariate polynomial
|
Calling Sequence
|
|
CoefficientVector(p, x, vectoropts, orderopts)
CoefficientList(p, x, orderopts)
|
|
Parameters
|
|
p
|
-
|
polynom(anything, x)
|
x
|
-
|
name of main variable
|
vectoropt
|
-
|
(optional) a sequence of Vector constructor options; see Vector
|
orderopts
|
-
|
(optional) equation of the form termorder=reverse or termorder=forward
|
|
|
|
|
Description
|
|
•
|
The CoefficientVector(p, x) calling sequence returns a Vector of coefficients from a polynomial p in x.
|
•
|
The CoefficientList(p, x) calling sequence returns a list of coefficients from a polynomial p in x.
|
•
|
If the term order is not specified or termorder=forward, for , the k-th element of the Vector or list returned corresponds to .
|
•
|
If termorder=reverse is specified, then the coefficients will be stored in the reverse of the above order.
|
•
|
These commands are useful because the Maple command coeff is of linear complexity in the degree of the polynomial. Thus, a naive implementation of CoefficientVector would be of quadratic complexity. The actual implementation is of linear complexity. In fact, for CoefficientVector, if sparse storage is specified as an option, the complexity is linear in the actual number of terms.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
•
|
For the zero polynomial, the CoefficientVector command returns a zero-dimensional Vector and the CoefficientList command returns an empty list.
|
>
|
|
| (7) |
>
|
|
| (8) |
•
|
Non-expanded polynomials will also work but since collect will be called on them, this could be inefficient.
|
>
|
|
>
|
|
| (9) |
•
|
The coefficients of the polynomial do not have to be numbers.
|
>
|
|
| (10) |
|
|
Download Help Document
Was this information helpful?