Lecture 5
Lecture 5
−𝑏 ± 𝑏 2 − 4𝑎𝑐
𝑎𝑥 2 + 𝑏𝑥 + 𝑐 = 0 ⇒ 𝑥=
2𝑎
•But
5 4 3 2
𝑎𝑥 + 𝑏𝑥 + 𝑐𝑥 + 𝑑𝑥 + 𝑒𝑥 + 𝑓 = 0 ⇒ 𝑥 =?
sin 𝑥 + 𝑥 = 0 ⇒ 𝑥 =?
1
Solution of Nonlinear
Equation
2
Bracketing Methods
(Or, two point methods for finding roots)
6
The Bisection Method
For the arbitrary equation of one variable, f(x) = 0
1. Pick xl and xu such that they bound the root of interest,
check if f(xl) × f(xu) < 0.
2. Estimate the root by evaluating f[(xl+xu)/2].
3. Find the pair
• If f(xl) × f[(xl+xu)/2] < 0, root lies in the lower
interval, then xu= (xl+xu)/2 and go to step 2.
7
• If f(xl) × f[(xl+xu)/2] > 0, root
lies in the upper interval, then
xl= [(xl+xu)/2, go to step 2. xl + xu
xl −
2
100%
• If f(xl) × f[(xl+xu)/2]=0, then xl + xu
root is (xl+xu)/2 and 2
terminate. or
xl + xu
• Compare es with ea xu −
2
100%
xl + xu
• If ea< es, stop. Otherwise
2
repeat the process.
8
9
Evaluation of Bisection Method
Pros Cons
• Easy • Slow
• Always find root • Know a and b that bound root
• Number of iterations • Multiple roots
required to attain an • No account is taken of f(xl) and
absolute error can be f(xu), if f(xl) is closer to zero, it
computed a priori. is likely that root is closer to xl.
10
How Many Iterations will It Take?
• Length of the first Interval Lo= b-a
• After 1 iteration L1= Lo/2
• After 2 iterations L2= Lo/4
•…
• After k iterations Lk= Lo/2k or k = ln2(Lo/Lk)
Lk
e a 100% ea es
x
11
es x −4
• If the absolute magnitude of the error is = 10
100%
and Lo= 2, how many iterations will you have to do to get
the required accuracy in the solution?
−4 2
10 = k 2 = 2 10
k 4
k 14.3 = 15
2
12
Problem Solving
Problem Statement. Use bisection method to locate the root of f (x) =
x10 − 1 between x = 0 and 1.3.
Solution. Using bisection, the results can be summarized as
εa = |(xl - xr)/xr|*100% and εt = |(Root – xr)/Root|*100%
Iteration xl xu xr=(xl+xu)/2 εa (%) εt (%)
1 0 1.3 0.65 100.0 35
2 0.65 1.3 0.975 33.3 2.5
3 0.975 1.3 1.1375 14.3 13.8
4 0.975 1.1375 1.05625 7.7 5.6
5 0.975 1.05625 1.015625 4.0 1.6
Thus, after five iterations, the true error is reduced to less than 2%.
13
Problem Solving
• Use bisection method to determine the value of √3 between x = 1 and 2.
• Solution: Let, x = √3 or, x2 = 3, or f(x) = x2 – 3 = 0 Root = 1.7320508
• f(1) = -2 (-ve) and f(2) = 1 (+ve)
εa = |(xl - xr)/xr|*100% and εt = |(Root – xr)/Root|*100%
Iteration xl xu xr=(xl+xu)/2 εa (%) εt (%)
1 1 2 1.5 33 13
2 1.5 2 1.75 14.28 ?
3 1.5 1.75 ? ? ?
4 ?? ?? ? ? ?
5 ?? ?? ?? ?? ??
Thus, after five iterations, the absolute error is reduced to less than ?%.
14