Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I want to find a recursive way of evaluating any polynomial (I'm given the polynomial, and a value for x, and I need to replace the x in the polynomial with the value). The polynomial can be anything, and the x-value will be an integer. Say, $$3x^5+9x^3-2x^2+x$$ and x=5.

What would be the most efficient way of computing the value?

share|improve this question
2  
What do you mean to solve a polynomial? Usually one solves equations. Do you want to factor it? Find a (or all) the roots? Most numerical analysis books will have a chapter on this. –  Ross Millikan Jun 30 '11 at 17:30
1  
Will any solution do, or do you want a particular one, or do you want all the solutions? Do you want a real solution, and if you do, do you know that such a solution exists in advance, or do you need to check? –  Mark Bennet Jun 30 '11 at 17:31
    
Sorry for the confusion, I will be given the value of x as well (I've also edited the question). –  George Jun 30 '11 at 17:44
    
Edits have clarified that the question was about evaluating the polynomial rather than solving it –  Mark Bennet Jun 30 '11 at 18:54

2 Answers 2

up vote 6 down vote accepted

Looks like you want to evaluate a polynomial at a given point.

Try using Horner's Method.

share|improve this answer
    
That does seem to be what is meant. –  Mark Bennet Jun 30 '11 at 18:10

I recommend looking into [Horner's Method][1] and Newton's Method.

share|improve this answer
    
Euler's method is for solving differential equations. There is no differential equation here. –  Robert Israel Jun 30 '11 at 18:16
    
@Robert: You know, you're right. I got my names mixed up. I meant Horner's Method (en.wikipedia.org/wiki/Horner_scheme) too. –  mixedmath Jul 1 '11 at 3:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.