You are here:

C++/horner's method

Advertisement


Question
Hi
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

Answer
Horner'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.  

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


vijayan

Expertise

my primary areas of interest are generic and template metaprogramming, STL, algorithms, design patterns and c++11. i would not answer questions about gui and web programming.

Experience

about 15 years or so

Education/Credentials
post graduate engineer

©2016 About.com. All rights reserved.