Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Horner scheme function ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4539] Re: [mg4414] Horner scheme function ?
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Wed, 7 Aug 1996 04:17:45 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

kraft at 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 at haystack.demon.co.uk

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


  • Prev by Date: Re; Reordering lists?!
  • Next by Date: Re: Reordering lists?!
  • Previous by thread: Re: Horner scheme function ?
  • Next by thread: Re: reverse an axis