C++/horner's method
Expert: vijayan - 4/21/2009
QuestionHi
i have a project in c++,it is about horner's method,and the program should run it.
but i don't know what the program should want from user or do
could you plz just give me a suggestion about coding this program?
Thanx
Bita
AnswerHorner's method is a technique for evaluating polynomials.
It uses nested multiplication instead of exponentiation.
For example, the fourth-degree polynomial
P(x) = a4 * x^4 + a3 * x^3 + a2 * x^2 + a1 *x + a0
can be written in the 'nested multiplication' form
P(x) = ( ( ( ( a4 * x + a3 ) * x ) + a2 ) * x + a1 ) * x + a0
see:
http://en.wikipedia.org/wiki/Horner_scheme
so your program should accept an nth-degree polynomial from the user and could do things like:
a. evaluate it for a particular value of x
b. find its roots
you would find other examples of using Horner algorithm (floating point division, radix conversion) in the wiki article.