0% found this document useful (0 votes)
132 views18 pages

Ordinary Differential Equation: Euler Method: CES 512 Syahrul Fithry Senin

This document discusses the Euler method for solving ordinary differential equations (ODEs). It begins by stating the learning outcomes, which are to derive the Euler's method, understand the concept of step size and its effect on solution accuracy, write ODEs in the required format, and identify and solve complex ODE problems using Euler's method. It then derives the Euler's method formula and shows how to write first-order ODEs in the form dy/dx = f(x,y). An example problem of cooling temperature is given and solved using Euler's method with different step sizes. The numerical solutions are compared to the exact solution, showing that smaller step sizes increase accuracy. Errors in the Euler method are explained

Uploaded by

nurulselangor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views18 pages

Ordinary Differential Equation: Euler Method: CES 512 Syahrul Fithry Senin

This document discusses the Euler method for solving ordinary differential equations (ODEs). It begins by stating the learning outcomes, which are to derive the Euler's method, understand the concept of step size and its effect on solution accuracy, write ODEs in the required format, and identify and solve complex ODE problems using Euler's method. It then derives the Euler's method formula and shows how to write first-order ODEs in the form dy/dx = f(x,y). An example problem of cooling temperature is given and solved using Euler's method with different step sizes. The numerical solutions are compared to the exact solution, showing that smaller step sizes increase accuracy. Errors in the Euler method are explained

Uploaded by

nurulselangor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

CHAPTER 4:

ORDINARY DIFFERENTIAL
EQUATION:
Euler Method
CES 512
Syahrul Fithry Senin

10/17/2016

LEARNING OUTCOMES

At the end of this lecture, student


should be able :

derive the Eulers Method (CO2:PO2)


understand the concept of step size and
its effect to the solution accuracy
(CO2:PO2)
write the given ODE equation to the
required format (CO2:PO2)
Identify, formulate and solve the given
complex ODE civil engineering problem
using Eulers Method

Euler Method

Eulers Method Derivation


y

dy
f x, y , y 0 y 0
dx
Slope

Rise
Run

y1 y0
x1 x0

f x0 , y 0

y1 y0 f x0 , y 0 x1 x0

y0 f x0 , y0 h
4

True value

x0,y0

y1, Predicted
value

Step size, h
x

Figure 1 Graphical interpretation of the first step of Eulers method

Eulers Method Derivation


y

yi 1 yi f xi , yi h

True Value

h xi 1 xi

yi+1, Predicted value

yi
h

Step size

xi

xi+1

Figure 2. General graphical interpretation of Eulers method


5

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
6

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
2.20671012 4 81108 , 0 1200K
dt

Find the temperature at

h 240 seconds.

t 480 seconds using Eulers method. Assume a step size of

Solution
Step 1:

d
2.2067 1012 4 81 108
dt

f t , 2.20671012 4 81108

i 1 i f ti , i h
1 0 f t0 , 0 h

1200 f 0,1200240

1200 2.2067 1012 12004 81 108 240


1200 4.5579240

1
8

106.09K

is the approximate temperature at t t1 t0 h 0 240 240

240 1 106.09K

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.20671012 106.094 81108 240


106.09 0.017595240
110.32K

2 is the approximate temperature at t t2 t1 h 240 240 480


480 2 110.32K

Solution Cont
The exact solution of the ordinary differential equation is given by the
solution of a non-linear equation as

0.92593ln

300
1.8519 tan 1 0.00333 0.22067103 t 2.9282
300

The solution to this nonlinear equation at t=480 seconds is

(480) 647.57K

10

Comparison of Exact and


Numerical Solutions
Temperature, (K)

1400
1200
1000
Exact Solution
800
600
400

h=240

200
0
0

100

200

300

400

500

Time, t(sec)

Figure 3. Comparing exact and Eulers method


11

Effect of step size


Table 1. Temperature at 480 seconds as a function of step size, h

Step, h

(480)

Et

|t|%

480
240
120
60
30

987.81
110.32
546.77
614.97
632.77

1635.4
537.26
100.80
32.607
14.806

252.54
82.964
15.566
5.0352
2.2864

(480) 647.57K

12

(exact)

Comparison with exact results


Temperature, (K)

1500
1000

Exact solution

500

h=120

h=240

0
0
-500

100

200

Tim e, t (sec)

300

400

500

h=480

-1000
-1500

Figure 4. Comparison of Eulers method with exact solution for different step sizes
13

Effects of step size on Eulers


Method
Temperature,(K)

800
400
0
0

100

200

300

400

-400

Step size, h (s)


-800
-1200

Figure 5. Effect of step size in Eulers method.


14

500

Errors in Eulers Method


It can be seen that Eulers method has large errors. This can be illustrated using
Taylor series.
dy
1 d2y
1 d3y
2
3
xi 1 xi

yi 1 yi
x

x
...
i

1
i
i

1
i
2
3
dx xi , yi
2! dx x , y
3! dx x , y
i

yi 1 yi f ( xi , yi ) xi 1 xi

1
1
2
3
f ' ( xi , yi ) xi 1 xi f ' ' ( xi , yi ) xi 1 xi ...
2!
3!

As you can see the first two terms of the Taylor series
yi 1 yi f xi , yi h are the Eulers method.

The true error in the approximation is given by


Et
15

f xi , yi 2 f xi , yi 3
h
h ...
2!
3!

Et h 2
http://numericalmethods.eng.usf.edu

THE END

Formative Assessment

17

For Qb), use the Eulers Method to solve the problem.


Use 3 different step size for your solution and compare
the accuracy of the results. Determine the exact
solution of the problem
Submit this in the next lecture.

18

You might also like