Numerical methods
IESAM360
Lesson 3: NRM
Lecture: Franklin Junior Mwakatos
Email: samuelsimwaka7@[Link]
NRM
Example 1: The equation 2𝑥 ! + 𝑥 " − 1 = 0 has exactly one real root. Find its
solution, accurate to two decimal places, using Newton-Raphson method.
Solution
I will illustrate two techniques of killing this one right; the first one l guess you
are familiar with it.
Method 1
First compute 𝑓 # (𝑥) for 𝑓 𝑥 = 2𝑥 ! + 𝑥 " − 1
⇒ 𝑓 # 𝑥 = 6𝑥 " + 2𝑥
Next let’s determine our interval 𝑥$ , 𝑥% . Let start trying between 0 and 1
For 𝑥$ = 0 into the function 𝑓 𝑥 = 2𝑥 ! + 𝑥 " − 1
! "
⇒ 𝑓 𝑥$ = 2 0 + 0 − 1 = −1
And for 𝑥% = 1
! "
⇒ 𝑓 𝑥% = 2 1 + 1 −1=2
So −1 . 2 = −2 which perfectly satisfies the condition 𝑓 𝑥$ . 𝑓 𝑥% = −1.
NRM
Next, compute 𝑓 # 𝑥%
⇒ 𝑓 # 𝑥% = 6 1 "
+2 1 =8
First iteration @ n=1;
𝑓 𝑥& 𝑓 𝑥%
𝑥&'% = 𝑥& − ⇒ 𝑥" = 𝑥% −
𝑓 # 𝑥& 𝑓 # 𝑥%
2
=1−
8
⇒ 𝑥" = 0.75
Evaluate 𝑓(𝑥" ) and 𝑓 # 𝑥" before proceeding to the next iteration
! "
⇒ 𝑓 𝑥" = 2 0.75 + 0.75 − 1 = 0.4063
⇒ 𝑓 # 𝑥" = 6 0.75 "
+ 2 0.75 = 4.875
NRM
second iteration @ n=2;
𝑓 𝑥"
⇒ 𝑥! = 𝑥" − #
𝑓 𝑥"
0.4062
= 0.75 −
4.875
⇒ 𝑥! = 0.6667
Evaluate 𝑓(𝑥! ) and 𝑓 # 𝑥!
! "
⇒ 𝑓 𝑥! = 2 0.6667 + 0.6667 − 1 = 0.0372
⇒ 𝑓 # 𝑥! = 6 0.6667 "
+ 2 0.6667 = 4.0003
Third iteration @ n=3;
𝑓 𝑥! 0.0372
⇒ 𝑥( = 𝑥! − = 0.6667 − = 0.6574
𝑓 # 𝑥! 4.0003
NRM
Evaluate 𝑓(𝑥( ) and 𝑓 # 𝑥(
⇒ 𝑓 𝑥( = 2 0.6574 ! + 0.6574 " − 1 = 0.0004
⇒ 𝑓 # 𝑥( = 6 0.6574 " + 2 0.6574 = 3.9078
Fourth iteration @ n=4;
𝑓 𝑥( 0.0004
⇒ 𝑥) = 𝑥( − = 0.6574 − = 0.6573
𝑓 # 𝑥( 3.9078
Evaluate 𝑓(𝑥) ) and 𝑓 # 𝑥)
⇒ 𝑓 𝑥) = 2 0.6573 ! + 0.6573 " −1=0
⇒ 𝑓 # 𝑥) = 6 0.6573 "
+ 2 0.6573 = 3.9069
Firth iteration @ n=5;
𝑓 𝑥) 0
⇒ 𝑥* = 𝑥) − = 0.6573 − = 0.6573
𝑓 # 𝑥) 3.9069
NRM
𝑥 converges to 0.6573 hence the required real root is 0.65 to 2 decimal places.
Now lets project our focus to Method 2
The approach is very similar to the previous one; first find the interval, of which
has be already found as 𝑥$ , 𝑥% =(0,1) then next compute 𝑓 # 𝑥 for 𝑓 𝑥 = 2𝑥 ! +
𝑥" −
⇒ 𝑓 # 𝑥 = 6𝑥 " + 2𝑥
Then this means that 𝑓 𝑥& = 2𝑥& ! + 𝑥& " − 1 and 𝑓 # 𝑥& = 6𝑥& " + 2𝑥& hence the
formula becomes
𝑓 𝑥& 2𝑥& ! + 𝑥& " − 1
𝑥&'% = 𝑥& − # ⇒ 𝑥&'% = 𝑥& −
𝑓 𝑥& 6𝑥& " + 2𝑥&
First iteration @ n=1;
2𝑥% ! + 𝑥% " − 1 2 1 !+ 1 "−1
⇒ 𝑥" = 𝑥% − =1−
6𝑥% " + 2𝑥% 6 1 "+2 1
Use a scientific calculator to obtain
⇒ 𝑥" = 0.75
NRM
Second iteration @ n=2;
2𝑥" ! + 𝑥" " − 1 2 0.75 ! + 0.75 " − 1
⇒ 𝑥! = 𝑥" − = 0.75 −
6𝑥" " + 2𝑥" 6 0.75 " + 2 0.75
⇒ 𝑥! = 06667
Proceed in the same way up to 𝑥* = 0.6573
NRM
Example 2: using the Newton-Raphson method, find the root of the equation
cos 𝑥 = 2𝑥 to five decimal places, given that 𝑥$ = 0.5.
Solution
In this case no need to stress of finding an interval since we been given an initial
condition 𝑥$ = 0.5 the need to find 𝑥% 𝑥" …
Let’s generate f(x) from the given equation i.e.
cos 𝑥 = 2𝑥 ⇒ cos 𝑥 − 2𝑥 = 0
⇒ 𝑓 𝑥 = cos 𝑥 − 2𝑥
∴ 𝑓 𝑥& = cos 𝑥& − 2𝑥&
Compute 𝑓 # (𝑥)
⇒ 𝑓 # 𝑥 = − sin 𝑥 − 2
⇒ 𝑓 # 𝑥& = − sin 𝑥& − 2
NRM
The formula becomes
𝑓 𝑥& cos 𝑥& − 2𝑥&
𝑥&'% = 𝑥& − = 𝑥& −
𝑓 # 𝑥& − sin 𝑥& − 2
cos 𝑥& − 2𝑥&
= 𝑥& −
− sin 𝑥& + 2
cos 𝑥& − 2𝑥&
⇒ 𝑥&'% = 𝑥& +
sin 𝑥& + 2
First iteration @ n=0
cos 𝑥$ − 2𝑥$
⇒ 𝑥% = 𝑥$ +
sin 𝑥$ + 2
cos 0.5 − 2 0.5
= 0.5 +
sin 0.5 + 2
Make sure your scientific calculator is set in radian for the above evaluation
𝑥% = 0.45063
NRM
Second iteration @ n=1;
cos 𝑥% − 2𝑥%
⇒ 𝑥" = 𝑥% +
sin 𝑥% + 2
cos 0.45063 − 2 0.45063
= 0.45063 +
sin 0.45063 + 2
𝑥" = 0.45018
Third iteration @ n=2;
cos 𝑥" − 2𝑥"
⇒ 𝑥! = 𝑥" +
sin 𝑥" + 2
cos 0.45018 − 2 0.45018
= 0.45018 +
sin 0.45018 + 2
𝑥! = 0.45018
Therefore the required rot of the equation is 𝒙 = 𝟎. 𝟒𝟓𝟎𝟏𝟖
END OF LESSON 3
Thanks for your time
My writing bangs echo of simplicity-Mwakatos