You are on page 1of 18

ECS 555

NUMERICAL ANALYSIS & FINITE ELEMENT METHOD

TOPIC 5
DIFFERENTIAL EQUATION
At the end of this topic, students should be able to:

1. To solve or integrate ordinary differential equations using Euler


method.

2. To improve the Euler method of solving ordinary differential


equations by applying the Midpoint method or Modified Euler
method .
DIFFERENTIAL EQUATION (DE)
 Equations which are composed of an unknown function and its derivatives
are called differential equations (DE).

 The quantity being differentiated, v is called the dependent variable. The


quantity with respect to which v is differentiated, t, is called the
independent variable.

 Equation above is sometimes referred to as a rate equation because it


expresses the rate of change of a variable as a function of variables and
parameters.
DIFFERENTIAL EQUATION (DE)
Ordinary  One independent variable
Differential
Differential Equation (ODE)
Equation (DE) Partial
 Two or more independent
Differential
Equation (PDE) variables.

 Differential equations are also classified as to their order.


- A first order equation because the highest derivative

is a first derivative.
- A higher order equation.
ODEs for ENGINEERING
PROBLEM SOLVING
MATHEMATICAL BACKGROUND
 A solution of an ODE is a specific function of the
independent variable and parameters that
satisfies the original differential equation. To
illustrate this concept, let us start with a given
function;
y = −0.5x4 + 4x3 − 10x2 + 8.5x + 1

 Now, if we differentiate, it will obtain an ODE


which gives the rate of change of y with respect
to x;
dy/dx = −2x3 + 12x2 − 20x + 8.5
EULER’S METHOD
 The first derivative provides a direct
estimate of the slope at xi ,dy/dx=

 where f(xi, yi) is the differential


equation evaluated at xi and yi. This
yi
estimate can be substituted into the
equation:

yi+1
 A new value of y is predicted using the slope (equal to
the first derivative at the original value of x) to yi
extrapolate linearly over the step size h.

=xi+h
EULER’S METHOD – Example 25.1
 Use Euler’s method to numerically integrate this
equation; x y
dy
= −2 x 3 + 12 x 2 − 20 x + 8.5 0 1
dx
0.5 yi + 1 = yi + f(xi,yi)h
From x = 0 to x = 4 with a step size, h of 0.5.
The initial condition at x=0 is y=1. 1
1.5
yi +1 = yi + f ( xi , yi )h 2
𝑦𝑦𝑖𝑖+1 = 𝑦𝑦1 = 𝑦𝑦0.5 + 𝑓𝑓 𝑥𝑥0.5 , 𝑦𝑦0.5 ℎ 2.5
(𝑥𝑥𝑖𝑖 , 𝑦𝑦𝑖𝑖 ) = (0,1) ℎ = 0.5 = 5.25 + 𝑓𝑓 0.5,5.25 0.5
3
𝑓𝑓 𝑥𝑥𝑖𝑖 , 𝑦𝑦𝑖𝑖 = 𝑓𝑓 0,1 𝑓𝑓 0.5,5.25 = 3.5
= −2 0 3 + 12 0 2 − 20 0 + 8.5 = −2 0.5 3 + 12 0.5 2
− 20 0.5
+ 8.5 = 1.25 4
= 8.5
𝑦𝑦𝑖𝑖+1 = 𝒚𝒚𝟎𝟎.𝟓𝟓 = 1 + 8.5 0.5 = 𝟓𝟓. 𝟐𝟐𝟐𝟐 𝑦𝑦𝑖𝑖+1 = 𝒚𝒚𝟏𝟏 = 5.25 + 1.25 0.5 = 𝟓𝟓. 𝟖𝟖𝟖𝟖𝟖𝟖
EULER’S METHOD – Example 25.1
 Use Euler’s method to numerically integrate this equation;
dy
= −2 x 3 + 12 x 2 − 20 x + 8.5
dx
From x = 0 to x = 4 with a step size of 0.5. The initial condition at x=0 is y=1.
EULER’S METHOD
 The error can be reduced by
reducing the step size

x y
0 1
0.25 yi + 1 = yi + f(xi,yi)h
0.5
0.75
1

4
IMPROVEMENT OF EULER’S METHOD
 The main assumption in Euler’s method is that the derivative at the beginning of the
interval is apply across the entire interval. This assumption is the main source of error.

 Two simple modifications to overcome this shortcoming:


(1) Heun’s Method
(2) The Modified Euler’s method or Midpoint method.
MODIFIED EULER’S METHOD
/MIDPOINT METHOD
Euler’s Method yi +1 = yi + f ( xi , yi )h

Modified Euler’s Method


𝑥𝑥𝑚𝑚 𝑦𝑦𝑖𝑖+1 = 𝑦𝑦𝑖𝑖 + 𝑓𝑓 𝑥𝑥𝑚𝑚 , 𝑦𝑦𝑚𝑚 ℎ
Midpoint 𝑥𝑥𝑖𝑖 + 𝑥𝑥𝑖𝑖+1
of interval 𝑥𝑥𝑚𝑚 = 𝑥𝑥𝑖𝑖+1/2 =
2


𝑦𝑦𝑚𝑚 = 𝑦𝑦𝑖𝑖+1/2 = 𝑦𝑦𝑖𝑖 + 𝑓𝑓(𝑥𝑥𝑖𝑖 , 𝑦𝑦𝑖𝑖 )
2
MODIFIED EULER’S METHOD
/MIDPOINT METHOD :Example
MODIFIED EULER’S METHOD
/MIDPOINT METHOD: Example

0.851
𝑦𝑦𝑖𝑖+1 = 𝑦𝑦𝑖𝑖 + 𝑓𝑓 𝑥𝑥𝑚𝑚 , 𝑦𝑦𝑚𝑚 ℎ

= 0.851
MODIFIED EULER’S METHOD
/MIDPOINT METHOD: Example
MODIFIED EULER’S METHOD /MIDPOINT METHOD: Example
Weekly homework
ECS555 – DEC 2016

You might also like