Quantcast Horner’s method - Page 2 - XP Math - Forums
XP Math Home Sign Up FREE! | Sign In | Classroom Setup | Common Core Alignment PDF Version

Go Back   XP Math - Forums > Mathematics > Homework Help

Reply
 
Thread Tools Display Modes
Old 03-18-2007   #11
Temperal
Guest
 
Posts: n/a
Default

Hmmm...
All right, I'll lift my suspicions... for now.
  Reply With Quote
Old 03-18-2007   #12
Smzrterthanu
Guest
 
Posts: n/a
Default

See, if you read sci-fi thing I read you'd know knaves always lie and knights always tell the truth and I am a knight.
now if i told you i made mc nats(which i didn't but i could but i probably won't) you can call me a knave and i'd be fine since you'd be being a knight in that case.
  Reply With Quote
Old 03-18-2007   #13
Temperal
Guest
 
Posts: n/a
Default

Rather an... interesting way of looking at things.
  Reply With Quote
Old 03-23-2007   #14
hyderman
Guest
 
Posts: n/a
Default

here you go guys look how easy

--------------------------------------------------------------------------------

The Horner’s method is an algorithm that evaluates polynomials. The following pseudocode shows how to use this method to find the
value of a_nx^n + a_{n-1}x^{n-1} + . . . + a_1x + a_0 at x = c.
procedure Horner(c, a_0, a_1, a_2, . . . , a_n : real numbers)
y := a_n
for i := 1 to n
y := y * c + a_{n-i}
end {y = a_nc^n + a_{n-1}c^{n-1} + . . . + a_1c + a_0}

(a) Evaluate x^2 + 5x + 3 at x = 2 by working through each step of the algorithm.

y:=1 [since n=2 and a_2=1]
i:=1 [first time the loop runs]
y:=y*2+5 =1*2+5=2+5=7 [since c=2 and a_1=5]
i:=2 [second time the loop runs]
y:=y*2+3=7*2+3=14+3=17 [since c=2 and a_0=3]
end [loop runs n=2 times only]

Indeed, 2^2+5*2+3=4+10+3=17 !

(b) Exactly how many multiplications and additions are used by this algorithm to evaluate a polynomial of degree n at x = c? (Do not count additions used to increment the loop variable.)

Each time the loop repeats it performs 1 multiplication [y*c] and 1 addition [adds a_{n-i} to it]. Loop repeats n times [i goes from 1 to n] so this algorithm performs n multiplications and n additions !
  Reply With Quote
Old 03-24-2007   #15
Temperal
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by hyderman View Post
here you go guys look how easy

--------------------------------------------------------------------------------

The Horner’s method is an algorithm that evaluates polynomials. The following pseudocode shows how to use this method to find the
value of a_nx^n + a_{n-1}x^{n-1} + . . . + a_1x + a_0 at x = c.
procedure Horner(c, a_0, a_1, a_2, . . . , a_n : real numbers)
y := a_n
for i := 1 to n
y := y * c + a_{n-i}
end {y = a_nc^n + a_{n-1}c^{n-1} + . . . + a_1c + a_0}

(a) Evaluate x^2 + 5x + 3 at x = 2 by working through each step of the algorithm.

y:=1 [since n=2 and a_2=1]
i:=1 [first time the loop runs]
y:=y*2+5 =1*2+5=2+5=7 [since c=2 and a_1=5]
i:=2 [second time the loop runs]
y:=y*2+3=7*2+3=14+3=17 [since c=2 and a_0=3]
end [loop runs n=2 times only]

Indeed, 2^2+5*2+3=4+10+3=17 !

(b) Exactly how many multiplications and additions are used by this algorithm to evaluate a polynomial of degree n at x = c? (Do not count additions used to increment the loop variable.)

Each time the loop repeats it performs 1 multiplication [y*c] and 1 addition [adds a_{n-i} to it]. Loop repeats n times [i goes from 1 to n] so this algorithm performs n multiplications and n additions !

The crazy thing is, I actually almost understood part of that.
  Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:44 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
XP Math