Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
64 views

Lecture11 - Initial Value Problem Eulers Method

This document discusses Euler's method for solving initial value problems of ordinary differential equations numerically. It begins with an introduction to differential equations and initial value problems. It then covers Euler's method, which approximates the slope at each step to estimate the solution at the next point. The document derives an expression for the truncation error of Euler's method and provides an example of applying the method to solve an initial value problem and estimate the truncation error at each step.

Uploaded by

Na2ry
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

Lecture11 - Initial Value Problem Eulers Method

This document discusses Euler's method for solving initial value problems of ordinary differential equations numerically. It begins with an introduction to differential equations and initial value problems. It then covers Euler's method, which approximates the slope at each step to estimate the solution at the next point. The document derives an expression for the truncation error of Euler's method and provides an example of applying the method to solve an initial value problem and estimate the truncation error at each step.

Uploaded by

Na2ry
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

MTH2212 – Computational Methods and

Statistics

Numerical Solutions of Ordinary


Differential Equations

Lecture 11:
Initial Value Problem: Euler’s Method
Objectives

 Introduction
 Euler’s Method
 Convergence analysis
 Error analysis
 Error estimate

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 2


Introduction

 Differential equations: equations composed of an unknown


function and its derivatives.

dv(t ) c v- dependent variable


 g  v(t )
dt m
t- independent variable

 Differential equations play a fundamental role in


engineering because many physical phenomena are best
formulated mathematically in terms of their rate of change.

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 3


Introduction

 Fundamental laws of physics, mechanics, electricity and


thermodynamics are written in terms of the rate of change
of variables (t = time and x = position):
dv F
 Newton’s second law of motion 
dt m
dT
 Fourier’s heat law q  k '
dx
 2T  2T
 Lapalce equation (steady state) 2
 2
0
x y
T  2T
 Heat conduction  k' 2
t x
 etc.

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 4


Introduction

 One independent variable  Ordinary Differential


Equation (ODE)

 Two or more independent variables  Partial Differential


Equation (PDE)

 Order of a differential equation is determined by the highest


derivative.

 Higher order equations can be reduced to a system of first


order equations, by redefining a variable.

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 5


Introduction

 An ODE is accompanied by auxiliary conditions. These


conditions are used to evaluate the integral that result
during the solution of the equation. An nth order equation
requires n conditions.

 If all conditions are specified at the same value of the


independent variable, then we have an initial-value problem.

 If the conditions are specified at different values of the


independent variable, usually at extreme points or
boundaries of a system, then we have a boundary-value
problem.

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 6


Euler’s Method

 Solve ordinary
differential equations
of the form
dy
 f ( x, y )
dx

 With initial condition


y ( xi )  yi
 The estimate of the
solution is
yi 1  yi  h

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 7


Euler’s Method

•   f ( xi , y i ) is the
estimate of slope at xi

• f ( xi , yi ) is the
differential equation
evaluated at xi and yi

• The estimate is given by


y i 1  y i  f ( xi , y i ) h

 This is Euler’s method


(Euler-Cauchy, Point-slope)

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 8


Error Analysis for Euler’s Method

 The numerical solution of ODE involves 2 types of error:


1. Round-off errors: this caused by limited numbers of
significant digits that can be retained by a computer.
2. Truncation errors:
a) Local truncation error: due to the application of the
method over a single step.
b) Propagated truncation error: due to approximation
produced during previous steps.

 Total or global truncation error = local truncation error +


propagated truncation error.

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 9


Error Estimate for Euler’s Method

 The general form of the differential equation being integrated:


dy
 y '  f ( x, y ) (1)
dx
 Taylor’s series expansion of y about a starting value (x i,yi):
'' (n)
y y
yi 1  yi  yi' h  i h 2  ...  i h n  O(h n1 ) (2)
2! n!
 (1) into (2) gives
f ' ( xi , yi ) 2 f ( n1) ( xi , yi ) n
yi 1  yi  f ( xi , yi )h  h  ...  h  O(h n1 ) (3)
2! n!
 Subtract Euler’s method equation from (3) gives the truncation
error f ' ( xi , yi ) 2 f ( n1) ( xi , yi ) n
Et  h  ...  h  O (h n1 )
2! n!
Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 10
Example 1

1. Use Euler’s method to integrate numerically the ODE:


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 and an initial
condition at x = 0 is y = 1?

2. Estimate and tabulate the errors

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 11


Example 1 - Solution

1. Using Euler’s method


yi 1  yi  f ( xi , yi ) h y (0)  1 h  0.5
 Evaluate the first prediction y(0.5)
y (0.5)  y (0)  f (0, 1) (0.5)
f (0, 1)  2(0) 3  12(0) 2  20(0)  8.5  8.5
y (0.5)  (1)  (8.5)(0.5)  5.25
 Evaluate the second prediction y(1)
y (1)  y (0.5)  f (0.5, 5.25) (0.5)
f (0, 1)  2(0.5) 3  12(0.5) 2  20(0.5)  8.5 

y (1)  (5.25)  ()(0.5)  5.875

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 12


Example 1 - Solution

 Evaluate the third prediction


y (1.5)  y (1)  f (1, 5.875) (0.5) x yEuler
y (1.5)  5.875  (-1.5)(0.5)  5.125 0.0 1.000
0.5 5.250
1.0 5.875
1.5 5.125
2.0 4.500
2.5 4.750
3.0 5.875
3.5 7.125
4.0 7.000

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 13


Example 1 - Solution

2. Estimate the truncation error


f ' ( x i , y i ) 2 f '' ( x i , y i ) 3 f ( 3 ) ( x i , y i ) 4
Et  h  h  h
2! 3! 4!
 For the first step
f ' ( xi , yi )  6 x 2  24 x  20  f ' (0,1)  20
f '' ( xi , yi )  12 x  24  f '' (0,1)  24
f (3) ( xi , yi )  12  f (3) (0,1)  12

 20 24  12
Et  (0.5) 2  (0.5) 3  (0.5) 4  2.03125
2 6 24

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 14


Example 1 - Solution

x yEuler Et
0.00000 1.00000 0.00000
0.50000 5.25000 -2.03125
1.00000 5.87500 -2.87500
1.50000 5.12500 -2.90625
2.00000 4.50000 -2.50000
2.50000 4.75000 -2.03125
3.00000 5.87500 -1.87500
3.50000 7.12500 -2.40625
4.00000 7.00000 -4.00000
Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 15
Remarks about Euler’s Method

 The Taylor series provides only an estimate of the local


truncation error. It does not give a measure of the global
truncation error.

 The global truncation error is O(h), that is, it is proportional


to the step size.

 The error can be reduced by decreasing the step size.

 If the underlying function, y(x), is linear, the method


provide error-free predictions. This is because for a straight
line the second derivative would be zero.

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 16


Effect of step size - example 1

Dr. M. Hrairi MTH2212 - Computational Methods and Statistics 17

You might also like