PolynomialTools - Maple Programming Help

Home : Support : Online Help : Mathematics : Algebra : Polynomials : PolynomialTools : PolynomialTools/FromCoefficientList

PolynomialTools

 FromCoefficientVector
 return a univariate polynomial from a Vector of coefficients
 FromCoefficientList
 return a univariate polynomial from list of coefficients

 Calling Sequence FromCoefficientList(L, x, opts) FromCoefficientVector(L, x, opts)

Parameters

 L - list of coefficients x - name for the polynomial variable opts - (optional) equations of the form option=value (see below)

Options

 • 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.

Description

 • 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.

Examples

 > with(PolynomialTools):
 > FromCoefficientList([1,-1,2,3],x);
 ${3}{}{{x}}^{{3}}{+}{2}{}{{x}}^{{2}}{-}{x}{+}{1}$ (1)
 > FromCoefficientList([1,-1,2,3],x,form=horner);
 ${x}{}\left({-}{1}{+}{x}{}\left({2}{+}{3}{}{x}\right)\right){+}{1}$ (2)
 > FromCoefficientList([1,0,0,2,0],x,termorder=reverse);
 ${{x}}^{{4}}{+}{2}{}{x}$ (3)
 > FromCoefficientVector(,x);
 ${{y}}^{{3}}{-}{{y}}^{{2}}{}{x}{+}\left({y}{-}{2}\right){}{{x}}^{{2}}{+}{{x}}^{{3}}$ (4)
 > FromCoefficientList([],x);
 ${0}$ (5)
 > FromCoefficientVector(CoefficientVector(0,x),x);
 ${0}$ (6)

Most vector shapes will be handled efficiently

 > v1 := Vector(500000001,shape=unit[300]):
 > FromCoefficientVector(v1,x);
 ${{x}}^{{300}}$ (7)
 > v2 := Vector(200000001,shape=scalar[50000,a]):
 > FromCoefficientVector(v2,x);
 ${a}{}{{x}}^{{50000}}$ (8)
 > v3 := Vector(10, shape=constant[b^2-1]):
 > FromCoefficientVector(v3,x);
 $\left({{b}}^{{2}}{-}{1}\right){}\left({{x}}^{{9}}{+}{{x}}^{{8}}{+}{{x}}^{{7}}{+}{{x}}^{{6}}{+}{{x}}^{{5}}{+}{{x}}^{{4}}{+}{{x}}^{{3}}{+}{{x}}^{{2}}{+}{x}{+}{1}\right)$ (9)
 > v4 := Vector(1000000001,{(1) = 5, (1000000001) = 1},storage = sparse):
 > FromCoefficientVector(v4,x);
 ${{x}}^{{1000000000}}{+}{5}$ (10)