PolynomialTools
FromCoefficientVector
return a univariate polynomial from a Vector of coefficients
FromCoefficientList
return a univariate polynomial from list of coefficients
Calling Sequence
Parameters
Options
Description
Examples
FromCoefficientList(L, x, opts)
FromCoefficientVector(L, x, opts)
L
-
list of coefficients
x
name for the polynomial variable
opts
(optional) equations of the form option=value (see below)
termorder = forward, reverse
By default, the first entry of the output will be the constant coefficient of the polynomial. If reverse is specified, the last entry of the output will be the constant coefficient.
form = monomial, horner
The polynomial is constructed in standard monomial form by default, but can be created in Horner form also known as nested multiplication form.
The FromCoefficientList(L, x) calling sequence returns a polynomial in x from a list of coefficients.
The FromCoefficientVector(L, x) calling sequence returns a polynomial in x from a vector of coefficients.
These are inverse commands to CoefficientList and CoefficientVector.
FromCoefficientVector is written to handle sparse Vector inputs efficiently.
with(PolynomialTools):
FromCoefficientList([1,-1,2,3],x);
3⁢x3+2⁢x2−x+1
FromCoefficientList([1,-1,2,3],x,form=horner);
x⁢−1+x⁢2+3⁢x+1
FromCoefficientList([1,0,0,2,0],x,termorder=reverse);
x4+2⁢x
FromCoefficientVector(<y^3,-y^2,y-2,1>,x);
y3−y2⁢x+y−2⁢x2+x3
FromCoefficientList([],x);
0
FromCoefficientVector(CoefficientVector(0,x),x);
Most vector shapes will be handled efficiently
v1 := Vector(500000001,shape=unit[300]):
FromCoefficientVector(v1,x);
x300
v2 := Vector(200000001,shape=scalar[50000,a]):
FromCoefficientVector(v2,x);
a⁢x50000
v3 := Vector(10, shape=constant[b^2-1]):
FromCoefficientVector(v3,x);
b2−1⁢x9+x8+x7+x6+x5+x4+x3+x2+x+1
v4 := Vector(1000000001,{(1) = 5, (1000000001) = 1},storage = sparse):
FromCoefficientVector(v4,x);
x1000000000+5
See Also
convert,horner
PolynomialTools[CoefficientVector]
Vector
Download Help Document
What kind of issue would you like to report? (Optional)