Professional Documents
Culture Documents
Ordinary Differential Equations: Topic: Euler Method
Ordinary Differential Equations: Topic: Euler Method
f x, y , y 0 y 0
dy
True value
dx
y1, Predicted
. Rise value
Slope x0,y0 Φ
Run
y1 y0
Step size, h
x1 x0
f x0 , y 0 x
y1 y0 f x0 , y0 x1 x0
Figure 1. Graphical interpretation of the first step of Euler’s method
y0 f x0 , y0 h
2
Euler’s Method
y
Φ
yi
h
Step size
x
xi xi+1
3
How to write Ordinary Differential
Equation
How does one write a first order differential equation in the form of
f x, y
dy
dx
Example
2 y 1.3e x , y 0 5
dy
dx
is rewritten as
1.3e x 2 y, y 0 5
dy
dx
In this case
f x, y 1.3e x 2 y
4
Example
A ball at 1200K is allowed to cool down in air at an ambient temperature
of 300K. Assuming heat is lost only due to radiation, the differential
equation for the temperature of the ball is given by
d
dt
2.2067 10 12 4 81 108 , 0 1200 K
Find the temperature at t 480 seconds using Euler’s method. Assume a step size of
h 240 seconds.
d
dt
2.2067 10 12 4 81 10 8
f t , 2.2067 10 12 4 81108
i 1 i f t i , i h
5
Solution
Step 1: 1 0 f t 0 , 0 h
1200 f 0,1200240
1200 2.2067 10 12 1200 4 81108 240
1200 4.5579240
106.09K
t t1 t 0 h 0 240 240
1 240 106.09K
6
Solution Cont
Step 2: For i 1 , t1 240 , 1 106.09
2 1 f t1,1 h
106.09 f 240,106.09240
106.09 2.2067 10 12 106.09 4 81108 240
106.09 0.017595240
110.32K
2 is the approximate temperature at
t t 2 t1 h 240 240 480
2 480 110.32K
7
Solution Cont
(480) 647.57 K
8
Comparison of Exact and
Numerical Solutions
1400
1200
Temperature, θ(K)
1000
Exact Solution
800
600
400
h=240
200
0
0 100 200 300 400 500
Time, t(sec)
9
Effect of step size
500
h=120
h=240
0
0 100 200 300 400 500
-500
Tim e, t (sec) h=480
-1000
-1500
Figure 4. Comparison of Euler’s method with exact solution for different step sizes
11
Effects of step size on Euler’s
Method
800
400
Temperature,θ(K)
0
0 100 200 300 400 500
-400
Step size, h (s)
-800
-1200
12
Errors in Euler’s Method
It can be seen that Euler’s method has large errors. This can be illustrated using
Taylor series.
1 d2y 1 d3y
y i 1 y i
dy
xi 1 xi 2
x i 1 x i 2
3
x i 1 x i 3
...
dx xi , yi 2! dx x , y 3! dx x , y
i i i i
2! 3!
As you can see the first two terms of the Taylor series