Re: Horner scheme function ?

• To: mathgroup at smc.vnet.net
• Subject: [mg4492] Re: [mg4414] Horner scheme function ?
• From: brucec (Bruce Carpenter)
• Date: Fri, 2 Aug 1996 02:22:24 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```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,
>thanks in advance
>Manfred Krafczyk
>kraft at 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 at wolfram.com
Champaign, IL  61820                           web:  http://www.wolfram.com

==== [MESSAGE SEPARATOR] ====

```

• Prev by Date: Re: Constrained Min, non-linear
• Next by Date: Re: reverse an axis
• Previous by thread: Re: Constrained Min, non-linear
• Next by thread: Re: Horner scheme function ?