## Monday, April 9, 2012

### Newton-Raphson Method to find the roots of a polynomial

Reference:

Scilab Reference Manual by Professor Gilberto E. Urroz, Ph.D., P.E.

Consider the following single nonlinear equation

The Newton-Raphson method consists in obtaining improved values of the approximate root through the recurrent application of the equation. The iterative procedure can be generalized in the form
below

After each iteration the program should check to see if the convergence condition

is satisfied.

Algorithm Description
The iterative algorithms must include the option of stopping the program if the number of iterations are too large. The number of iterations will depend of the particular problem solved.  However, a computer program to implement the Newton-Raphson method could take more than 1000 iterations to converge if the problem is either ill-posed or if it has a logical error. In such cases, the initial values need to be modified to ensure convergence.

Example Problem

Polynomial : f(x) = x^3-2*x^2+1

To visualize the solution, it helps to plot the function using Scilab.
Use the following scilab commands to plot the function

We see that the function graph crosses the x-axis somewhere between -0.8 and -0.4, between 0.8 and 1.2, and between 1.6 and 2.0.

The Scilab Program to implement the algorithm to find the roots of a polynomial using Newton Raphson Method

The results of the newton_raphson algorithm in SCILAB console are shown below:

More about Newton Raphson Method at http://en.wikipedia.org/wiki/Newton%27s_method