Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Re: [mg4414] Horner scheme function ?
Replies: 0

 Bruce Carpenter Posts: 2 Registered: 12/7/04
Re: [mg4414] Horner scheme function ?
Posted: Jul 24, 1996 7:11 PM

At 10:49 PM 7/21/96, Manfred Krafczyk wrote:
>Hi all,
>does anybody know where I can find a Mathematica
>function that returns the Horner representation
>of a polynomial or how such a function could be
>constructed from the standard M. function set ?
>
>Any hints welcome,
>Manfred Krafczyk
>kraft@busch.bauwesen.uni-dortmund.de

Hi Manfred,

Take a look at the following:

In[45]:=
Hornerize[poly_,var_] := Fold[(#1 x + #2)&,0,Reverse[CoefficientList[poly,var]]]

In[46]:=
Hornerize[3 x^6 + 4 x^5 - x^4 + 27 x^3 - x + 1, x]

Out[46]=
1 + x*(-1 + x^2*(27 + x*(-1 + x*(4 + 3*x))))

In[47]:=
Hornerize[-c x^2 + b x^5, x]

Out[47]=
x^2*(-c + b*x^3)

Cheers,
Bruce Carpenter

-----------------------
Dr. Bruce Carpenter
Educational Applications Coordinator phone: (217) 398-0700
Wolfram Research, Inc. fax: (217) 398-0747
100 Trade Centre Drive email: brucec@wolfram.com
Champaign, IL 61820 web: http://www.wolfram.com