Lecture 3
Lecture 3
COLLEGE OF ENGINEERING
Majdi Adel
Value
converge
↓
or
diverge
faster than bracketing method
Open Methods
They are based on formulas that require only a single starting value or two
starting values that do not necessarily bracket a root
9, #I
✗ = . . . .
gcx ) @
bias # I @I
f- ( X)
i.
. sat
Eg : -
=
✗ 2- ✗ -2=0
Iginla
Fixed Point Iteration ↳*
%b1gxos.dz ,
121216*16*-1
-;
19
or
⇐ ✗ = ✗ 2- 2
É+2 → 9# =
f-(✗ 1=0 → 9. CX ) = ✗ or
¥ -2¥?0 931*1--1 -1¥
→
The new function g(x) is used to predict a new value of x. that is, xi+1 = g(xi)
[email protected]
④
The relative approximate error is given by:
𝑥 −𝑥
𝜀 = × 100%
𝑥
,Ea%iEt%
Et=×¥ 1×100%0 INN #
11
true
value
Engr310 – Numerical Methods for Engineers Majdi Adel 4
Fixed Point Iteration Steps : .
.
gcxiojs A few W ①
of ☆1 It ⇐
"
f- ✗=
"
ébogcxi .
. _ . .
convergence / gixo) / ( I
• • 0.51-b≥ "
1€
"
,
89T Cow .
.
⇐
I
.
}I
.ci?.?JlXi-i?W9cxj.%Ea.-1iibs A & ④ .
.
Xi +1 µ ✗i & £
657 I ✗
it , ⇐
Example True root __
0.56714329
Use simple fixed point iteration to locate the root of the below function with an initial guess of x0 = 0.
Use 10 iterations ①
◦ → 10 𝑓 𝑥 =𝑒 −7-
𝑥 ◦
.gl/YJljs.&.-J
✗i # ¥81 % @ I •
Js # £5
>
⊖
e-
91×1 :X i
.
x.WWII:@ iwslg.AM?ijVoQ.Wl
=
Step 3: Continue until the specified tolerance εs or the number of iterations is reached
✗ 0+1 = e- → × ,
= e- =L Ea and Et from
the laws .
②
¥
'
'
,=é✗2 ✗}= e-
e- ✗ 2- e- 0387870
✗
µ,
= _
= 0.367879 ③ ✗
z,
#
A 2911
iwslg ①&
↳ ✗it
'
d
= -
e- = -121
converging
𝑓 𝑥 =𝑥 −𝑥−2 𝑔 𝑥 =𝑥 = 𝑥−2
2
𝑔 𝑥 =𝑥 =1+
𝑥
Engr310 – Numerical Methods for Engineers Majdi Adel 7
fixed-point iteration converges if, in the region of interest
if the magnitude of the slope of g(x) is less than the slope
of the line f(x) = x
+
NAI I'M .
0£09 # A#
iiEE
I
µ win
mix * * a ' ~ pig
& Xi
.
# .MX IN
g. j§ is
# I ✗ in wk is
w-t.WIII.ws .
True roof
Engr310 – Numerical Methods for Engineers Majdi Adel 8
Convergence Divergence
→ Ig soot , MAN
I -
91×1 iys A Howl :b ①
.
:b -61g MAJHI
Note : -
X -
tank ) -0
JI , >
* lit ✗
it ,
= tancxi )
tan (✗ i )
'
:# HIM :& ✗ in
-
jl.HN .
: Jg Epi ②
① ✗ it , = tan ( X ;) : -
ji { t.IO
true value ibso
4W .
Ea ji ↳ &
Ning Ñ
'
→ divergence
② ✗ it , = tan-1 ( × ;) : -
i• Eaji ↳ * &
→ convergence
Find the roots of fcx ,
"
= ✗ + ✗ -1 ? ✗◦ = 0
→ Ig shot , MAN ÷
> 1 .
91×1 iys A ↳I :b ①
.
:b -61g TAJ §) I
✗2-1×-1=0
✗ i -11 = ¥+1 ,
I
✗ it
,
=
: Jg # 1 Igi ②
¥5
-
① ✗ in = : -
ji { t.IO
true value ios 6
i• Eaji ↳ * &
→ convergence
② ✗ it , = TEXT : -
4W .
Ea ji ↳ &
Ning Ñ
'
→ divergence
Newton-
Raphson
Method
is 1 ;
Is ↳ Is • WI Gil Lt is 1 if big
Mimi 6
.M
•
𝑓 𝑥
𝑥 =𝑥 − Newton-Raphson formula
𝑓 𝑥
-
W ffxjo.gl rfcx, g. A Wijk .
①
:& JI w iterations JI I µ I ↳ Is ⑨
• 3 iterations .W § ⇐
Or Le 2 - 3 ⇐
- : 11 & if Is ⑨
.
i
/ / Xi
/
fcxi ) fixis / Ea
/ Et
↓ I
↳ in true sews so &
root
At
↳ éw ! Igloo WWI ✗◦ wig W' Is Xi ②
• ✗i-11 4 ↳
✗ i -110.6J is # § I 04 # Xia b & ⇐
. Ea 7 I IN @ 9 It
Example
Solve the previous example using Newton-Raphson method with the same initial guess
𝑓 𝑥 =𝑒 −𝑥
jfcxi.at oh ↳ % It f- .
ji-wmjs.gs
Step 1: Find the derivative f’(x) [
𝑓= −𝑒 − 1 Ai 81
𝑥 =𝑥 −
𝑒 −𝑥
MA ' -
1-I
−𝑒 − 1
Step 2: Start with the initial guess x0 = 0
Some functions show slow or poor convergence (functions with local minima/maxima,
asymptotes)
Near-zero slopes leads to jump to a location several roots Zero slopes are disaster because it causes division by zero
away in the Newton-Raphson formula
fcx )=✗2+X -
I ✗ 0=0 , Es=0 -01%
i.ly/.-j ①
,
FIX )= 2×+1
i. Earfcxi ) fali ) ( -
Xiii Us .
# • Is # £ 'M ⑨
1=0 : .
H1N1 I. ↳↳
gbq.X.im?-w.8--&!xi-.Ws
Wtem & @ INK
i=1 : -
- :
Xiii -6.21 jus -61 Ciws
✗ it =
Xi -
i ✗
,=✗o -
te
,
f 'CXi ) F'( ✗ ol
= 0 -
= 0 + I = 1
I =3
j-w.si r I -2
-
d-
Convergence
:X true = I f. 6 His ④ WI isl b
↳ is 1
Convergence Et W
The Secant
Method
8 > WI
#I
bing.b.ci
& @
-6%1
This method requires two initial guesses xi–1 and xi, that are not necessarily
bracket the root. Therefore it is NOT a bracketing method
Engr310 – Numerical Methods for Engineers Majdi Adel 16
The Secant Method Steps : .
.
✗i 9 ✗
i. , f. I kiss £ ①
g) I w iterations JI I µ I W Is "
• 3 iterations .W § ⇐
Or Le 2 i 3 ⇐
i. DWI I D) j
.
G -
J g D.) I ⑨
i
/ ✗ i.,
/ /fcxi.is/fcxii/Xi+iI.Ea /
✗
i Et
d d
do I
him As
root
.
µ true
-
ji Wt & ✗
i., I ✗it I & .
Xiao .
↳ ②
& ✗i ✗
g E. in 9 ✗ in AIX i 69 ⇐
E N D.) I ✗ i ↳ JIMI I
<
. . +, v.
In case Es = 0 -10%
Example
Solve the previous example using secant method. Start with initial estimates of x−1 = 0 and x0 = 1.0
𝑓 𝑥 =𝑒 −𝑥
𝑒 −𝑥 𝑥 −𝑥
𝑥 =𝑥 −
𝑒 −𝑥 − 𝑒 −𝑥
o # MET a
i xi – 1 xi xi + 1 εt εa
1 giv@
0.00 1.000 O
0.613 8.0326% 63.212%
2 1.000
-0.613 ro
0.564 0.5827% 8.666%
-01
-
3 0.613 0.564 0.567 0.0048% 0.587%
jéÑwr .
f- (X ) = ✗ 21-11 -
I ✗ i. 1=0
✗ i = 1
Es = o -
o I %
i. Ear fcxij-fcxi.gr ✗ i
•
✗ it % jb.IS?Jt
go ✗ it 9 WI Xi -
II. &V1 -
ji Wtop I 5141
Multiple
Roots
This function has roots at all the same Substituting and rearranging:
locations as the original function f(x).
Therefore we can apply Newton-Raphson ☆ 𝑥 =𝑥 −
𝑓 𝑥 𝑓 𝑥
method to find its roots: 𝑓 𝑥 −𝑓 𝑥 𝑓 𝑥
𝑢 𝑥
𝑥 =𝑥 − Modified Newton-Raphson formula
𝑢 𝑥
idea ¥ .
Jg # if, jiwlii 4
f- Ex, D ↳ sat
"
Newton -
Raph
"
son
- : Mt I & i § Is ⑨
i
/ /
✗i fail / /
fix it fix it / /
Ea Et
d I
aim true sins so &
root
At
↳ éw ! Igloo WWI ✗◦ wig WI > Xi ②
• ✗i-11 ? ↳
Xiao ↳ is #
.
§ I 04 # Xia b & ⇐
. Ea 7 I IN @ 9 Jj I
In case : -
Use both the standard and modified Newton-Raphson methods to evaluate the multiple root of
function below, with an initial guess of x0 = 0 ex ) -3×2-10×+7
f' -
𝑓 𝑥 = 𝑥 − 5𝑥 + 7𝑥 − 3 f "( ✗ 1=6×-10
Convergence
In this part we will see how to find the roots of a set of simultaneous
nonlinear equations in the form:
𝑓 𝑥 ,𝑥 ,…,𝑛 = 0
𝑓 𝑥 ,𝑥 ,…,𝑛 = 0
.
The solution of this system consists of a set of x
. values that simultaneously result in all the
. equations equaling ZERO
𝑓 𝑥 ,𝑥 ,…,𝑛 = 0 e.
g : -
I ↳I
:@ ↳ -
>
-
✗ = →
gcx,
£-181
- - . .
↳ gig
Y= . . .
→
gcyj
Values
. -
:-c ¥ -
1%1+1%1<1
1%-1+1%-1<1
Engr310 – Numerical Methods for Engineers Majdi Adel 27
Example
+ Newton Raphson
method
Use fixed-point iteration(
to determine the roots of the following nonlinear set of equations. Initiate
the computation with guesses of x = 1.5 and y = 3.5
Note that a correct pair of roots is x = 2 and y = 3 Es = 0.10%
𝑢 𝑥, 𝑦 = 𝑥 + 𝑥𝑦 − 10 = 0
𝑣 𝑥, 𝑦 = 𝑦 + 3𝑥𝑦 − 57 = 0
. .
-
8 >↳ I 7 I ①
① U : -
equ ① : - ✗y = 10 -
✗ ✗
µ,
=
egu ② : . ✗2=10 - ✗
y ✗ it
,
= FÉ
② V : -
2
57 3 Xi Yi
equ ① Y
: - = -
i + I
equ ② : .
3×72=57 -
y → %, =
-53T¥
E. a # at if I
g ski:D > b N bl It F-
Cow @ .
8,41 # I 631 g # is I do gi
M im
'
For ✗ =
and 1=57-3 Xi Yi ? -
µ, i + I
HI & b- I j£ Hb NJ Ea ul 11 If I
divergence
WE
"
✗ s Yi s Xi I - ✗ in on
.
# ;D I v.
HH g Xi -11 WI C- I I Yi+.-"
Yi Éñ
For ✗
ix. = FEI and Yin : -
convergence
* Newton : .
.
: 6--681 Nest ①
:& -
,
ZU / 211,24/04,24211 ,2V / 04 ,Ex , Ey
𝑢 𝑥, 𝑦 = 𝑥 + 𝑥𝑦 − 10 = 0 → 𝑥 = 10 − 𝑥 𝑦
57 − 𝑦
𝑣 𝑥, 𝑦 = 𝑦 + 3𝑥𝑦 − 57 = 0 → 𝑦 =
3𝑥
Now, we use the first equation to find a new value of xi+1, using the initial guesses. Then we calculate
the value of yi+1 from the second equation using the new xi+1
Continue with the iterations until the relative approximate error in both of xi+1 and yi+1 reaches the
specified stopping criteria
𝜕𝑢 𝜕𝑢
+ <1
𝜕𝑥 𝜕𝑦
𝜕𝑣 𝜕𝑣
+ <1
𝜕𝑥 𝜕𝑦
Or in matrix form
𝜕𝑢 𝜕𝑢 𝑥 𝜕𝑢 𝜕𝑢
−𝑢 + 𝑥 +𝑦
𝜕𝑥 𝜕𝑦 𝜕𝑥 𝜕𝑦
=
𝜕𝑣 𝜕𝑣 𝜕𝑣 𝜕𝑣
−𝑣 + 𝑥 +𝑦
𝜕𝑥 𝜕𝑦 𝑦 𝜕𝑥 𝜕𝑦
Jacobian matrix