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.
1
Solution
Step 1:
d
dt
2.2067 10 12 4 81 10 8
f t , 2.2067 10 12 4 81108
i 1 i f ti , i h
1 0 f t0 , 0 h
1200 f 0,1200240
1200 2.2067 10 12 1200 4 81108 240
1200 4.5579240
106.09 K
1 is the approximate temperature at t t1 t0 h 0 240 240
240 1 106.09K
2
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 81 108 240
106.09 0.017595240
110.32 K
2 is the approximate temperature at t t2 t1 h 240 240 480
480 2 110.32K
3
Solution Cont
The exact solution of the ordinary differential equation is given by the
solution of a non-linear equation as
300
0.92593 ln 1.8519 tan 1 0.00333 0.22067 10 3 t 2.9282
300
The solution to this nonlinear equation at t=480 seconds is
(480) 647.57 K
4
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)
Figure 3. Comparing exact and Euler’s method
5
Effect of step size
Table 1. Temperature at 480 seconds as a function of step size, h
Step, h (480)
480 −987.81
240 110.32
120 546.77
60 614.97
30 632.77
(480) 647.57 K (exact)
6
Comparison with exact results
1500
1000 Exact solution
Temperature, θ(K)
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
7 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
Figure 5. Effect of step size in Euler’s method.
8 http://numericalmethods.eng.usf.edu
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
yi 1 yi f ( xi , yi )xi 1 xi f ' ( xi , yi )xi 1 xi f ' ' ( xi , yi ) xi 1 xi ...
1 2 1 3
2! 3!
As you can see the first two terms of the Taylor series
yi 1 yi f xi , yi h are the Euler’s method.
The true error in the approximation is given by
f xi , yi 2 f xi , yi 3 Et h 2
Et h h ...
2! 3!
9 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_meth
od.html
THE END
http://numericalmethods.eng.usf.edu