Lecture 3
Lecture 3
Numerical Methods
[MA-200]
Root Finding Problems
Many problems in Science and Engineering are expressed as:
1. Analytical Solutions
2. Graphical Solutions
3. Numerical Solutions
1. Analytical Methods
−𝑏 ± 𝑏 2 − 4𝑎𝑐
𝑅𝑜𝑜𝑡𝑠 =
2𝑎
Example:
𝑥 − 𝑒 −𝑥 = 0
Root ≈ 0.6
3. Numerical Methods
• Bisection Method
• Secant Method
𝑎+𝑏
𝑥1 =
2
iv. Calculate f(𝑥1 ), then find f(𝑥1 ).f(a) and f(𝑥1 ).f(b)
If f(𝑥1 ).f(a) < 0 then f(x)=0 has solution in [a, 𝑥1 ] and no solution in [𝑥1 ,b]
If f(𝑥1 ).f(b) < 0 then f(x)=0 has solution in [ 𝑥1 , b] and no solution in [a, 𝑥1 ]
𝑥= 2
𝑥 = 1.4142
Let, 𝑓 𝑥 = 𝑥2 − 2
𝑓 0 = 02 − 2 = −2
𝑓 1 = 12 − 2 = −1
𝑓 2 = 22 − 2 = 2
𝑓 3 = 32 − 2 = 7
𝑓 1 . 𝑓 2 = −1 . 2 = −2 < 0
𝑎+𝑏
𝑥1 =
2
1+2 3
𝑥1 = = = 1.5
2 2
Step:4
As, 𝑓 1.5 . 𝑓 1 < 0. So, root lies in [1.0, 1.5] and no solution in [1.5, 2].
𝑥1 + 𝑎 1.5 + 1
𝑥2 = = = 1.25
2 2
2nd Iteration: 𝑓 𝑥2 = 𝑓(1.25) = 1.252 − 2 = −0.4375
𝑓 𝑥2 . 𝑓 𝑥1 = 𝑓 1.25 . 𝑓 1.5 = −0.4375 . 0.25 = −0.10941
𝑓 𝑥2 . 𝑓 𝑎 = 𝑓 1.25 . 𝑓 1 = −0.4375 . −1 = 0.4375
As, 𝑓 1.25 . 𝑓 1.5 < 0. So, root lies in [1.25, 1.5] and no solution in [1, 1.25].
Cont.
𝑥1 + 𝑥2 1.5 + 1.25
𝑥3 = = = 1.375
2 2
As, 𝑓 1.375 . 𝑓 1.5 < 0. So, root lies in [1.375, 1.5] and no solution in [1.25, 1.375].
𝑥1 + 𝑥3 1.5 + 1.375
𝑥4 = = = 1.4375
2 2
As, 𝑓 1.4375 . 𝑓 1.375 < 0. So, root lies in [1.4375,1.375] and no solution in [1.4375, 1.5].
Cont.
𝑥3 + 𝑥4 1.375 + 1.4375
𝑥5 = = = 1.4063
2 2
5th Iteration: 𝑓 𝑥5 = 𝑓(1.4063) = 1.40632 − 2 = −0.0223
𝑓 𝑥5 . 𝑓 𝑥3 = 𝑓 1.4063 . 𝑓 1.375 = −0.0223 . −0.1094 = 0.0024
𝑓 𝑥5 . 𝑓 𝑥4 = 𝑓 1.4063 . 𝑓 1.4375 = −0.0223 . 0.0664 = −0.0015
As,𝑓 1.4063 . 𝑓 1.4375 < 0. So, root lies in [1.4063,1.4375] and no
solution in [1.375, 1.4063].
𝑥4 + 𝑥5 1.4375 + 1.4063
𝑥6 = = = 1.4219
2 2
6th Iteration:
𝑓 𝑥6 = 𝑓(1.4219) = 1.42192 − 2 = 0.0218
𝑓 𝑥6 . 𝑓 𝑥4 = 𝑓 1.4219 . 𝑓 1.4375 = 0.0218 . 0.0664 = 0.0014
𝑓 𝑥6 . 𝑓 𝑥5 = 𝑓 1.4219 . 𝑓 1.4063 = 0.0218 . −0.0223 = −0.0005
As,𝑓 1.4219 . 𝑓 1.4063 < 0. So, root lies in [1.4063,1.4219] and no
solution in [1.4219, 1.4375].
Cont.
𝑥5 + 𝑥6 1.4063 + 1.4219
𝑥7 = = = 1.4141
2 2
Step: 5
𝑥𝑛+1 − 𝑥𝑛 ≤ 𝜖
n=1, 𝑥1+1 − 𝑥1 = 𝑥2 − 𝑥1 = 1.25 − 1.5 = 0.25
n=2, 𝑥2+1 − 𝑥2 = 𝑥3 − 𝑥2 = 1.375 − 1.25 = 0.125
n=3, 𝑥3+1 − 𝑥3 = 𝑥4 − 𝑥3 = 1.4375 − 1.375 = 0.0625
n=4, 𝑥4+1 − 𝑥4 = 𝑥5 − 𝑥4 = 1.4063 − 1.4375 = 0.0312
n=5, 𝑥5+1 − 𝑥5 = 𝑥6 − 𝑥5 = 1.4219 − 1.4063 = 0.0156
n=6, 𝑥6+1 − 𝑥6 = 𝑥7 − 𝑥6 = 1.4141 − 1.4219 = 0.0078 ≤ 10−2
Advantages
• Simple and easy to implement
• The size of the interval containing the zero is reduced by 50% after
each iteration
Exercise: 2.1