Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.math.mathematica

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

Advanced Search

Back to Topic List Back to Topic List  
Allan Hayes

Posts: 1,508
Registered: 12/6/04
Re: [mg4414] Horner scheme function ?
Posted: Jul 30, 1996 3:01 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

kraft@emma.bauwesen.uni-dortmund.de (Manfred Krafczyk)
[mg4414] Horner scheme function ?
writes
>does anybody know where I can find a Mathematica
>function that returns the Horner representation
> of a polynomial ... ?


Manfred:

HornerForm::usage =
"HornerForm[poly,x] give the HornerForm for the polynomial
poly in x"]

HornerForm[poly_,x_] :=
Fold[(#1 x + #2 )&,0, Reverse[CoefficientList[poly,x]]]


Check:

p[x_] = Sum[ Random[Integer,{-9,9}] x^n, {n,0,5}]

2 3 4 5
-5 - 9 x - x + 4 x - 7 x - 8 x

HornerForm[p[x],x]

-5 + x (-9 + x (-1 + x (4 + (-7 - 8 x) x)))

HornerForm[x^3 + x^4,x]

3
x (1 + x)

Allan Hayes
hay@haystack.demon.co.uk







Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.