# help nonlinear secant method programming

hi, im a beginner in using C++...

i have a project due in a few days and i've been trying to do the program for a week now... we're supposed to make a program that would allow the user to enter any polynomial equation (always = 0), asks the user the interval and number of iterations and solve it using secant method...

for example, the user entered the polynomial equation of 0.5x^4 + 2x^2 - x + 4 = 0, interval [-0.25, 0], no of iterations is 5, the result should be the following:

[IMG]http://i37.tinypic.com/339qefn.jpg[/IMG]

the screen should look like this when program is run:

[IMG]http://i33.tinypic.com/3325hs4.jpg[/IMG]

i already have a code for the secant method formula part for computing the new x sub n, however i don't have a clue as to how i would make a code enabling the user to enter the polynomial equation to be solved and substituting the new x (which is the new computed x sub n obtained from the secant formula) to the polynomial equation

• Did you ever get the problem figured out?

If you already know the secant algorithm, I think all that is left is to get the input and output the results.

1) Unless you know the degree of the polynomial to be solved all the time, I would first prompt the user to enter the degree. Accept the input, and set the degree of the polynomial.

2) Then prompt the user to enter the appropriate number of coefficients, based on the degree of polynomial that was input. Assign those coefficients to the appropriate polynomial variable.

3) Apply the secant method.

4) Then output the results.

- - -

Also, if you need some known results against which to test your own program, you might like the following Javascript utility:

www.akiti.ca/PolyRootRe.html

You could test the results of your program against the results of this page to make sure your program is giving the correct results.