waqqasfarooq.com

  • Increase font size
  • Default font size
  • Decrease font size
Home Tutorials Newton Raphson Method


Newton-Raphson Method

E-mail Print PDF
User Rating: / 38
PoorBest 

Newton-Raphson Method (a.k.a Newton Method) is a method that can be used to find the root of a equation. In other words, the Newton Method helps us find the the input to a function at which the value of the function will be 0, e.g. if we have a function f(x) = x^{3} - 20, we want to find a value of x where f(x) = 0 or x^{3} - 20 = 0.

The general formula for the newton method is:

Therefore, we can find the value of x with one iteration by:

x_1 = x_0 - \frac{f(x_0) } {f'(x_0)}


The way the Newton Method works is that we start with an initial input value for f(x), this value can be any number but we want to come up with a good starting value so that we get to the root in less number of iterations. After picking an initial value for x_0, and inserting it into the Newton formula we get a value x_1 which is supposed to be closer to the root of the equation (NOTE: there are some weaknesses to this method, please see the section "Weakness of the method").

After doing one iteration of the newton formula, the value might not be very close to the root of the equation. Therefore, we would want to repeat the newton formula with the value of x_1. This will get us a new value x_2. We keep on repeating this until we get a result that satisfies our precision condition. The precision is in the number of decimal positions we want to remain unchanged after repeating the iterations. In other words, when we repeat the iterations we see that the new value of x changes only after a few number of decimal position. Say we want to have precision till 4 places of decimal, this means that we will stop iterating as soon as we see that the value of x does not change till 4 places of decimal.


Example

Let's work on an example to see how the method works. Let's find the root of the following equation with a precision of 9 decimal places.

f(x) = x^3 + 3x - 9 [1]
 


Solution

The first step is to find the first derivative of equation [1]. This results in:

f'(x) = 3.x^2 + 3 [2]
 

Now that we have f(x) and f'(x) all have to do is plug in the values in the formula: x_1 = x_{n+1} - \frac{f(x_n) } {f'(x_n)} and iterate. As a starting point I am choosing the value of x_0 = 20. Following is a table of the iterations that were done using excel.

Please see Appendix A to download the excel file with the example


iteration x f(x) f'(x) x'
1 20 8051 1203 13.30756442
2 13.30756442 2387.576189 534.2738126 8.838739388
3 8.838739388 708.0278304 237.3699419 5.855936154
4 5.855936154 209.3795021 105.8759647 3.878343763
5 3.878343763 60.97133425 48.12465103 2.61139776
6 2.61139776 16.64235463 23.45819479 1.901950389
7 1.901950389 3.585995569 13.85224585 1.643075719
8 1.643075719 0.365035093 11.09909346 1.610186989
9 1.610186989 0.005296215 10.77810642 1.609695602
10 1.609695602 1.16627E-06 10.7733598 1.609695494
11 1.609695494 5.68434E-14 10.77335875 1.609695494


Notice that we stop at iteration 11, that is because our condition of having the decimal precision of 9 places is satisfied (see x' values for 10 and 11 don't change with 9 decimal places precision).

So, what was the benefit of doing all this? Notice how the value of f(x) has gone very close to 0 on the 11th iteration and the value of x for which f(x) = 0 is the root (or solution) of the equation. Ofcourse 5.68434E-14 is not equal to 0 but its very close to 0 and is acceptable given the conditions of the example.


Weakness of the method

Although the Newton Method gets us the root of the equation it has its weakness. The function will fail if the tangent (or first derivative or the slope of the function at point x) is parallel to the x-axis. In this case the slope will be 0 and diving the function f(x) by 0 will give infinity. Hence the method will fail.


Appendix A - Downloads

 

Comments  

 
0 #2 ammad 2013-06-10 17:35
good one bro
 
 
+1 #1 hhh 2013-05-20 04:01
:o :-? :sigh: :P :zzz :oops: :-* :-| 8) ;-) :lol: