MathGroup Archive 2005

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

Search the Archive

Re: Why won't Hornerwork?

  • To: mathgroup at
  • Subject: [mg59046] Re: Why won't Hornerwork?
  • From: Bill Rowe <readnewsciv at>
  • Date: Wed, 27 Jul 2005 01:26:06 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

On 7/26/05 at 4:01 AM, paul.mchale at _NO_$ (Paul
McHale) wrote:

>When I issue the command:

>In:= Fit[ {{1,200},{200,0},{400,200}}, {1,x,x^2}, x]

>Out:= 202.01 - 2.01508 x + 0.00502513 x^2

>This seems good.  But when I do

>In:= Horner[Fit[ {{1,200},{200,0},{400,200}}, {1,x,x^2}, x]]

>Out:= Horner[202.01 - 2.01508 x + 0.00502513 x^2]

>Why doesn't it evaluate the polynomial? 

Did you load the package Algebra`Horner` using one of the following:


I stongly suspect you didn't since that is the main reason for Mathematica to return Horner unevaluated as you have indicated.

But note, Horner doesn't evaluate the polynomial, it converts it to Horner form. That is:

<< "Algebra`"; 
Horner[Fit[{{1, 200}, {200, 0}, {400, 200}}, {1, x, x^2}, x]]

(0.005025125628140703*x - 2.0150753768844214)*x + 202.0100502512562

If you want to evaluate the polynomial at a specific point (say x = 10) then the syntax is

poly = Fit[{{1, 200}, {200, 0}, {400, 200}}, {1, x, x^2}, x]; 
poly /. x -> 10


Here, I've assigned the output of Fit to a variable so as to make it easy to evaluate at more than one point. That is


will evaluate poly at each point in list
To reply via email subtract one hundred and four

  • Prev by Date: How to simplify an expression in version 5
  • Next by Date: Re: Showing Mathematica notebooks within Firefox browser (like Adobe PDF's)
  • Previous by thread: Re: How to simplify an expression in version 5
  • Next by thread: Re: Why won't Hornerwork?