Docsity

Euler Method-Numerical Analysis-Lecture Handouts, Lecture notes of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
Numerical Analysis –MTH603 VU
© Copyright Virtual University of Pakistan 1
E
EU
UL
LE
ER
R
M
ME
ET
TH
HO
OD
D
E
Eu
ul
le
er
r
m
me
et
th
ho
od
d
i
is
s
o
on
ne
e
o
of
f
t
th
he
e
o
ol
ld
de
es
st
t
n
nu
um
me
er
ri
ic
ca
al
l
m
me
et
th
ho
od
ds
s
u
us
se
ed
d
f
fo
or
r
i
in
nt
te
eg
gr
ra
at
ti
in
ng
g
t
th
he
e
o
or
rd
di
in
na
ar
ry
y
d
di
if
ff
fe
er
re
en
nt
ti
ia
al
l
e
eq
qu
ua
at
ti
io
on
ns
s.
.
T
Th
ho
ou
ug
gh
h
t
th
hi
is
s
m
me
et
th
ho
od
d
i
is
s
n
no
ot
t
u
us
se
ed
d
i
in
n
p
pr
ra
ac
ct
ti
ic
ce
e,
,
i
it
ts
s
u
un
nd
de
er
rs
st
ta
an
nd
di
in
ng
g
w
wi
il
ll
l
h
he
el
lp
p
u
us
s
t
to
o
g
ga
ai
in
n
i
in
ns
si
ig
gh
ht
t
i
in
nt
to
o
n
na
at
tu
ur
re
e
o
of
f
p
pr
re
ed
di
ic
ct
to
or
r-
-c
co
or
rr
re
ec
ct
to
or
r
m
me
et
th
ho
od
d
C
Co
on
ns
si
id
de
er
r
t
th
he
e
d
di
if
ff
fe
er
re
en
nt
ti
ia
al
l
e
eq
qu
ua
at
ti
io
on
n
o
of
f
f
fi
ir
rs
st
t
o
or
rd
de
er
r
w
wi
it
th
h
t
th
he
e
i
in
ni
it
ti
ia
al
l
c
co
on
nd
di
it
ti
io
on
n
y
y(
(t
t0
0)
)
=
=
y
y0
0.
.
(, )
dy
f
ty
dt =
T
Th
he
e
i
in
nt
te
eg
gr
ra
al
l
o
of
f
t
th
hi
is
s
e
eq
qu
ua
at
ti
io
on
n
i
is
s
a
a
c
cu
ur
rv
ve
e
i
in
n,
,
t
ty
y-
-p
pl
la
an
ne
e.
.
H
He
er
re
e,
,
w
we
e
f
fi
in
nd
d
s
su
uc
cc
ce
es
ss
si
iv
ve
el
ly
y
y
y1
1,
,
y
y2
2,
,
…
…,
,
y
ym
m;
;
w
wh
he
er
re
e
y
ym
m
i
is
s
t
th
he
e
v
va
al
lu
ue
e
o
of
f
y
y
a
at
t
t
t
=
=t
tm
m
=
=
t
t0
0
+
+m
mh
h,
,
m
m
=
=1
1,
,
2
2,
,…
…
a
an
nd
d
h
h
b
be
ei
in
ng
g
s
sm
ma
al
ll
l.
.
H
He
er
re
e
w
we
e
u
us
se
e
a
a
p
pr
ro
op
pe
er
rt
ty
y
t
th
ha
at
t
i
in
n
a
a
s
sm
ma
al
ll
l
i
in
nt
te
er
rv
va
al
l,
,
a
a
c
cu
ur
rv
ve
e
i
is
s
n
ne
ea
ar
rl
ly
y
a
a
s
st
tr
ra
ai
ig
gh
ht
t
l
li
in
ne
e.
.
T
Th
hu
us
s
a
at
t
(
(t
t0
0,
,
y
y0
0)
),
,
w
we
e
a
ap
pp
pr
ro
ox
xi
im
ma
at
te
e
t
th
he
e
c
cu
ur
rv
ve
e
b
by
y
a
a
t
ta
an
ng
ge
en
nt
t
a
at
t
t
th
ha
at
t
p
po
oi
in
nt
t.
.
T
Th
he
er
re
ef
fo
or
re
e,
,
00
0
00
(, ) 0
(, )
ty
yy
dy
f
ty
dt t t
−
 ==
 −

That is 0000
()(,)yy ttfty=+−
H
He
en
nc
ce
e,
,
t
th
he
e
v
va
al
lu
ue
e
o
of
f
y
y
c
co
or
rr
re
es
sp
po
on
nd
di
in
ng
g
t
to
o
t
t
=
=
t
t1
1
i
is
s
g
gi
iv
ve
en
n
b
by
y
1010 00
()(,)yy ttfty=+−
S
Si
im
mi
il
la
ar
rl
ly
y
a
ap
pp
pr
ro
ox
xi
im
ma
at
ti
in
ng
g
t
th
he
e
s
so
ol
lu
ut
ti
io
on
n
c
cu
ur
rv
ve
e
i
in
n
t
th
he
e
n
ne
ex
xt
t
i
in
nt
te
er
rv
va
al
l
(
(t
t1
1,
,
t
t2
2)
)
b
by
y
a
a
l
li
in
ne
e
t
th
hr
ro
ou
ug
gh
h
(
(t
t1
1,
,
y
y1
1)
)
h
ha
av
vi
in
ng
g
i
it
ts
s
s
sl
lo
op
pe
e
f
f(
(t
t1
1,
,
y
y1
1)
),
,
w
we
e
o
ob
bt
ta
ai
in
n
21 11
(, )yyhfty=+
T
Th
hu
us
s,
,
w
we
e
o
ob
bt
ta
ai
in
n
i
in
n
g
ge
en
ne
er
ra
al
l,
,
t
th
he
e
s
so
ol
lu
ut
ti
io
on
n
o
of
f
t
th
he
e
g
gi
iv
ve
en
n
d
di
if
ff
fe
er
re
en
nt
ti
ia
al
l
e
eq
qu
ua
at
ti
io
on
n
i
in
n
t
th
he
e
f
fo
or
rm
m
o
of
f
a
a
r
re
ec
cu
ur
rr
re
en
nc
ce
e
r
re
el
la
at
ti
io
on
n
1(, )
mm mm
yyhfty
+=+
G
Ge
eo
om
me
et
tr
ri
ic
ca
al
ll
ly
y,
,
t
th
hi
is
s
m
me
et
th
ho
od
d
h
ha
as
s
a
a
v
ve
er
ry
y
s
si
im
mp
pl
le
e
m
me
ea
an
ni
in
ng
g.
.
T
Th
he
e
d
de
es
si
ir
re
ed
d
f
fu
un
nc
ct
ti
io
on
n
c
cu
ur
rv
ve
e
i
is
s
a
ap
pp
pr
ro
ox
xi
im
ma
at
te
ed
d
b
by
y
a
a
p
po
ol
ly
yg
go
on
n
t
tr
ra
ai
in
n,
,
w
wh
he
er
re
e
t
th
he
e
d
di
ir
re
ec
ct
ti
io
on
n
o
of
f
e
ea
ac
ch
h
p
pa
ar
rt
t
i
is
s
d
de
et
te
er
rm
mi
in
ne
ed
d
b
by
y
t
th
he
e
v
va
al
lu
ue
e
o
of
f
t
th
he
e
f
fu
un
nc
ct
ti
io
on
n
f
f
(
(t
t,
,
y
y)
)
a
at
t
i
it
ts
s
s
st
ta
ar
rt
ti
in
ng
g
p
po
oi
in
nt
t.
.
E
Ex
xa
am
mp
pl
le
e
G
Gi
iv
ve
en
n
dy y t
dt y t
−
=+
w
wi
it
th
h
t
th
he
e
i
in
ni
it
ti
ia
al
l
c
co
on
nd
di
it
ti
io
on
n
y
y
=
=
1
1
a
at
t
t
t
=
=
0
0.
.
U
Us
si
in
ng
g
E
Eu
ul
le
er
r
m
me
et
th
ho
od
d,
,
f
fi
in
nd
d
y
y
a
ap
pp
pr
ro
ox
xi
im
ma
at
te
el
ly
y
a
at
t
x
x
=
=
0
0.
.1
1,
,
i
in
n
f
fi
iv
ve
e
s
st
te
ep
ps
s.
.
S
So
ol
lu
ut
ti
io
on
n
S
Si
in
nc
ce
e
t
th
he
e
n
nu
um
mb
be
er
r
o
of
f
s
st
te
ep
ps
s
a
ar
re
e
f
fi
iv
ve
e,
,
w
we
e
s
sh
ha
al
ll
l
p
pr
ro
oc
ce
ee
ed
d
i
in
n
s
st
te
ep
ps
s
o
of
f
(
(0
0.
.1
1)
)/
/5
5
=
=
0
0.
.0
02
2.
.
T
Th
he
er
re
ef
fo
or
re
e,
,
t
ta
ak
ki
in
ng
g
s
st
te
ep
p
s
si
iz
ze
e
h
h
=
=
0
0.
.0
02
2,
,
w
we
e
s
sh
ha
al
ll
l
c
co
om
mp
pu
ut
te
e
t
th
he
e
v
va
al
lu
ue
e
o
of
f
y
y
a
at
t
t
t
=
=
0
0.
.0
02
2,
,
0
0.
.0
04
4,
,
0
0.
.0
06
6,
,
0
0.
.0
08
8
a
an
nd
d
0
0.
.1
1
Thus 10 00
(, ),yyhfty=+ where 00
1, 0yt
=
=
docsity.com
pf3
pf4
pf5

Partial preview of the text

Download Euler Method-Numerical Analysis-Lecture Handouts and more Lecture notes Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

EEUULLEERR MMEETTHHOODD

EEuulleerr mmeetthhoodd iiss oonnee ooff tthhee oollddeesstt nnuummeerriiccaall mmeetthhooddss uusseedd ffoorr iinntteeggrraattiinngg tthhee oorrddiinnaarryy

ddiiffffeerreennttiiaall eeqquuaattiioonnss.. TThhoouugghh tthhiiss mmeetthhoodd iiss nnoott uusseedd iinn pprraaccttiiccee,, iittss uunnddeerrssttaannddiinngg wwiillll

hheellpp uuss ttoo ggaaiinn iinnssiigghhtt iinnttoo nnaattuurree ooff pprreeddiiccttoorr--ccoorrrreeccttoorr mmeetthhoodd

CCoonnssiiddeerr tthhee ddiiffffeerreennttiiaall eeqquuaattiioonn ooff ffiirrsstt oorrddeerr wwiitthh tthhee iinniittiiaall ccoonnddiittiioonn yy (( tt (^00)

) =)= yy (^00)

dy f t y dt

TThhee iinntteeggrraall ooff tthhiiss eeqquuaattiioonn iiss aa ccuurrvvee iinn,, tyty - -ppllaannee..

HHeerree,, wwee ffiinndd ssuucccceessssiivveellyy yy 11

,, yy (^22)

, …,…,, yy mm

;; wwhheerree yy mm

isis tthhee vvaalluuee ooff yy atat tt == tt m m

== tt 00

++ mhmh ,,

mm ==11,, 22,,…… aanndd hh bbeeiinngg ssmmaallll..

HeHerree wwee uussee aa pprrooppeerrttyy tthhaatt iinn aa ssmmaallll iinntteerrvvaall,, aa ccuurrvvee iiss nneeaarrllyy aa ssttrraaiigghhtt lliinnee.. TThhuuss aatt

(( tt (^00)

,, yy 00

)),, wwee aapppprrooxxiimmaattee tthhee ccuurrvvee bbyy aa ttaannggeenntt aatt tthhaatt ppooiinntt..

ThTheerreeffoorree,,

0 0

0 0 0 ( , ) 0

t y

dy y y f t y dt t t

  =^ =

That is y = y 0 (^) + ( t − t 0 (^) ) f t ( 0 (^) , y 0 )

HHeennccee,, tthhee vvaalluuee ooff yy ccoorrrreessppoonnddiinngg ttoo tt == tt 11

iiss ggiivveenn bbyy

1 0 1 0 0 0 y = y + ( t − t ) f t ( , y )

SSiimmiillaarrllyy aapppprrooxxiimmaattiinngg tthhee ssoolluuttiioonn ccuurrvvee iinn tthhee nneexxtt iinntteerrvvaall (( tt 11

,, tt 22

)) bbyy aa lliinnee tthhrroouugghh

(( tt (^11)

,, yy 11

)) hhaavviinngg iittss ssllooppee ff((tt 11

,, yy 11

)),, wwee oobbttaaiinn

y 2 (^) = y 1 (^) + hf t ( , 1 (^) y 1 )

TThhuuss,, wwee oobbttaaiinn iinn ggeenneerraall,, tthhee ssoolluuttiioonn ooff tthhee ggiivveenn ddiiffffeerreennttiiaall eeqquuaattiioonn iinn tthhee ffoorrmm ooff aa

rreeccuurrrreennccee rreellaattiioonn

ym (^) + 1 = ym + hf t ( (^) m , ym )

GGeeoommeettrriiccaallllyy,, tthhiiss mmeetthhoodd hhaass aa vveerryy ssiimmppllee mmeeaanniinngg.. TThhee ddeessiirreedd ffuunnccttiioonn ccuurrvvee iiss

aapppprrooxxiimmaatteedd bbyy aa ppoollyyggoonn ttrraaiinn,, wwhheerree tthhee ddiirreeccttiioonn ooff eeaacchh ppaarrtt iiss ddeetteerrmmiinneedd bbyy tthhee

vvaalluuee ooff tthhee ffuunnccttiioonn^ ff^ (( tt,, yy )) aatt iittss ssttaarrttiinngg ppooiinntt..

Ex Exaammppllee

GGiivveenn^

dy y t

dt y t

wiwitthh tthhee iinniittiiaall ccoonnddiittiioonn (^) yy (^) == 11 aatt tt (^) == 00.. UUssiinngg EEuulleerr mmeetthhoodd,, ffiinndd yy

aapppprrooxxiimmaatteellyy aatt xx == 00..11,, iinn ffiivvee sstteeppss..

So Solluuttiioonn

SSiinnccee tthhee nnuummbbeerr ooff sstteeppss aarree ffiivvee,, wwee sshhaallll pprroocceeeedd iinn sstteeppss ooff ((00..11))//55 == 00..0^02 2..

TThheerreeffoorree,, ttaakkiinngg sstteepp ssiizzee

hh == 00..0 02 2,, wwee sshhaallll ccoommppuuttee tthhee vvaalluuee ooff yy aatt

tt^ = 0=0..0^02 2,, 00..0^04 4,, 00..0^06 6,, 00..0^08 8 aanndd 00..1^1

Thus y 1 (^) = y 0 (^) + hf t ( 0 (^) , y 0 ), where y 0 (^) = 1, t 0 = 0

Therefore (^1)

y

Similarly,

2 1 1 1

3 2 2 2

4 3 3 3

5 4 4 4

y y hf t y

y y hf t y

y y hf t y

y y hf t y

HHeennccee tthhee vvaalluuee ooff^ yy^ ccoorrrreessppoonnddiinngg ttoo^ tt^ == 00..11 iiss 11..0^09911

ExExaammppllee

Solve the differential equation

/ y = x + y ; y (0) = 1

in the interval [0,0.5] using Euler’s method by taking h=0.

Soution:

0 0

1 0 0 0

1

1 1

2 1 1 1

2

(0) 1 here x 0 1

Since h so we calculate values at x

y y

y y hf x y

y

y x

y y hf x y

y

0 x 0

x 1

2 x 0.

x 3

4 x 0.

x 5

((MMooddiiffiieedd EEuulleerr’’ss MMeetthhoodd))

GGeeoommeettrriiccaallllyy,, ffrroomm FFiigguurree,, iiff LL 11

iiss tthhee ttaannggeenntt aatt (( tt 00

,, yy (^00)

),), LL

iiss tthhee lliinnee tthhrroouugghh (( tt (^11)

yy 11

)) ooff ssllooppee^ f(f(tt 11

,, yy 11

)) anandd (^) LL

isis tthhee lliinnee tthhrroouugghh (t(t 11

,, yy 11

))^ bbuutt wwiitthh aa ssllooppee eeqquuaall ttoo

tthhee aavveerraaggee ooff^ ff((tt 00

,,yy 00

))^ aanndd^ f(f(tt 11

,, yy 11

)) ,…,….. tthhee lliinnee (^) LL ththrroouugghh (( tt 00

,, yy 00

)) aanndd ppaarraalllleell ttoo^ L

iiss uusseedd ttoo aapppprrooxxiimmaattee tthhee ccuurrvvee iinn tthhee iinntteerrvvaall (( tt 00

,,^ tt 11

TThhuuss,, tthhee oorrddiinnaattee ooff tthhee ppooiinntt BB wwiillll ggiivvee tthhee vvaalluuee ooff yy 11

NNooww,, tthhee eeqquuaattiioonn ooff tthhee lliinnee^ ALAL^ iiss ggiivveenn bbyy

(1) 0 0 1 1 1 0 1 0

f t y f t y y y t t

(1) 0 0 1 1 0

f t y f t y y h

SSiimmiillaarrllyy pprroocceeeeddiinngg,, wwee aarrrriivvee aatt tthhee rreeccuurrrreennccee rreellaattiioonn

(1) 1 1 1

m m m m m m

f t y f t y y y h

1 1

( t , y )

0 0

( t , y )

1 1

( t , y ) L

2

L

L

−

L 1

A

B

0

y

t

TThhiiss iiss tthhee^ mmooddiiffiieedd EEuulleerr’’ss mmeetthhoodd ..

Ex Exaammppllee

UUssiinngg mmooddiiffiieedd EEuulleerr’’ss mmeetthhoodd,, oobbttaaiinn tthhee ssoolluuttiioonn ooff tthhee ddiiffffeerreennttiiaall eeqquuaattiioonn

dy t y f t y dt

wwiitthh tthhee iinniittiiaall ccoonnddiittiioonn

yy 0 0

= 1=1 aatt (^) tt 0 0

= 0=0 ffoorr tthhee rraannggee 0 ≤ t ≤ 0.6inin sstteeppss ooff 00..2 2

So Solluuttiioonn

AAtt ffiirrsstt,, wwee uussee EEuulleerr’’ss mmeetthhoodd ttoo ggeett

(1) 1 0 0 0 y = y + hf t ( , y ) = 1 + 0.2(0 + 1) =1.

TThheenn,, wwee uussee mmooddiiffiieedd EEuulleerr’’ss mmeetthhoodd ttoo ffiinndd

(1) 0 0 1 1 1 0

f t y f t y y y y h

SSiimmiillaarrllyy pprroocceeeeddiinngg,, wwee hhaavvee ffrroomm EEuulleerr’’ss mmeetthhoodd

(1) 2 1 ( , 1 1 )^ 1.2295^ 0.2(0.2^ 1.2295)

y = y + hf t y = + +

UUssiinngg mmooddiiffiieedd EEuulleerr’’ss mmeetthhoodd,, wwee ggeett^

(1) 1 1 2 2 2 1

f t y f t y y y h

( 0.2^ 1.2295^ ) ( 0.4^ 1.4913)

FFiinnaallllyy,,

(1) 3 2 (^2 ,^2 )^ 1.5225^ 0.2 0.4^ 1.

y = y + hf t y = + +

MMooddiiffiieedd EEuulleerr’’ss mmeetthhoodd ggiivveess

(1) 2 2 3 3 3 2

f t y f t y y y y h

= + ^ + + + 

HHeennccee,, tthhee ssoolluuttiioonn ttoo tthhee ggiivveenn pprroobblleemm iiss ggiivveenn bbyy