convert/horner - Maple Programming Help

Home : Support : Online Help : Programming : Data Types : Conversion : convert/horner

convert/horner

 Calling Sequence convert(f, 'horner', x)

Parameters

 f - polynomial or rational function in x, or set, list or relation of these; expression to be converted x - (optional) name, list of names or set of names; the variable or variables with respect to which the conversion is performed

Description

 • The convert(f, 'horner', x) command converts the input to horner form with respect to x, or the names in x if this argument is a list or set.
 • If x is omitted, it is taken as indets(f,name).
 • If x is given as a list or set of names, the conversion is applied recursively to the coefficients of f in the first variable given.  A list allows for control over the order of the conversions.
 • If f is a set, list or relation, the result is map(convert, f, 'horner', x).
 • Any subexpressions of f which are not either polynomials or rational functions in x are frozen via a call to frontend prior to conversion.

Examples

 > $\mathrm{convert}\left({x}^{2}+3x+4,\mathrm{horner},x\right)$
 ${4}{+}\left({3}{+}{x}\right){}{x}$ (1)
 > $\mathrm{poly}≔{y}^{2}{x}^{2}+2x{y}^{2}+2{x}^{2}y+{x}^{2}+2x$
 ${\mathrm{poly}}{:=}{{x}}^{{2}}{}{{y}}^{{2}}{+}{2}{}{{x}}^{{2}}{}{y}{+}{2}{}{x}{}{{y}}^{{2}}{+}{{x}}^{{2}}{+}{2}{}{x}$ (2)
 > $\mathrm{convert}\left(\mathrm{poly},\mathrm{horner},x\right)$
 $\left({2}{}{{y}}^{{2}}{+}{2}{+}\left({{y}}^{{2}}{+}{2}{}{y}{+}{1}\right){}{x}\right){}{x}$ (3)
 > $\mathrm{convert}\left(\mathrm{poly},\mathrm{horner},\left[x,y\right]\right)$
 $\left({2}{}{{y}}^{{2}}{+}{2}{+}\left({1}{+}\left({2}{+}{y}\right){}{y}\right){}{x}\right){}{x}$ (4)
 > $\mathrm{convert}\left(\mathrm{poly},\mathrm{horner},\left[y,x\right]\right)$
 $\left({2}{+}{x}\right){}{x}{+}\left({2}{}{{x}}^{{2}}{+}\left({2}{+}{x}\right){}{x}{}{y}\right){}{y}$ (5)
 > $\mathrm{convert}\left(\frac{{x}_{i}^{2}-3{x}_{i}+2}{4{x}_{i}-2{x}_{i}^{3}-2+{x}_{i}^{2}},\mathrm{horner}\right)$
 $\frac{{2}{+}\left({-}{3}{+}{{x}}_{{i}}\right){}{{x}}_{{i}}}{{-}{2}{+}\left({4}{+}\left({1}{-}{2}{}{{x}}_{{i}}\right){}{{x}}_{{i}}\right){}{{x}}_{{i}}}$ (6)
 > $\mathrm{convert}\left({a}^{3}+3{a}^{2}\mathrm{sin}\left(t\right)-a\mathrm{cos}\left(t\right)+1+\sqrt{a}=1-a\mathrm{tan}\left(t\right)+{a}^{2},\mathrm{horner},a\right)$
 $\sqrt{{a}}{+}{1}{+}\left({-}{\mathrm{cos}}{}\left({t}\right){+}\left({3}{}{\mathrm{sin}}{}\left({t}\right){+}{a}\right){}{a}\right){}{a}{=}{1}{+}\left({-}{\mathrm{tan}}{}\left({t}\right){+}{a}\right){}{a}$ (7)
 > $\mathrm{convert}\left(\left[3{b}^{3}-2{b}^{2}+b-1,\frac{2-b}{3{b}^{2}-5b+6}\right],\mathrm{horner}\right)$
 $\left[{-}{1}{+}\left({1}{+}\left({-}{2}{+}{3}{}{b}\right){}{b}\right){}{b}{,}\frac{{2}{-}{b}}{{6}{+}\left({-}{5}{+}{3}{}{b}\right){}{b}}\right]$ (8)
 > $\mathrm{convert}\left(\left\{3{b}^{3}-2{b}^{2}+b-1,\frac{2-b}{3{b}^{2}-5b+6}\right\},\mathrm{horner}\right)$
 $\left\{\frac{{2}{-}{b}}{{6}{+}\left({-}{5}{+}{3}{}{b}\right){}{b}}{,}{-}{1}{+}\left({1}{+}\left({-}{2}{+}{3}{}{b}\right){}{b}\right){}{b}\right\}$ (9)