## Newton Raphson

Back to Programming

### Description

The newton raphson method is also a root-finding iterative method slightly different from the bisection method. It is an iterative method to find the root of a quadratic equation.

Before starting the method we need to guess the root, unlike the bisection method where the range of the root was given. In the case of newton raphson there is no guarantee that it will converge.

PROCEDURE

First, to derive the formula to find out the real root of an equation, first we have to assume the approximate value of the desired root.

Let the root is α. Now, we have to find out the initial interval –

and f’(x) has the same sign that means in this interval only one root of f(x) must lie and the iteration will start by taking α as ${\mathbf{a}}_{\mathbf{0}}$ or as ${\mathbf{b}}_{\mathbf{0}}$.

Now, let h be the change that should be applied to α to get the exact root.

Now by Taylor’s theorem, we get after expanding the function:

Here, h is a small correction. So h is relatively very small and we can neglect the higher order of ${\mathrm{h}}^{2}$ and more.

So, we get the equation as:

Since (α + h) is nearer to the root, so by taking it as the root of f(x) = 0 we can consider as:

As it is an iterative process, we can take as:

Therefore,

By the successive approximation we get:

Hence, for this method, the iteration formula is taken as:

GRAPHICAL REPRESENTATION

### Algorithm

INPUT:

and it’s derivative

OUTPUT:

PROCESS:

``````Step 1: The equation and it’s derivative defined by ‘macro’ F(x) and E(x)
respectively.

Step 2: Create the function “void main()”

[‘a’ and ‘b’ are two float type variables and initially a=0.0 and b=1.0]
Step 2.1: While (F(a)*F(b) > 0) then repeat Step 2.2 to Step 2.3

Step 2.2: Set  a ← b

Step 2.3: Set  b ← b + 1.0
[End of Step 2.1 ‘While’ loop]

Step 2.4: Display the two integer values ‘a’ and ‘b’ in which the root lays i.e.                                                                                print “a, b”.

Step 2.5: Take the value of Error in a float type variable ‘err’.

Step 2.6: Set  s ← a

Step 2.7: Do Step 2.8 to Step 2.14

Step 2.8: Set  p ← s

Step 2.9: Set  m ← F(p)

Step 2.10: Set  n ← E(p)

Step 2.11: Set  h ← −(m/n)

Step 2.12: Set s ← p + h

Step 2.13: Print “m, n, h, s”

Step 2.14: While (fabs(s - p) > err) then go to Step 2.7 repeatedly

[End of Step 2.7 ‘do-while’ loop]

Step 2.15: Display the value of the root correct up to 4 decimal places i.e. print “s”

[End of the function “void main()”].

Step 3: Stop``````

### Code

1. The rate of convergence of this method is quadratic, so the method converges more rapidly.

2. If the function is nearly vertical while crossing the x-axis, then the root-finding is very fast with less effort.

3. Complex roots can be found out easily.

1. If f’(x) is very small in the neighbourhood of the root then the values of h will be very large and it will be a complex or slow process to find out the root. Sometimes it may even fail.

2. This method is not applicable if the graph of f(x) is nearly horizontal while crossing the x-axis.

3. The process of finding root will fail if f’(x) = 0 in the neighbourhood of the root.

4. If the initial approximation ${\mathrm{\alpha }}_{0}$ is chosen sufficiently close to the root, then only the sequence converges, otherwise it may diverge.

5. If a root α of f(x) = 0 is multiple roots then the method will fail since both f’(α) and f’’(α) is 0.

APPLICATION

1. It is used in the optimal design of the water distribution network.

2. It is used to measure the flow in a network.