 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

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

Most vector shapes will be handled efficiently

 > $\mathrm{v1}≔\mathrm{Vector}\left(500000001,\mathrm{shape}=\mathrm{unit}\left[300\right]\right):$
 > $\mathrm{FromCoefficientVector}\left(\mathrm{v1},x\right)$
 ${{x}}^{{300}}$ (7)
 > $\mathrm{v2}≔\mathrm{Vector}\left(200000001,\mathrm{shape}=\mathrm{scalar}\left[50000,a\right]\right):$
 > $\mathrm{FromCoefficientVector}\left(\mathrm{v2},x\right)$
 ${a}{}{{x}}^{{50000}}$ (8)
 > $\mathrm{v3}≔\mathrm{Vector}\left(10,\mathrm{shape}=\mathrm{constant}\left[{b}^{2}-1\right]\right):$
 > $\mathrm{FromCoefficientVector}\left(\mathrm{v3},x\right)$
 $\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)
 > $\mathrm{v4}≔\mathrm{Vector}\left(1000000001,\left\{1=5,1000000001=1\right\},\mathrm{storage}=\mathrm{sparse}\right):$
 > $\mathrm{FromCoefficientVector}\left(\mathrm{v4},x\right)$
 ${{x}}^{{1000000000}}{+}{5}$ (10)