Chapter 6 - Numerical Method For Ode

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 16

CHAPTER 6:

NUMERICAL METHOD
FOR ORDINARY
NUMERICAL METHOD FOR Ordinary

DIFFERENTIAL
differential equations (oDE)

EQUATIONS (ODE)
EDI3023: ENGINEERING MATHEMATICS 2
1

PREPARED BY: DR. WAN HAFIZA WAN HASSAN

WHWH
CHAPTER OUTLINE
Introduction
Euler’s Method
Improved Euler’s Method
Runge Kutta method

WHWH 2
INTRODUCTION
 In earlier chapters, we have solved ODEs and PDEs
analytically.
 However, in practise, we will encounter ODEs and PDEs
that cannot be solved by those analytic methods.
 Therefore, in real world, numerical methods for ODEs and
PDEs are used, often as part of a software package.
 Indeed, numeric software (i.e., MATLAB) has become an
indispensable tool for the engineer.
WHWH 3
INTRODUCTION
 An analytical solution involves framing the problem in a well-understood
form and calculating the exact solution.
 A numerical solution means making guesses at the solution and testing
whether the problem is solved well enough to stop.

WHWH 4
INTRODUCTION
 This chapter only focuses on numerical methods for First-Order ODEs using
three approaches :
 Euler Method (EM)
 Improved Euler Method (IEM)
 Runge Kutta Method (RKM)

WHWH 5
EULER METHOD
 One of the oldest and easiest numerical method to use.
 This method was originally devised by Euler and is called, oddly enough,
Euler’s Method.
 To begin, let’s consider first order ODE with IVF:
(1)
 We want to solve (1) to get What are known to use are:
and

WHWH 6
EULER METHOD
 By having and enough for us to write down the equation of
the tangent line to the solution at :

Hence,

Then,

In general, where

where

WHWH 7
EULER METHOD
Example 1: For the IVP
Use Euler’s Method with a step size of h = 0.1 to find approximate values of the solution at t =
0.1, 0.2, 0.3, 0.4, and 0.5. Compare them to the exact values of the solution at these points.

Using analytical approach, we get the exact solution


In order to use Euler’s Method, we first need to rewrite the differential equation into the form given in (1).

We can now start doing


some computations: So, at

At the next step: So, at

The same step repeats until we obtain


WHWH 8
EULER METHOD
Example 1: For the IVP
Use Euler’s Method with a step size of h = 0.1 to find approximate values of the solution at t =
0.1, 0.2, 0.3, 0.4, and 0.5. Compare them to the exact values of the solution at these points.

WHWH 9
IMPROVED EULER METHOD
 the improved Euler method, requires two evaluations of f at each step, first the predictor
(2a)

which is an auxiliary value, and then the new y-value, the corrector

(2b)

Hence the improved Euler method is a predictor–corrector method: In each step we predict
a value (2a) and then we correct it by (2b).

The computation indicated here can be conveniently organized as follows: given to compute

Hence
WHWH 10
IMPROVED EULER METHOD
 Example 2: Use the improved Euler method with h=0.1 to find approximate values of the solution of
the initial value problem

0.1

WHWH 11
IMPROVED EULER METHOD
Example 3: Repeat Example 2 using h=0.05.
Keep in mind that the approximate values corresponding to h=0.05 are
actually the results of double the steps (relative to h = 0.1) .

0
0.05
0.1

WHWH 12
IMPROVED EULER METHOD
Task #1 : Repeat Example 2 and Example 3 using Euler Method. Show all your steps and compile
your results in a table.

• Your answer may differ slightly from the answer obtained in this table due to accuracy of the calculator.
However, it should be correct up to 4 decimal places.

WHWH 13
RUNGE-KUTTA METHOD
 A method of great practical importance and much greater accuracy than that of the improved
Euler method.
 Each step we first compute four auxiliary quantities and then the new value

Hence

WHWH 14
RUNGE-KUTTA METHOD
 Example 4: Use the Runge-Kutta method with h = 0.1 to find approximate values for the
solution of the initial value problem at

The Runge-Kutta method yields,

0.1

0.549928221

WHWH 15
RUNGE-KUTTA METHOD
Task#2 : Repeat Example 4 with h = 0.05, compare your answer with Task #1 as well as the
exact solution. Thus, calculate the percentage of error for each method and discuss your
observations from the compiled results.

Table 1:

Table 2: Percentage of error (%)

0 0 0 0

WHWH 16

You might also like