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

Numerical method Lecture Note Part I

The document provides an overview of numerical methods for solving ordinary differential equations (ODEs), focusing on initial value problems (IVPs) and boundary value problems (BVPs). It discusses various methods, including single-step methods (like Euler's and Taylor's methods) and multi-step methods (such as Milne's method), as well as the Runge-Kutta method for both first-order and higher-order ODEs. Additionally, it covers concepts like linear vs. non-linear equations, truncation errors, and examples illustrating the application of these methods.

Uploaded by

bekelesamuel32
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Numerical method Lecture Note Part I

The document provides an overview of numerical methods for solving ordinary differential equations (ODEs), focusing on initial value problems (IVPs) and boundary value problems (BVPs). It discusses various methods, including single-step methods (like Euler's and Taylor's methods) and multi-step methods (such as Milne's method), as well as the Runge-Kutta method for both first-order and higher-order ODEs. Additionally, it covers concepts like linear vs. non-linear equations, truncation errors, and examples illustrating the application of these methods.

Uploaded by

bekelesamuel32
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

DE: - ODE: IVP First Order------------ one equation

Systems of equation
Higher Order
BVP

PDE

Numerical Methods: Single Step: Explicit

Implicit

Multistep Methods: Explicit


Implicit

1
NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL
EQUATIONS: INITIAL VALUE PROBLEMS (IVPs)

Overview of Differential Equations:


Let x be independent variable and y be dependent variable so that then

are called ordinary derivatives.

Definitions:
1. An equation which involves ordinary derivatives is known as ordinary differential
equations (ODE).
2. Solution is a relation between independent variable and dependent variable which
satisfies the differential equation (DE).

If all these conditions are given at one point, then we say them initial conditions (I.Cs) and we
get initial value problem (I.V.P).
If the conditions are given at more than one point, then the conditions are said to be Boundary
conditions (B.Cs) and we get boundary value problems (BVP).

Definition: The DE is said to be LINEAR if the dependent variable and its derivatives
have degree 1 and not multiplied together. Otherwise, it is called NON-LINEAR.

Note: If the conditions are given for dependent variable, then we say Dirichlets conditions and
the problem is known as Dirichlet problem.

If the conditions are given for derivatives of the dependent variables, then we say Neumann
conditions and the problem is called Neumann problem.

2
Examples: Consider the DE:

(i). - IVP (Initial Conditions)

(ii). - BVP (Dirichlet’s Conditions)

(iii). - BVP (Neumann Conditions)

Initial value problems (IVP):


The numerical methods for the solution of the IVP:

, (1)
can be classified mainly in to two steps: (i). Single step methods
(ii). Multistep methods

Single Step Methods:

In Single step methods, the solution at any point is obtained using the solution at only the

previous point . Thus, a general single step can be written as:

(2)

where is a function of the arguments and depends on the right hand side

of the given DE. The function is called the increment function.

If can be obtained simply by evaluating the right hand side of Eq. (2), then the method is
called an explicit method. That is, the method is of the form:

(3)

Or If is obtained in terms of other values like


That is, we compute successively:

3
Example: Euler’s Method

If the right hand side of Eq. (2) depends on , then it is called an implicit method as a result

we obtain a non linear algebraic equation for the solution of (if the DE is non linear).

OR If is obtained in terms of

Example: Modified Euler Method:


Multistep Methods:

In multistep methods, the solution at any point is obtained using the solution at a number of
previous points.

Suppose that we use and at k+1 previous points . That is,

the values: are used to determine the

approximation to .
OR

If is obtained with ( point data), then we say the method


multi ( ) - step method.

Example: Milne’s method: i.e. gives

A two step method uses the values and the method can be written as:

OR

where depends on the right hand side of the given DE. This function is called the
increment function.

If can be obtained simply by evaluating the right hand side, then the method is called
Explicit method. Then, the two step method is of the form:

4
OR

If the right hand side depends on also, then it is called an implicit method.
Remark: A general k- step explicit method can be written as:

and a general - step implicit method can be written as:

Local Truncation Error /Discretization Error for Single Step:

The exact solution satisfies the equation:

(4)

where is called the local truncation error.


Therefore,

(5)
Order of the method: The order of the method is the largest integer for which

Taylor’s Method:

Expanding in Taylor series about any point with the Lagrange form of remainder, we
obtain:

(6)

where and is point up to which the solution is required.

We denote the numerical solution and the exact solution at by and respectively.

5
Now, consider the interval . The length of the interval is .

Substituting in Eq. (6), we obtain:

(7)
Neglecting the error term, we obtain the Taylor series method as:

(8)
N.B: Taylor’s Method is an explicit single step method.
Using the definition given in Eq. (5), the truncation error of the method is given by:

(9)
Using the definition of order of the method, we can say that the Taylor’s method is of order .

For , we obtain the first order Taylor’s method as:

(10)
This method is also called the Euler method. The truncation error of the Euler Method is:

(11)
That is, Euler’s method is a first order method.

N.B: means “terms containing first and higher powers of ” and is read as order of .
Remarks:
(1). Taylor’s method cannot be applied to all problems as we need the higher order derivatives.
The higher order derivatives are obtained as:

6
The number of partial derivatives required, increases as the order of the derivatives of
increases. Therefore, we find that computation of higher order derivatives is very difficult.
Hence, we need suitable methods which do not require the computation of higher order
derivatives.
(2). The bound of the truncation error of Taylor’s method of order is given by:

(12)

where

The bound on the truncation error of the Euler method is given by:

(13)
Example 1: Consider the IVP:

Compute using: (i). Euler’s method


(ii). Taylor’s method of order two and
(iii). Fourth order Taylor’s method.

If the exact solution is , then find the magnitudes of the actual errors for .
If the solution obtained by Euler’s method, find the estimate of the errors.

Solution: Let

(i). Euler’s Method:

with , we get :

7
with , we get:

Therefore,

(ii). Taylor’s Method of Second Order Method:

Now,

with , we get: ,

With , we get:

(iii). Taylor’s Method of Fourth Order:

We have

With , we get:

Now,

= 1.010025

Therefore,

8
With we get:

Now,

=
= 1.040402

Therefore,

The exact solution at is .


The magnitude of the absolute error at are:

(i). Euler’s method:

(ii). Taylor’s second order method:

(iii). Taylor’s method of fourth order:

To estimate the errors in Euler’s method, we use the approximation .

We have:

[Estimate of error in ]=

[Estimate of error in ]=

9
Remark: The contribution of the fourth term on the right hand side is . This
implies that if the result is required to be accurate for three decimal places only (i.e the error is

), then we may include the fourth term and the fifth term can be neglected.

Example 2: Find correct to three decimal places, given

Solution: Exercise
Note: To get the solution correct to three decimal places, it is sufficient to consider
fifth term.

Modified Euler’s Method:


Consider the D.E

(14)

Integrating the D.E (14) in the interval , we get

(15)
Applying the mean value theorem of integral calculus to the right hand side of Eq. (15), we
obtain:

(16)

Since for any value of


In Eq. (15), the integrand on the right hand side is the slope of the solution curve which changes

continuously in . If we approximate the continuously varying slope in by a

fixed slope or by a linear combination of slopes at several points in , we obtain different


methods.

10
Case 1: Let In this case, we are approximating the continuously varying slopes in

by the fixed point . Hence, we obtain the method:

(17)
which is the Euler’s method.

Case 2: Let . In this case, we are approximating the continuously varying slopes in

by the fixed slope at . Hence, we obtain the method:

(18)

However, is not a nodal point. If we approximate on the right hand side of Eq.

(18), by Euler’s method using mesh size (i.e. ), we get the


method:

(19)
The method is called a Modified Euler’s Method or midpoint method. i.e. The slope at the
midpoint is replaced by an approximation to this slope.
Error of approximation: The truncation error in the method is given by:

= (20)

where all the terms are evaluated at ( ).

Using expressions for and , we obtain:

i.e The truncation

error is of order .

11
Therefore, i.e The method is of second order.

Example: Solve the IVP

with using the modified Euler’s method. Compare with the exact solution

Solution:

We have

= =1039846
The error in the solution:
Numerical solutions Exact Solution Absolute error

0.1 1.11 1.11034 0.00034


0.2 1.24205 1.24281 0.00076
0.3 1.39846 1.39972 0.00126

Runge-Kutta Method:
Consider the D.E

in the interval . (21)

12
The basic idea of Runge-Kutta method is to approximate the integral by a weighted average of

slopes and approximate slopes at a number of points in . If we also include the slope at

, we obtain explicit Runge-Kutta Methods.

: In all the Runge-Kutta methods, we include the slope at all the initial point .
Note

i.e the slope

Runge-Kutta Method of Second order:


Consider Runge-Kutta Method with two slopes. Define:

(22)

where the value of the parameters are chosen such that the method is of highest
possible order.

Now, Taylor’s series expansion about gives:

= (23)
We also have:

= (24)

Substituting Eq. (24) into Eq. (22) for , we obtain:

(25)

13
Computing the coefficient of and in Eq. (23) and Eq. (25), we obtain:

Solving these equations we get:

where is arbitrary.

Remark: It is not possible to compare the coefficient of as there are five terms in Eq. (23) and
three terms in Eq. (25).

Therefore, the Runge-Kutta method using two slopes (two evaluation of ) is given by:

(26)

where

Now, we may chose any value for such that . Therefore, we have infinite family of
these methods.

(i). If we choose , we obtain the method:

(27)

where

This method is known as Heun’s Method or Euler-Cauchy method.

(ii). If we chose , we get Thus, the method is given by:

(28)

14
where

This method is known as Modified Euler’s Method.

Error of Runge-Kutta Method:


Subtracting Eq. (25) from Eq. (23), we get the truncation error in the method as:

= (29)

That is the T.E is of order . The method is of second order for all values of
Therefore, Eq. (26) gives an infinite family of second order methods.

For , the first inside the bracket in Eq. (29) vanishes and we get the method of minimum
truncation error. The method is given by:

(30)

where

Therefore, the method in Eq. (30) is a Second Order Method with minimum T.E.

Runge-Kutta Method of Fourth Order:


The most commonly used Runge-Kutta method is a method which uses four slopes. The method
is given by:

(31)

where

15
Remark: The method is called the Classical Runge-Kutta Method of fourth order. All the
single step methods (Taylor’s method, R-K method, etc) are self starting. They do not require
values of and / or the values of the derivatives of beyond the previous point.
Question: 1).Why is the R-K fourth method order method is the most commonly used method?
(Explain)
2). What is the advantage R-K method over the others?
Example: Solve the IVP:

with on the interval [0, 0.4]. Use


(a). the Heun’s method (second order R-K method)
(b). the fourth order R-K method.

Compare with the exact solution .


Solution: (a).

(i). For , we have

(ii). For , we have

16
=

(b). For , we have

For , we have

Absolute error:
Heun’s Method R-K
Exact solution Method
x Numerical Sol. Abs. E Numerical Sol. Abs. E
0.2 0.9615385 0.96 0.001538 0.9615328 0.0000057

17
5
0.4 0.8620690 0.86030 0.001769
0.8620525 0.0000165
0

Runge-Kutta Method for Systems of First Order ODE:


Consider the system of IVP:

Find using R-K method.


Solution: we have:

Let . Then

18
Now,

Runge-Kutta for higher order Des


Consider the IVP:

Solution: R-K method can be applied by converting it in to system of first order problems.

Let , then

System of equations
Hence, the system of equations can be solved using R-K method.

Example: Solve the IVP:

Solution: Let .

Let

Now, taking we can apply R-K method.

Exercise: Consider the IVP:

Compute and Using:

19
(i) Taylor’s fourth order
(ii) Runge-Kutta method of fourth order with .

Exact solution is given by:

20

You might also like