You are on page 1of 22

09/12/2021

KING FAISAL UNIVERSITY


COLLEGE OF ENGINEERING

Engr310 – Numerical Methods for Engineers

Lecture 02: Roots of Equations – Brackiting Methods


Brackiting
Methods
Majdi Adel
T o
Bisection False Position
method method

We learned that we can use the quadratic formula to solve a


polynomial of the second degree (quadratic equation)
! # 12
𝑎𝑥 + 𝑏𝑥 + 𝑐 = 0 -

am "J&
"

)9
−𝑏 ± 𝑏 − 4𝑎𝑐
𝑥 = -61k¥

,
2𝑎
ji 0%14%1,61685
At 6, ? How
But what about polynomial of higher degrees or more complex functions? Is
it possible to find an analytical solution? If not, how to find the roots?
numercial methods )lKñj

In this chapter and the next chapter we will learn how to apply
different numerical algorithms to find the roots of different
types of equations
Engr310 – Numerical Methods for Engineers Majdi Adel 2

1
09/12/2021

✓ 1561 58,1M DGM.

Non-linear equations can be solved:


Graphically
Not the scope of this course
Bracketing methods ②
① Bisection and False position methods

Open methods • •
① Fixed point iteration, Newton-Raphson and secant methods

The last two methods are iterative

Engr310 – Numerical Methods for Engineers Majdi Adel 3

Roots
Roots problems occur when some function f can be written in terms of one or
more dependent variables x, where the solutions to f(x) = 0 yields the solution
to the problem

These problems often occur when a design problem presents an


implicit equation for a required parameter

Engr310 – Numerical Methods for Engineers Majdi Adel 4

2
09/12/2021

✗ us ✗ iiia # , # 3- a-
IN ☆

ntsb Hibs.NU#r.sXuWQlt-&I&WoX-sw1d-&-w-ss ☆
Xugx # How -

Bracketing Methods
They are based on making two initial
guesses that bracket the root
Brackets are formed by finding two guesses xl
and xu where the sign of the function changes;
that is, where f(xl) f(xu) < 0

Then, incremental search method is applied to


tests the value of the function at certain
intervals and finds brackets by identifying
function sign changes between neighboring
points XL Xu
Xugxi ) ' # www.N
fcxr) ))

ojc.YIW8.ms
Engr310 – Numerical Methods for Engineers Majdi Adel 5

Incremental Search Hazards


f(xl) f(xu) < 0, One
f(xl) f(xu) > 0,
root is tangent –
But we have too
Problem again
roots – That is a
problem
.

✗ us ✗ e) 41
f(xl) f(xu) > 0,
No roots – No
problem
f(xl) f(xu) < 0,
But we have i.HN

Xu three roots – Atlas #
That is another MÑl >
↑ xr
problem Wal - g

f(xl) f(xu) < 0, bi -6


Perfect Single root – 9£11
case No problem did f(xl) f(xu) < 0, Discontinuous
function – Big problem
Engr310 – Numerical Methods for Engineers Majdi Adel 6

3
09/12/2021
Xr 791g Xi Xu f. I'M j§
☆ Number of itte rations : .
g ,

n=É where ☆To find ✗


ri d
:-

'S 1092 Lo Xu Xi
To / ✗ -1×4
-
-
-

v19 - avarice
✗r
I

i-j@I1MGEiIEwiEa.d.Es
.Ñ4é 100
% '

is

91481
Whips ,
=

2
Tolarancetl ① I Ea

The Bisection
a

Method
☆ we should also find :-

Engr310 – Numerical Methods for Engineers Majdi Adel


Ea :| ✗
rnew
/ ✗ 100%
7

Et=×% / ✗
rtrue
✗ 100%

Bisection Method
Is a variation of the incremental search method in which the interval is always divided
in half Pick xl and xu that they Calculate the relative
bound the root, check if Evaluate the value of the approximate error εa if
f(xl) f(xu) < 0 function at the midpoint xr εa < εs stop
1 3 5

2 4
If f(xl) f(xr) < 0 If f(xl) f(xr) > 0
The root xr is located at then the root is located OR then the root is located
the mid between xl and xu between xl and xr between xu and xr
Engr310 – Numerical Methods for Engineers Majdi Adel 8


4
The Bisection Method
☆ Step ① : .

g ✗ dip .w1 Xu ÷d g × , d . . - I

DWI 1046 :-&# 2 ; 8 g Xu


: w

f- ( ✗ 4. f( ✗ a) < 0
☆ step ② : -

↳ "@i" 71 - Xu g Xi &- Xr ji & &


i.
04 01 10 g
✗L 1- Xu
Xp =

☆ Step ③ : .

.
:
logical condition JI ☆ w ,# I & @ s - l

① f- ( ✗ ↳ fcxr ) ( 0 : -

✗r im XL
"
'

Xu = g

• • I •

✗ L Xr Xr Xu
d
Xu × ? #
2 fcxisfcxr ) >0 : -

th
XL = ✗r Xu " 9

×: % 1. %
✗ LA ? Aid
upper interval
f- ( ✗e) fcxrko
f- (X1 ) sik Xi , Xu ? × , #
# fcxu )
I 1 I

g①g
✗ ✗ fcxcsfcxr) > 0 ✗u
,
9 XLJI EX , #
lower d
is Xu ×"
×,
interval

lower JI gi upper 1 & & 5- . , #


Xr ) é µ →
.
%oi I @ to # I Is
☆Step ④ : -

Eajl £ ! Aid's Ea {
t.wizljob-sg.ES
r
g

A&t
Approximates
relative
error

-
True
relative
error
09/12/2021

Note that
𝑥 +𝑥
𝑥 =
2
𝑥 −𝑥
𝜀 = × 100%
𝑥

Engr310 – Numerical Methods for Engineers Majdi Adel 9

Pros and Cons

Pros Cons
 Easy  Slow
 Always find root  You must know xl and xu that
 Number of iterations required to bound the root
attain an absolute error can be  Multiple roots!
computed a priori (we will see this  No account is taken of f(xl) and
in the next slide) f(xu). If f(xl) is closer to zero, it is
likely that the root is closer to xl

Engr310 – Numerical Methods for Engineers Majdi Adel 10

5
09/12/2021

How Many Iterations will it Take?


Initial interval length
The absolute error of the bisection method is xu – xl
solely dependent on the absolute error at the 𝐿
𝐸 =
start of the process (the space between the two 2
guesses) and the number of iterations: Approximate Number of
error iterations

The required number of iterations to obtain a -


𝐿 Xu -

XI
particular approximate error can be calculated log
based on the initial guesses: 𝐸 ,
𝑛=
log 2
iterations) I is Klug
Desired approximate error
j g- -61 1- a # Ea = εs / 100%
I e

Engr310 – Numerical Methods for Engineers Majdi Adel 11

☆To find ✗r : .

✗r = ✗a -
Éu)
fcx , ) - fcxu)

The False-
Position
Method
Regula-Falsi ☆ we should also find :-

Engr310 – Numerical Methods for Engineers Majdi Adel


Ea =
/ ✗r
new
✗ 100%
12

Et=×É/ ✗
r
true
✗ too %

6
09/12/2021

iterations JI ↳ & is I root N bg I :# I ☆

False-Position Method
Another bracketing method that
determines the next guess not by
splitting the bracket in half but by
connecting the endpoints with a straight
line and determining the location of the
intercept of the straight line xr

𝑓 𝑥 𝑥 −𝑥 ☆
𝑥 =𝑥 −
𝑓 𝑥 −𝑓 𝑥

The algorithm is the same as the


bisection method

Engr310 – Numerical Methods for Engineers Majdi Adel 13

Bisection vs. False Position


Bisection method is faster and always converges for a single
root.
However, it depends on the shape of the function (functions
with significant curvature)
𝑓 𝑥 =𝑥 −1

We will solve this in the next slides


and see the difference between
both methods

Engr310 – Numerical Methods for Engineers Majdi Adel 14

7
False Position Method
☆ Step ① : .

g ✗ dip .w1 ✗ uÑg × , Ñ . so I

DWI 1046 :-&# 2 ; 8 g Xu


: w

f ( ✗ 4. f( ✗ a) < 0
☆ step ② : -

ji
"

↳ É MI - Xu g Xi "& Xr is &
i.
04 01 10 g
faut CK ✗§
Xr
-

= ✗u -

fcxi ) fcxul
-

☆ Step ③ : .

.
:
logical condition JI µ w ,# I & @ so I

① f- ( ✗ ↳ fcxr ) ( 0 : -

✗r im XL &
"
'

Xu = g

• • I •

✗ L Xr Xr Xu
d
Xu × ? #
2 fcxisfcxr ) >0 : -

th
XL = ✗r Xu " 9

× : % 1. %
XLX ? Aid
upper interval
f- ( ✗e) fcxrko
f- (X1 ) sik Xi , Xu ? × , #
# fcxu )
I 1 I

¥É ¥
" fcxcsfcxr) > 0 Xu
9 XL JI ×, #
lower sima ×.
,

lower JI gi upper 1 & & 5- . , #


XrJciN.o.ijois@i1b5JlI.d
.

I g

☆Step ④ : -

Eajl £ ! Did't r Ea g {t.ws 21 , ok @ &


,
éb 6

q.im /
M .
Eg Ñ 1

Approximates
relative
error

/
True
relative
error
Assisi "

° # Iwi #
f.
b-# 901%61*1 As by :b %
Example : .

Find root of ✗3-1×+1=0


Using Bisection method :

i. Bisection method climb is JAI 14 ! .

i. WI 661 Jsu 2% .

fcxi) fcxu) ,Xr


fcxrj-kxufcxuliEa.it/L---L,Xu--L?MgHXuJ1gXLJI
I XL , Xu ,
, , ,

i ✗I ✗a fcx , ) fcxu) Xr fcxrifaaifcxr, Ea

I -1 I - I 3 0 L - ve -

2 - I 0 - I 1 -0.5 0.375 -
ve look
3 -
I -0.5 -
I 0.375 -0.75 -0.171 + Ve 33.33%
4 -0.75 -0.5 -0.171 0.375 -0.625 0.13086 - Ve 20%
' /
' ^ 7 f
, , ,

'

I 1 I 1 I
,
1 I 1
l
I 1 ' I
1 I
1
I
I 1 1
1 I I 1
1
I 1 I [
1 I
! I
HJ4@g1bqrqwGiXugX.H.G ☆
fcxi ) -13-1 C- 1) + I
= = - 1 ,
fcxy) 13+1+1
= =
3
- ← I f. I Ñ
@ v. . & job ! Xr Mi g
I -13 0
Xr
-

= =

2
- :
✗r w JI Ñ go ↳
&
f- (Xr ) = 023+0-1 I = I

:@to co
µ.
# Xi g Xu M I & ¥ . ¥1
It -0,481 :&!

t.is#Jg1&Ea.-i6.WLW.W1iibIlIfcxr.Ifcxyo.H
.
4 g-

i ji µ ☆

- ✗a % ✗ r AJ g
6 É Xi É

- Ea .ws I ↳ % WI IN# Ñ&


.
.

±Érdd_ ✗
Ea =
/ ✗ rnew / 100

✗r new →id "÷Wj I

=/
5
✗ roid-s.IQ
°
100%
/ ✗ 100
- ◦ • -

-
O - 5

WI ai
#JI & fcxr) & fcxyu.is ⇐ t it & ☆

- ✗ I & ✗ rz.M-ig.ph d- ✗ a J - 7. &


EaLEsji@ij.JfbJ1HMoA.E
.

'd Is
"

WI %.sk ! V11 OH I
I jlb-511 is
g HWI ji ⑥ I &
09/12/2021

Example
Find the roots of the following function using (five iterations):
 Bisection method
 False position method
And calculate the number of iterations for the bisection method to have εs = 0.1%
Also calculate true relative error (true root is 1.000) and approximate relative error (εt and εa)
Use: xl = 0, xu = 1.3
𝑓 𝑥 =𝑥 −1

Engr310 – Numerical Methods for Engineers Majdi Adel 15

Bisection method
𝑓 1 = 0 − 1 = −1.000 𝑥 −𝑥
𝜀 = × 100%
𝑓 1.3 = 1.300 − 1 = 12.786 𝑥
𝑥 +𝑥 𝑥 −𝑥 ,
𝑥 = 𝜀 = × 100%
2 𝑥
0 + 1.300 1.000 − 0.650
= = 0.650 = × 100% = 35.000%
2 1.000

i xl xu f(xl) f(xu) xr f(xr) f(xl) f(xr) εt εa


IF [f(xl) f(xr) < 0] 1 0 1.300 –1.000 12.786 0.650 –0.987 + 35.000% --
True: xu = xr
2 0.650 1.300 –0.987 12.786 0.975 –0.224 + 2.500% 33.333%
False: xl = xr
3 0.975 1.300 –0.224 12.786 1.138 2.627 – 13.750% 14.286
4 0.975 1.138 –0.224 2.627 1.056 0.728 – 5.625% 7.692%
5 0.975 1.056 –0.224 0.728 1.016 0.168 – 1.563% 4.000%

Engr310 – Numerical Methods for Engineers Majdi Adel 16

8
09/12/2021

False position method


𝑓 1 = 0 − 1 = −1.000 𝑥 −𝑥
𝜀 = × 100%
𝑓 1.3 = 1.300 − 1 = 12.786 𝑥
𝑓 𝑥 𝑥 −𝑥 𝑥 −𝑥 ,
𝑥 =𝑥 − 𝜀 = × 100%
𝑓 𝑥 −𝑓 𝑥 𝑥
12.786 0 − 1.300 1.000 − 0.094
= 1.300 = × 100% = 90.570%
−1.000 − 12.786 1.000
= 0.0940

i xl xu f(xl) f(xu) xr f(xr) f(xl) f(xr) εt εa


IF [f(xl) f(xr) < 0] 1 0.000 1.300 –1.000 12.786 0.094 ≈–1.000 + 90.570% --
True: xu = xr
2 0.094 1.300 –0.987 12.786 0.182 ≈–1.000 + 81.824% 48.118%
False: xl = xr
3 0.182 1.300 –0.987 12.786 0.263 ≈–1.000 + 73.713% 30.857%
4 0.263 1.300 –0.987 2.627 0.338 ≈–1.000 + 66.189% 22.251%
5 0.338 1.300 –0.987 0.728 0.408 ≈–1.000 + 59.212% 17.106%

Engr310 – Numerical Methods for Engineers Majdi Adel 17

Number of iterations for the bisection method to have εs = 0.1%


𝐿 1.3 − 0
log 𝐸 log
, 0.001
𝑛= = = 10.34 ≈ 11 𝑖𝑡𝑒𝑟𝑎𝑡𝑖𝑜𝑛𝑠
log 2 log 2

We will see this when we solve this example using Excel

Engr310 – Numerical Methods for Engineers Majdi Adel 18

9
€6s &.ws old ☆
Hit # 1 is
it# is
µ ";jµjl JIM # rest d
on

i am

⇐ ☆ to :&@ I Ishi is

i -wid.com.bd?e--w1Xr+rue
n

Haidt # WWI 2481,6 ! 41


'

→ A > W &

Significant
" "

Bisection method : _

1516

2%9 ! ,

I ]
fcxi ) fco) O' I -1.000
°
= = - =

f- ( ✗a) f- ( 1. 3) =L 3%1=12.786
= .

✗r =
1-3-10
= 0.650 → fcxr )=f(o 6501=0.650 .
"
-1=-0.987
2

Et =
/ €650
I
/ ✗ too = 35.000%

✗I = Xr = 0.650 Xu =L -3000
Ñ WI .
I
#I É # g

I
@ AN old# g- Wig
i.
ji I ↳ Em ; . iterations JI is Mi is Ii !

n =
#Hadj É = = 10.34 ≈ 11
log 2 1 09 mating

false position method : -

.jp His § it # if
09/12/2021

Example
Determine the positive real root of ln (x4) = 0.7, using three iteration with xl = 0.5 and xu = 2 by:
 Bisection method lncx ) -0-7=0 ← 9%0 A Wi # 148
"
>

 False position method


ii. WI µ.iq#liu.lcXrJ1u.wfi.bo
true

Bisection method i xl xu f(xl) f(xu) xr f(xr) f(xl) f(xr) εa


1 0.500 2.000 3.472 2.072 1.250 0.192 -
ve -

2 0.500 1.250 -3.472 0.192 0.875 -1.234 + ve 42.857%

3 0-875 2.250 -1.234 0.192 1062 -0.457 + ve 17.647%

False position method i xl xu f(xl) f(xu) xr f(xr) f(xl) f(xr) εa


1 0.500 2.000 -3-472 2.072 1.439 0.756 - ve -

2 0.500 1.439 -3.472 0.756 1.271 0.260 - ve 13.221%

3 0.500 1271 -3-472 a. 260 1.217 0.087 -


ve 4.413%

Engr310 – Numerical Methods for Engineers Majdi Adel 19

Example
For the function below, determine the roots, analytically, using bisection method and false position
method, with xl = 1 and xu = 3. Compute the approximate error εa and the true error εt after each
iteration. Is there a problem with the result?
𝑓 𝑥 = 0.8 − 0.3𝑥 𝑥
Bisection method i xl xu f(xl) f(xu) xr f(xr) f(xl) f(xr) εa εt
1 1.000 3.000
2
3

False position method i xl xu f(xl) f(xu) xr f(xr) f(xl) f(xr) εa εt


1 1.000 3.000
2
3
Engr310 – Numerical Methods for Engineers Majdi Adel 20


10
:..Ñ -61 . ÑJXr+ruÑ÷bso↳
Ig ) ! Ñ ↳I>
£941
0.8-0-3 ✗


*
0.8-0.37=0
→ ✗i. 2.66667
0=◦;? true

0.500 -0.033 2.000 0.100 1- Ve -


25.000%
2. 0003-000 0.100 -0.033 2.500 0.025 + Ve 20.000% 6.250%
2.500 3. ooo 0.025 o -
Loo 2.750 -0.009 -
ve 9.090%3 -125%

f- ( ✗ c) = 11=0.5 fcxu)=_Él= -0.03


3

Xr -
_

1+-23=2 fcxr
)=_É= 0.1

Et :/ É
2. 66667
/ ✗
100=25 -000%
✗ v.
2+2-3=2.5 far )= -0.025

Ea= / / ✗ 100 -_ 20%

Et
=/ 2-6666-7-21
2.66667 / ✗ 100=6.258

fcxrt.IE#=-o.oo9
✗ r=
-2%3=2.75 275

Ea
:/ 2--72%-51×100=9.090%0
0.5 -0.033 2- 875 -0.0217 - ve -
7.8125%

1.000 2.875 0.5 -0-027 2.796 -0^014 -


ve 2.7933% 4.882%

1. ooo 2.79 0.5 -0.014 2.748 -0.0089 - ve 1.7768% 3.0518%

✗ rjéGJ ! Wig
09/12/2021

Example
The velocity v of a falling parachutist is given by the equation below, where g = 9.8 m/s2. For a
parachutist with a drag coefficient C = 15 kg/s, compute the mass m so that the velocity is v = 35 m/s
at t = 9 s. Use the false-position method to determine m to a level of εs = 0.1%
𝑔𝑚 ⁄
𝑣= 1−𝑒
𝐶
i xl xu f(xl) f(xu) xr f(xr) f(xl) f(xr) εa
1 50.000 70.000
2
3
4
5

Engr310 – Numerical Methods for Engineers Majdi Adel 21

11

You might also like