You are on page 1of 9

Newton Raphson Method

Question
Solve by Newton Raphson Method;
𝑓 (𝑥 ) = 4 cos(𝑥 ) + 𝑒 −𝑥

Solution
First of all, we will plot the given function to get an initial approxiation for the root of the equation. Since we
know that root of the equuation is the point where the curve cuts x axis. From the graph we can see that
curve cuts near to x=1.6

y
3

2 Equation 1: y=4⋅ cosx+e −x

1
x
1 2 3 4 5 6
−1

−2

−3

−4

−5

0.2

x
0
1.4 1.5 1.6 1.7 1.8 1.9 2 2.1 2.2

−0.2

−0.4

−0.6

−0.8

Taking initial approximation 𝑥0 = 1.6


Newton Raphson Formula:
𝒇(𝒙𝒏 )
𝒙𝒏+𝟏 = 𝒙𝒏 −
𝒇′ (𝒙𝒏 )
𝑓 (𝑥0 ) = 0.0851
𝑓 ′ (𝑥𝑛 ) = −4 sin(𝑥 ) − 𝑒 𝑥
𝑓 ′ (𝑥0 ) = −4.20019
So the formula becomes
4 cos(𝑥𝑛 ) + 𝑒 −𝑥𝑛
𝑥𝑛+1 = 𝑥𝑛 −
−4.20019
Where n=0,1,2,3,……
4 cos(𝑥𝑛 )+𝑒 −𝑥𝑛
For n=0 𝑥1 = 𝑥0 −
−4.20019
𝑥1 = 1.62026
𝑓 ′ (𝑥1 ) = −4.19295
4 cos(𝑥𝑛 )+𝑒 −𝑥𝑛
For n=1 𝑥2 = 𝑥1 −
−4.20019

𝑥2 = 1.62028

𝑓 ′ (𝑥2 ) = −4.19295
4 cos(𝑥𝑛 )+𝑒 −𝑥𝑛
For n=2 𝑥3 = 𝑥2 −
−4.20019

𝑥3 = 1.62028

𝑓 ′ (𝑥3 ) = −4.19295
4 cos(𝑥𝑛 )+𝑒 −𝑥𝑛
For n=3 𝑥4 = 𝑥3 −
−4.20019

𝑥4 = 1.62028
𝑓 ′ (𝑥1 ) = −4.19295

Number of Root (x) f’(x) Error


Iteration (n)

0 1.6 −4.20019 -0.00724


1 0.0000
2 0.0000

3 0.0000
Approximate root of the equation 4cos(x)+e-x=0 using Newton Raphson mehtod is 1.62028 (After 3 iterations)
Newton Raphson Method in autograph

Table of Values of Equation 1:


x f(x)
1.3 1.343
1.31 1.301
1.32 1.26
1.33 1.218
1.34 1.177
1.35 1.135
1.36 1.094
1.37 1.052
1.38 1.01
1.39 0.9683
1.4 0.9265
1.41 0.8846
1.42 0.8426
1.43 0.8006
1.44 0.7586
1.45 0.7166
1.46 0.6745
1.47 0.6324
1.48 0.5903
1.49 0.5482
1.5 0.5061
1.51 0.4639
1.52 0.4218
1.53 0.3797
1.54 0.3375
1.55 0.2954
1.56 0.2533
1.57 0.2112
1.58 0.1692
1.59 0.1271
1.6 0.0851
1.61 0.04311
1.62 0.001163
1.63 -0.04075
1.64 -0.08261
1.65 -0.1244
1.66 -0.1662
1.67 -0.2079
Netwon Raphson method in autograph
Number of iterations=6

x Delta (x)
1.62 0.1201
1.62 0.0001574
1.62 1.134E-009
1.62 4.441E-016
1.62 0
1.62 0
2.165 0
Equation 1: y=4⋅ cosx+e −x
2.165 0
y
1.5

0.5
x
−2 −1 1 2 3 4 5 6 7 8

−0.5

−1

−1.5

y
3

−x
2 Equation 1: y=4⋅ cosx+e

x
−15 −10 −5 5 10 15 20

−1

−2

Case example for Failure of Netwon Raphson Method


Function
𝑦 = 𝑥 3 + 8𝑥 2 + 10𝑥 + 1.5
Take x0=-0.75

x Delta (x)
-6.543 0.3566
-6.497 0.0465
-6.496 0.0007663
-6.496 2.066E-007
-6.496 2.22E-014
-6.496 0

y
4
3
2
1
x
−10 −8 −6 −4 −2 2 4
−1
−2
−3
−4
−5

Iteration Method
Question
Solve by Iteration Method;

𝑥 3 + 4𝑥 = 1
Solution
First of all, we will plot the given function to get an initial approxiation for the root of the equation. Since we
know that root of the equuation is the point where the curve cuts x axis. From the graph we can see that
curve cuts near to x=1.35

4 y

3
Equation 1: y=x 3 +4 ⋅ x−1
2

1
x
−6 −5 −4 −3 −2 −1 1 2 3 4 5 6
−1

−2

−3

−4
0.4 y
0.3
0.2
0.1
x
−0.4 −0.2 0.2 0.4 0.6 0.8
−0.1
−0.2
−0.3
−0.4
−0.5

Lets first find whether the method is applicable or not


Let rewrite f(x)=0 in the form of x=φ(x)
From the equation

𝑥 3 + 4𝑥 − 1 = 0

𝑥(𝑥 2 + 4) = 1
1
𝑥=
(𝑥 2 + 4)
1
𝜑(𝑥) =
(𝑥 2 + 4)
−2𝑥
Taking Derivative 𝜑 ′ (𝑥 ) = (𝑥 2
+4)2

Since |𝜑 ′(𝑥) | < 1, SO iteration method is applicable

Taking initial approximation as 𝑥0 = 0.2


We have
1
𝑥𝑛+1 = 𝜑(𝑥𝑛 ) = 2
(𝑥𝑛 + 4)
For n=0
1
𝑥1 = 𝜑(𝑥0 ) = 2
(𝑥0 + 4)
𝑥1=0.247524
For n=1
1
𝑥2 = 𝜑(𝑥1 ) = 2
(𝑥1 + 4)
𝑥2=.246228
For n=2
1
𝑥3 = 𝜑(𝑥2 ) = 2
(𝑥2 + 4)
𝑥3=0.24267
For n=3
1
𝑥4 = 𝜑(𝑥3 ) = 2
(𝑥3 + 4)
𝑥4=0.246266
For n=4
1
𝑥5 = 𝜑(𝑥4 ) = 2
(𝑥4 + 4)
𝑥5=0.246266

y
Equation 1: y=x 3 +4 ⋅ x−1
2

x
−3 −2 −1 1 2 3

−1

−2

Case for failure of method


If we chose

𝑥 3 + 4𝑥 − 1 = 0

3
𝑥 = √√4𝑥 − 1

3
𝑔(𝑥 ) = 𝑥 = √√4𝑥 − 1

Because |g’(x)|>1 so iteration method will not be applicable.

Bisection Method
Question
Solve by bisection method
1
2𝑥 + ( )𝑥 = 3
2
Solution
First of all, we will plot the given function to get an initial approxiation for the root of the equation. Since we
know that root of the equuation is the point where the curve cuts x axis. From the graph we can see that root
lies between 1 and 1.3
4 y

3
1 x
2 Equation 1: y=2 x+ −3
2

1
x
−6 −5 −4 −3 −2 −1 1 2 3 4 5 6
−1

−2

−3

−4

y
0.3
0.2
0.1
x
0
0.5 1 1.5
−0.1
−0.2
−0.3
−0.4
−0.5
−0.6

1st iteration :
Here f(1)=-0.5<0 and f(1.4)=0.01794>0
∴ Now, Root lies between 1 and 1.4
x0=(1+1.42)/2=1.2
f(x0)=f(1.2)=21.2+0.51.2-3=-0.26733<0
2nd iteration :
Here f(1.2)=-0.26733<0 and f(1.4)=0.01794>0
∴ Now, Root lies between 1.2 and 1.4
x1=(1.2+1.42)/2=1.3
f(x1)=f(1.3)=21.3+0.51.3-3=-0.13158<0
3rd iteration :
Here f(1.3)=-0.13158<0 and f(1.4)=0.01794>0
∴ Now, Root lies between 1.3 and 1.4
x2=(1.3+1.42)/2=1.35
f(x2)=f(1.35)=21.35+0.51.35-3=-0.05859<0
4th iteration :
Here f(1.35)=-0.05859<0 and f(1.4)=0.01794>0
∴ Now, Root lies between 1.35 and 1.4
x3=(1.35+1.42)/2=1.375
f(x3)=f(1.375)=21.375+0.51.375-3=-0.02077<0
5th iteration :
Here f(1.375)=-0.02077<0 and f(1.4)=0.01794>0
∴ Now, Root lies between 1.375 and 1.4
x4=(1.375+1.42)/2=1.3875
f(x4)=f(1.3875)=21.3875+0.51.3875-3=-0.00152<0
6th iteration :
Here f(1.3875)=-0.00152<0 and f(1.4)=0.01794>0
∴ Now, Root lies between 1.3875 and 1.4
x5=(1.3875+1.42)/2=1.39375
f(x5)=f(1.39375)=21.39375+0.51.39375-3=0.00818>0
7th iteration :
Here f(1.3875)=-0.00152<0 and f(1.39375)=0.00818>0
∴ Now, Root lies between 1.3875 and 1.39375
x6=(1.3875+1.393752)/2=1.39062
f(x6)=f(1.39062)=21.39062+0.51.39062-3=0.00332>0
8th iteration :
Here f(1.3875)=-0.00152<0 and f(1.39062)=0.00332>0
∴ Now, Root lies between 1.3875 and 1.39062
x7=(1.3875+1.390622)/2=1.38906
f(x7)=f(1.38906)=21.38906+0.51.38906-3=0.0009>0
9th iteration :
Here f(1.3875)=-0.00152<0 and f(1.38906)=0.0009>0
∴ Now, Root lies between 1.3875 and 1.38906
x8=(1.3875+1.389062)/2=1.38828
f(x8)=f(1.38828)=21.38828+0.51.38828-3=-0.00031<0
10th iteration :
Here f(1.38828)=-0.00031<0 and f(1.38906)=0.0009>0
∴ Now, Root lies between 1.38828 and 1.38906
x9=(1.38828+1.389062)/2=1.38867
f(x9)=f(1.38867)=21.38867+0.51.38867-3=0.00029>0
11th iteration :
Here f(1.38828)=-0.00031<0 and f(1.38867)=0.00029>0
∴ Now, Root lies between 1.38828 and 1.38867
x10=(1.38828+1.388672)/2=1.38848
f(x10)=f(1.38848)=21.38848+0.51.38848-3=-0.00001<0
12th iteration :
Here f(1.38848)=-0.00001<0 and f(1.38867)=0.00029>0
∴ Now, Root lies between 1.38848 and 1.38867
x11=(1.38848+1.388672)/2=1.38857
f(x11)=f(1.38857)=21.38857+0.51.38857-3=0.00014>0
13th iteration :
Here f(1.38848)=-0.00001<0 and f(1.38857)=0.00014>0
∴ Now, Root lies between 1.38848 and 1.38857
x12=(1.38848+1.388572)/2=1.38853
f(x12)=f(1.38853)=21.38853+0.51.38853-3=0.00006>0
14th iteration :
Here f(1.38848)=-0.00001<0 and f(1.38853)=0.00006>0
∴ Now, Root lies between 1.38848 and 1.38853
x13=(1.38848+1.388532)/2=1.3885
f(x13)=f(1.3885)=21.3885+0.51.3885-3=0.00003>0
15th iteration :
Here f(1.38848)=-0.00001<0 and f(1.3885)=0.00003>0
∴ Now, Root lies between 1.38848 and 1.3885
x14=(1.38848+1.38852)/2=1.38849
f(x14)=f(1.38849)=21.38849+0.51.38849-3=0.00001>0
16th iteration :
Here f(1.38848)=-0.00001<0 and f(1.38849)=0.00001>0
∴ Now, Root lies between 1.38848 and 1.38849
x15=(1.38848+1.388492)/2=1.38848
f(x15)=f(1.38848)=21.38848+0.51.38848-3=0<0
Approximate root of the equation 2x+(1/2)x-3=0 using Bisection mehtod is 1.38848 (After 16 iterations)
n a f(a) Sign f(a) b f(b) Sign f(b) c=a+b2 Error f(c) Sign f©
1 1 -0.5 - 1.4 0.01794 + 1.2 .1 -0.26733 -
2 1.2 -0.26733 - 1.4 0.01794 + 1.3 .05 -0.13158 -
3 1.3 -0.13158 - 1.4 0.01794 + 1.35 0.025 -0.05859 -
4 1.35 -0.05859 - 1.4 0.01794 + 1.375 0.0125 -0.02077 -
5 1.375 -0.02077 - 1.4 0.01794 + 1.3875 0.00625 -0.00152 -
6 1.3875 -0.00152 - 1.4 0.01794 + 1.39375 -0.00313 0.00818 +
7 1.3875 -0.00152 - 1.39375 0.00818 + 1.39062 -0.00156 0.00332 +
8 1.3875 -0.00152 - 1.39062 0.00332 + 1.38906 0.00078 0.0009 +
9 1.3875 -0.00152 - 1.38906 0.0009 + 1.38828 0.00039 -0.00031 -
10 1.38828 -0.00031 - 1.38906 0.0009 + 1.38867 -0.00019 0.00029 +
11 1.38828 -0.00031 - 1.38867 0.00029 + 1.38848 0.00001 -0.00001 -
12 1.38848 -0.00001 - 1.38867 0.00029 + 1.38857 -0.00004 0.00014 +
13 1.38848 -0.00001 - 1.38857 0.00014 + 1.38853 0.00001 0.00006 +
14 1.38848 -0.00001 - 1.38853 0.00006 + 1.38854 -0.00005 0.00003 +
15 1.38848 -0.00001 - 1.3885 0.00003 + 1.38849 -0.00001 0.00001 +
16 1.38848 -0.00001 - 1.38849 0.00001 + 1.38848 - -

You might also like