Академический Документы
Профессиональный Документы
Культура Документы
Eulers Method
Eulers Method
dy
f x, y , y 0 y 0
dx
True value
x0,y0
Slope
y1,
Predicted
value
Rise
Run
y1 y 0
x1 x0
f x0 , y 0
Step size, h
x
y1 y 0 f x0 , y 0 x1 x0
y0 f x0 , y0 h
Eulers Method
h xi 1 xi
True Value
and
is
illustrated
graphically in Figure 2.
yi
h
Step size
xi
xi+1
Eulers Method
Modified Eulers method :
Heuns Method
Eulers Method
Predictor :
yi01 yi f ( xi , yi ) h
f ( xi , yi ) f ( xi 1 , yi01 )
Corrector : yi 1 yi
h
2
Eulers Method
Uses
yi 1/ 2
h
yi f ( xi , yi )
2
yi 1 yi f ( xi 1/ 2 , yi 1/ 2 )h
Eulers Method
Truncation error
Eulers Method
We can use Taylor series to quantify the local truncation error in Eulers
method.
Given y' f ( x , y )
"
i
( n)
i
y 2
y
h ...
h n Rn
2!
n!
f ' ( x i , yi ) 2
f ( n1) ( x i , y i ) n
yi 1 yi f ( x i , yi )h
h ...
h O( h n1 )
2!
n!
yi 1 yi yi' h
EULER
f ( xi , yi ) 2
h R3
2!
f ( xi , yi ) 2
Ea
h O(h 2 )
2!
Ea
In real problems, the derivatives used in the Taylor series are not easy to
obtain.
If the solution to the differential equation is linear, the method will provide
error free predictions (2nd derivative is zero for a straight line).
Eulers Method
Example
dy
2 y 1.3e x , y 0 5
dx
is rewritten as
dy
1.3e x 2 y, y 0 5
dx
In this case
f x, y 1.3e x 2 y
Eulers Method
Find the temperature at t = 480 seconds using Eulers method. Assume a step
size of h = 240 seconds.
Eulers Method
Solution step 1:
d
2.2067 10 12 4 81 10 8
dt
f t , 2.2067 10 12 4 81 10 8
i 1 i f ti , i h
1 0 f t0 , 0 h
1200 f 0,1200 240
106.09 K
240 1 106.09 K
Eulers Method
Solution step 2:
For i 1,
t1 240, 1 106.09
2 1 f t1 , 1 h
106.09 f 240,106.09 240
Runge-Kutta Methods
yi 1 yi ( xi , yi , h) h
a1k1 a2 k 2 an k n
IncrementFunction
a ' s areconstants
k1 f ( xi , yi )
k 2 f ( xi p1h, yi q11k1h)
p s andq s areconstants
k3 f ( xi p3 h, yi q21k1h q22 k 2 h)
Runge-Kutta Methods
Runge-Kutta Methods
dy
f ( x, y ), y (0) y0
dx
k1 f xi , yi
1
1
k2 f xi h, yi k1h
2
2
1
1
k3 f xi h, yi k2 h
2
2
k4 f xi h, yi k3h
Runge-Kutta Methods
d
2.2067 10 12 4 81 10 8 , 0 1200 K
dt
Find the temperature at t = 480 seconds using Runge-Kutta 4 th order
method. Assume a step size of h = 240 seconds.
d
2.2067 10 12 4 81 10 8
dt
f t , 2.2067 10 12 4 81 108
i 1 i
1
k1 2k 2 2k 3 k 4 h
6
Runge-Kutta Methods
Solution step 1:
i 0, t0 0, 0 (0) 1200
1
1
1
1
Runge-Kutta Methods
Solution step 1:
1
k1 2k2 2k3 k4 h
6
1
1200 4.5579 2 0.38347 2 3.8954 0.069750 240
6
1
1200 2.1848 240
6
675.65 K
1 0
240 1 675.65K
Runge-Kutta Methods
Solution step 2:
i 1, t1 240, 1 675.65K
1
1
1
1
Runge-Kutta Methods
Solution step 2:
1
k1 2k2 2k3 k 4 h
6
1
675.65 0.44199 2 0.31372 2 0.34775 0.25351 240
6
1
675.65 2.0184 240
6
594.91K
2 1
References
http://mat.iitm.ac.in
http://en.m.wikipedia.org/wiki/Euler_method
http://en.m.wikipedia.org/wiki/Runge-Kutta_methods
http://www.classzone.com
http://mathforcollege.com
Certificate
Sign
Mira Y Patel
K
N
A
H
T
U
O
Y