Newton Raphson (NR) Method Algorithm (Step Wise)

Table of Contents

This article explains an algorithm for Newton Raphson method step wise. Newton Raphson methos is also known as NR method.

Newton Raphson Introduction

Newton Raphson Method is an open method and starts with one initial guess for finding real root of non-linear equations.

In Newton Raphson method if x0 is initial guess then next approximated root x1 is obtained by following formula:

x1 = x0 - f(x0) / g(x0)

And an algorithm for Newton Raphson method involves repetition of above process i.e. we use x1 to find x2 and so on until we find the root within desired accuracy.

Algorithm for Newton Raphson Method

An algorithm for Newton Raphson method requires following steps in order to solve any non-linear equation with the help of computational tools:

1. Start

2. Define function as f(x)

3. Define first derivative of f(x) as g(x)

4. Input initial guess (x0), tolerable error (e) 
   and maximum iteration (N)

5. Initialize iteration counter i = 1

6. If g(x0) = 0 then print "Mathematical Error" 
   and goto (12) otherwise goto (7) 

7. Calcualte x1 = x0 - f(x0) / g(x0)

8. Increment iteration counter i = i + 1

9. If i >= N then print "Not Convergent" 
   and goto (12) otherwise goto (10) 

10. If |f(x1)| > e then set x0 = x1 
    and goto (6) otherwise goto (11)

11. Print root as x1

12. Stop