Numerical method Lecture Note Part I
Numerical method Lecture Note Part I
Systems of equation
Higher Order
BVP
PDE
Implicit
1
NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL
EQUATIONS: INITIAL VALUE PROBLEMS (IVPs)
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:
, (1)
can be classified mainly in to two steps: (i). Single step methods
(ii). Multistep methods
In Single step methods, the solution at any point is obtained using the solution at only the
(2)
where is a function of the arguments and depends on the right hand side
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)
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
In multistep methods, the solution at any point is obtained using the solution at a number of
previous points.
approximation to .
OR
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:
(4)
(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)
We denote the numerical solution and the exact solution at by and respectively.
5
Now, consider the interval . The length of the interval is .
(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 .
(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:
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
with , we get :
7
with , we get:
Therefore,
Now,
with , we get: ,
With , we get:
We have
With , we get:
Now,
= 1.010025
Therefore,
8
With we get:
Now,
=
= 1.040402
Therefore,
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.
Solution: Exercise
Note: To get the solution correct to three decimal places, it is sufficient to consider
fifth term.
(14)
(15)
Applying the mean value theorem of integral calculus to the right hand side of Eq. (15), we
obtain:
(16)
10
Case 1: Let In this case, we are approximating the continuously varying slopes in
(17)
which is the Euler’s method.
Case 2: Let . In this case, we are approximating the continuously varying slopes in
(18)
However, is not a nodal point. If we approximate on the right hand side of Eq.
(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)
error is of order .
11
Therefore, i.e The method is of second order.
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
Runge-Kutta Method:
Consider the D.E
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
: In all the Runge-Kutta methods, we include the slope at all the initial point .
Note
(22)
where the value of the parameters are chosen such that the method is of highest
possible order.
= (23)
We also have:
= (24)
(25)
13
Computing the coefficient of and in Eq. (23) and Eq. (25), we obtain:
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.
(27)
where
(28)
14
where
= (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.
(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:
16
=
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
Let . Then
18
Now,
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.
Solution: Let .
Let
19
(i) Taylor’s fourth order
(ii) Runge-Kutta method of fourth order with .
20