Pertemuan 2 Euler
Pertemuan 2 Euler
h
x
x0 x1 x2 x3 xr-1 xr xr+1
Euler’s Method: Tangent Line Approximation
Recall that a first order initial value problem has the form
dy
f (t , y ), y (t0 ) y0
dt
If f and f /y are continuous, then this IVP has a unique solution
y = (t) in some interval about t0.
When the differential equation is linear, separable or exact,
we can find the solution by symbolic manipulations.
However, the solutions for most differential equations of this
form cannot be found by analytical means.
Therefore it is important to be able to approach the problem in
other ways.
For our first order initial value problem
y f (t , y ), y (t0 ) y0 ,
an alternative is to compute approximate values of the solution y
= (t) at a selected set of t-values.
Ideally, the approximate solution values will be accompanied by
error bounds that ensure the level of accuracy.
There are many numerical methods that produce numerical
approximations to solutions of differential equations.
In this section, we examine the tangent line method, which is also
called Euler’s Method.
EULER, LÉONARD
Euler, Léonard
1707-1783
EULER’S METHOD: TANGENT LINE APPROXIMATION
For the initial value problem
y f (t , y ), y (t0 ) y0 ,
where fn = f(tn,yn).
For a uniform step size h = tn – tn-1, Euler’s formula becomes
yn 1 yn f n h, n 0,1, 2,
EULER APPROXIMATION
To graph an Euler approximation, we plot the points
(t0, y0), (t1, y1),…, (tn, yn), and then connect these points with
line segments.
yn 1 yn f n t n 1 t n , where f n f t n , yn
EULER METHOD: INTEGRAL EQUATION
We could write problem as an integral equation. That is, since y
= (t) is a solution of y' = f(t,y), y(t0) = y0, we have
f t , (t ) dt
t n1 t n 1
tn
(t )dt
tn
or
(t n1 ) (t n ) t n 1 f t , (t ) dt
t
n
yn 1 yn f (t n , yn ) t n 1 t n , n 0,1, 2,
EULER METHODS: : TAYLOR SERIES
A third approach is to assume the solution y = (t) has a Taylor series
about t = tn. Then
1
(t ) (t n ) (t n ) t t n (t n ) t t n 2
2!
Since h = tn+1 – tn and ' = f(t, ), it follows that
1
(t n 1 ) (t n ) f t n , (t n ) h (t n )h 2
2!
If the series is terminated after the first two terms, and if we replace
(tn+1) and (tn) by their approximations yn+1 and yn, then once again
we obtain Euler’s formula:
yn 1 yn f (t n , yn ) t n 1 t n , n 0,1, 2,
Further, using a Taylor series with remainder, we can estimate the
magnitude of error in this formula (later in this section).
EXAMPLE 1: EULER’S METHOD
From table below, we see that the errors are small. This is
most likely due to round-off error and the fact that the exact
solution is approximately linear on [0, 0.4]. Note:
yexact yapprox
Percent Relative Error 100
yexact
7 1 11 2t
Exact Solution : y t e
4 2 4
EXAMPLE 2: ERROR ANALYSIS & GRAPHS
the exact solution (red) plotted together with the Euler approximation
(blue).
exact
solution
exact
solution
Euler app.
Euler app.
EXAMPLE 3:
dy
x y; y (0) 0
dx
25
dy
h = 0.05 x y; y (0) 0
x=0 y(0) = 0
dx
x = 0.05 y(0.05) = 0 + 0.05(0+0) = 0
x = 0.1 y(0.1) = 0 + 0.05(0.05+0) = 0.0025
h = 0.02
x=0 y(0) = 0
x = 0.02 y(0.02) = 0 + 0.02(0+0) = 0
x = 0.04 y(0.04) = 0 + 0.02(0.02+0) = 0.0004
x = 0.06 y(0.06) = 0.004 +0.02(0.04+0.004) = 0.001208
x = 0.08 y(0.08) = 0.001208 +0.02(0.06+0.001208) = 0.00243216
x = 0.1 y(0.1) = 0.00243216 + 0.02(0.08+0.00243216)
= 0.0040808032
y(0.1) = e0.1-0.1-1 = 0.00517091807564762
Langkah h = 0.02 lebih teliti 26
Nilai yi+1 hanya bergantung pada nilai-nilai xi dan
nilai yi . Dengan menggunakan syarat awal y(0)= y0
nilai-nilai fungsi yi untuk i = 1,2,3,… dapat
ditentukan.
kesalahan pemotongan
lokal orde kedua O(h 2 )
kesalahan pemotongan global O(h)
27
Besar dan sifat kesalahan pemotongan pada metode Euler
dapat dijelaskan dari deret Taylor.
y1 y0 f ( x0 , y0 )x
Think in
terms of
Taylor’s If the true solution were a straight line, then
expansion Euler is exact 30
ERROR ANALYSIS
(FROM TAYLOR’S EXPANSION)
31
CUMULATIVE ERROR
y
32
x
Remark:
x Error
x=0 x=T
But computation time
, dengan i = 1,2,3,.....
33
dan seterusnya.
34
Euler kesalahan
t eksak
eksplisit mutlak
0.0 -2.000 -2.000 0.000
0.1 -1.900 -1.900 0.000
0.2 -1.801 -1.803 0.002
0.3 -1.705 -1.709 0.004
0.4 -1.614 -1.620 0.006
0.5 -1.529 -1.538 0.009
0.6 -1.451 -1.463 0.012
0.7 -1.381 -1.396 0.015
0.8 -1.319 -1.336 0.017
0.9 -1.266 -1.284 0.018
1.0 -1.220 -1.238 0.019
1.1 -1.180 -1.200 0.019
1.2 -1.148 -1.166 0.019
1.3 -1.120 -1.138 0.018
1.4 -1.098 -1.115 0.017
1.5 -1.079 -1.095 0.016
1.6 -1.064 -1.078 0.014
1.7 -1.052 -1.065 0.013
1.8 -1.041 -1.053 0.012
1.9 -1.033 -1.044 0.010
2.0 -1.027 -1.036 0.009
-1
-1.2 app
eksak
y -1.4
-1.6
-1.8
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
t
0.02
0.015
0.01
e rr o r
0.005
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
t
BACKWARD EULER FORMULA
The backward Euler formula is derived as follows. Let y = (t) be
the solution of y' = f(t,y). At t = tn, we have
f t n , (t n )
Using a backward difference quotient for ', it follows that
(tn ) (t n 1 )
f t n , (t n )
t n t n 1
Note that this equation implicitly defines yn+1, and must be solved
in order to determine the value of yn+1.
BACKWARD EULER FORMULA
(METODE EULER IMPLISIT)
Masalah nilai awal
Example 5
Penyelesaian: .
Jika diasumsikan bilangan positif yang cukup besar
maka penyelesaian akan berubah dengan cepat
→ bagian eksponsial bernilai cukup dekat dengan nol.
→ penyelesaian akan berubah secara lambat mengikuti
.
38
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
y = exp(- t)
0.2 y = t2
y = y = exp(- t) + t2
0.1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
t
39
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
t 40
Metode Euler implisit juga dapat diturunkan melalui deret Taylor
:
′ ′′
′
(suku orde kedua
dihilangkan)
, dengan i = 1,2,3,.......
41
Skema yang implisit :
nilai bergantung pada nilai-nilai dan
nilai
42
Metode Euler implisit diturunkan dari deret Taylor
dengan membuang suku orde dua
43
-1
-1.1
-1.2
-1.3
-1.4
-1.5
-1.6
-1.9
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
t 44
0.02
0.018
0.016
0.014
0.012
0.01
0.008
0.006
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
t