({{, (RefLink[HornerForm, paclet:ref/HornerForm])[poly] 
puts the polynomial poly in Horner form.}, {, (RefLink[HornerForm, paclet:ref/HornerForm])[poly,vars] 
puts poly in Horner form with respect to the variable or variable list vars.}, {, (RefLink[HornerForm, paclet:ref/HornerForm])[(Subscript[poly, 1])/(Subscript[poly, 2])] 
puts the rational function (Subscript[poly, 1])/(Subscript[poly, 2]) in Horner form by nesting (Subscript[poly, 1]) and (Subscript[poly, 2]).}, {, (RefLink[HornerForm, paclet:ref/HornerForm])[(Subscript[poly, 1])/(Subscript[poly, 2]),(Subscript[vars, 1]),(Subscript[vars, 2])] 
puts (Subscript[poly, 1])/(Subscript[poly, 2]) in Horner form using the variables or variable lists (Subscript[vars, 1]) and (Subscript[vars, 2]) for (Subscript[poly, 1]) and (Subscript[poly, 2]), respectively.}})

OpenersNotesSection(Spacer1)Details

When variables are not specified, (RefLink[HornerForm, paclet:ref/HornerForm]) puts the polynomial or rational function into Horner form with respect to the variables identified using (RefLink[Variables, paclet:ref/Variables]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (11)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Horner form of a polynomial in x:

HornerForm[11 x^3-4 x^2+7 x+2]

Put a polynomial into Horner form with respect to a given variable:

HornerForm[a +b x +c x^2,x]

Horner form of a rational function:

HornerForm[(11 x^3-4 x^2+7 x+2)/(x^2-3x+1)]

OpenersExampleSection1(Spacer1)Scope  (2)

Order a bivariate polynomial with respect to x then y:

HornerForm[x y+2 x^2 y+2 x y^2+4 x^2 y^2,{x,y}]

With respect to y then x:

HornerForm[x y+2 x^2 y+2 x y^2+4 x^2 y^2,{y,x}]

Construct a rational function in two variables:

rf=LegendreP[5,2x+y]/LegendreP[7,x-y/3]

Convert the function to Horner form:

HornerForm[rf]

Convert to Horner form using y before x in the numerator:

HornerForm[rf,{y,x},{x,y}]

OpenersExampleSection2(Spacer1)Generalizations & Extensions  (1)

An expression with rational exponents:

HornerForm[x^(1/3)+x+x^(3/2)]

OpenersExampleSection4(Spacer1)Applications  (1)

Improve speed and stability for numeric evaluation of large polynomials:

dpoly[x_]=D[LegendreP[50,x],x];

Plot[Evaluate[dpoly[x]],{x,1,1.01},PlotRange->All,PlotPoints->200]//Timing

Plot[Evaluate[HornerForm[dpoly[x]]],{x,1,1.01},PlotRange->All,PlotPoints->200]//Timing

OpenersExampleSection5(Spacer1)Properties & Relations  (2)

Horner form of a rational function is the ratio of Horner forms:

num=x^3-x^2 y+x y-3y^3;
denom=x^3+x^2 y+x y+3y^3;

HornerForm[num/denom]

Obtained as a ratio of Horner forms:

HornerForm[num]/HornerForm[denom]

(RefLink[HornerForm, paclet:ref/HornerForm]) recursively factors out powers of variables:

lp=LegendreP[5,x] LegendreP[3,x]

HornerForm[lp,x]

(RefLink[Collect, paclet:ref/Collect]) groups based on powers of variables:

Collect[lp,x]

(RefLink[Factor, paclet:ref/Factor]) gives the factored form:

Factor[lp]

OpenersExampleSection6(Spacer1)Possible Issues  (1)

Exponents must be integers or rationals:

HornerForm[1+x^a,x]

OpenersExampleSection7(Spacer1)Neat Examples  (1)

Range[10].x^Range[10]

HornerForm[%]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Collect, paclet:ref/Collect])  ▪  (RefLink[Decompose, paclet:ref/Decompose])  ▪  (RefLink[Expand, paclet:ref/Expand])  ▪  (RefLink[Fold, paclet:ref/Fold])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Structural Operations on Polynomials, paclet:tutorial/StructuralOperationsOnPolynomials])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Polynomial Factoring & Decomposition, paclet:guide/PolynomialFactoring])}})}})