• Support PF! Buy your school textbooks, materials and every day products Here!

Horner’s method

  • Thread starter hyderman
  • Start date
30
0
The Horner’s method is an algorithm that evaluates polynomials. The following pseudocode shows how to use this method to find the
value of anxn + an-1xn-1 + . . . + a1x + a0 at x = c.
procedure Horner(c, a0, a1, a2, . . . , an : real numbers)
y := an
for i := 1 to n
y := y × c + an-i
end {y = ancn + an-1cn-1 + . . . + a1c + a0}

(a) Evaluate x2 + 5x + 3 at x = 2 by working through each step of the algorithm.
(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.)


please help in details thanx much


[
 

Answers and Replies

Dick
Science Advisor
Homework Helper
26,258
618
n=2. a2=1, a1=5, a0=3. c=2. There - I did the hard part. Now just DO it. Step through the algorithm.
 
30
0
okey x^2 + 5x + 3 at x=2
i need to make sure about your answer.sooo

x^2(is a2) + 5x(is a1) + 3 (is a0) at x=2 (is n=2)
correct or not?

i will give anonther example make sure about it

lets assume evaluate 3x^2 + x + 1 at x=2

so according to you 3x^2(is a=2) + x(is a=1) + 1 (is a=0) at x=2(is n=2)
is it correct

please let me know
thanx
 
Integral
Staff Emeritus
Science Advisor
Gold Member
7,184
55
Boy are they going out of their way to make this obscure.

Horner's method is simply factoring the polynomial to eliminate all orders of x greater then 1. Then you start multiplying and adding your way through the nest.
For example expand a quadratic like this:
[tex] ax^2 + bx + c = x(ax+b) + c [/tex]

To do the calculation start inside the parens and work your way out.

This method is very useful for RPN calculators.
 
286
0
Integral, Is Horner's method just an elaborate way to say that the value of a polynomial at x=a is simply the remainder when the polynomial is divided by x-a?

Nevermind... (I've never seen it written as Horner's method before; I just scratched it out on paper, and "that's all it is?") You're right! They did make that pretty obscure.

OP, if you're having trouble following it, have you been exposed to synthetic division before? Simply, synthetic division is used to divide a polynomial by a linear binomial in the form (x-a). The remainder after such a division is equal to f(a).
 
AlephZero
Science Advisor
Homework Helper
6,953
291
To answer the question, it doesn't matter if you don't know what Horner's method is, or what it's supposed to do.

You are given an algorithm, and asked to work through it step by step and count the number of operations. A computer just follows the instructions in the algorithm. To answer the question, you need to do the same as the computer would do.
 
30
0
hello
how did you calculate c=2

please explain in details

how about this
okey x^2 + 5x + 3 at x=2
what is c?
 
HallsofIvy
Science Advisor
Homework Helper
41,736
894
hello
how did you calculate c=2

please explain in details

how about this
okey x^2 + 5x + 3 at x=2
what is c?
No one "calculated" c= 2! The definition of Horner's method said "use this method to find the value of a_nx^n + a_(n-1)x^(n-1) + . . . + a_1x + a_0 at x = c".
Your problem asks you to find the value of a given polynomia "at x= 2".

Just compare that "general form "anx^n + an-1x^(n-1) + . . . + a1x + a0 at x = c" with the specific problem you are given. In x^2+ 5x+ 3, the highest power of x is 2: n= 2. The coefficient of that highest power is 1, the next 5, the constant term is 3: a_2= 1, a_1= 5, a_0= 3. Because the problem says "at x= 2" compared with "at x= c", c= 2.

Here's a test: "evaluate 4x^3+ 3x^2- 2x+ 4 at x= 1". What are n, a_3, a_2, a_1, a_0, and c?

By the way, notice the use of "_2" for subscripts and "^2" for exponents? Makes it much easier to read.
 
Last edited by a moderator:
30
0
thank you HallsofIvy it is clear now......
 

Related Threads for: Horner’s method

  • Last Post
Replies
8
Views
4K
  • Last Post
Replies
9
Views
1K
  • Last Post
Replies
4
Views
5K
Replies
8
Views
8K
Replies
2
Views
1K
Replies
3
Views
3K
Replies
4
Views
2K
Replies
6
Views
1K
Top