Lecture on Euler's Method
Lecture on Euler's Method
Euler Method
http://
numericalmethods.eng.usf.edu
Transforming Numerical Methods Education for STEM
Undergraduates
http://
12/25/24 numericalmethods.eng.usf.edu 1
Euler Method
http://numericalmethods.eng.usf.
edu
Euler’s Method
y
dy
f x, y , y 0 y 0 True value
dx
y1, Predicted
Rise value
Slope x0,y0 Φ
Run
y1 y 0
Step size, h
x1 x0
f x0 , y 0 x
y1 y 0 f x0 , y 0 x1 x0
Figure 1 Graphical interpretation of the first step of Euler’s metho
y0 f x0 , y0 h
3 http://numericalmethods.eng.usf.edu
Euler’s Method
y
Φ
yi
h
Step size
x
xi xi+1
4 http://numericalmethods.eng.usf.edu
How to write Ordinary
Differential Equation
How does one write a first order differential equation in the form of
dy
f x, y
dx
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
5 http://numericalmethods.eng.usf.edu
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 81108 , 0 1200 K
Find the temperature at t 480 seconds using Euler’s method. Assume a step size of
h 240 seconds.
6 http://numericalmethods.eng.usf.edu
Solution
Step 1:
d
2.2067 10 12 4 81108
dt
f t , 2.2067 10 12 4 81108
i 1 i f ti , i h
1 0 f t0 , 0 h
1200 f 0,1200 240
1200 2.2067 10 12 1200 4 81108 240
1200 4.5579 240
106.09 K
1 is the approximate temperature at t t1 t0 h 0 240 240
240 1 106.09 K
7 http://numericalmethods.eng.usf.edu
Solution Cont
Step 2: For i 1, t1 240, 1 106.09
2 1 f t1 , 1 h
106.09 f 240,106.09 240
106.09 2.2067 10 12 106.09 4 81108 240
106.09 0.017595240
110 .32 K
8 http://numericalmethods.eng.usf.edu
Solution Cont
(480) 647.57 K
9 http://numericalmethods.eng.usf.edu
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)
10 http://numericalmethods.eng.usf.edu
Effect of step size
Table 1. Temperature at 480 seconds as a function of step size, h
11 http://numericalmethods.eng.usf.edu
Comparison with exact
results
1500
500
h=120
h=240
0
0 100 200 300 400 500
-500
Time, t (sec) h=480
-1000
-1500
ure 4. Comparison of Euler’s method with exact solution for different step s
12 http://numericalmethods.eng.usf.edu
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
13 http://numericalmethods.eng.usf.edu
Additional Resources
For all resources on this topic such as digital
audiovisual lectures, primers, textbook chapters,
multiple-choice tests, worksheets in MATLAB,
MATHEMATICA, MathCad and MAPLE, blogs,
related physical problems, please visit
http://numericalmethods.eng.usf.edu/topics/
euler_method.html
THE END
http://numericalmethods.eng.usf.edu