0% found this document useful (0 votes)
17 views

Kedir Runge_kutta_ODE

Uploaded by

kedir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Kedir Runge_kutta_ODE

Uploaded by

kedir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Numerical Solution of First Order Ordinary Differential Equation by Using Runge-Kutta

Method

Kedir Aliyi Koroche


Department of Mathematics, College of Natural and Computational Sciences, Ambo University,
Ambo, Ethiopia
Email address: [email protected] (Kedir A.)
ABSTRACT: In this Project paper, the classical fourth-order Runge-Kutta method for solving
the first-order ordinary differential equation. First, the given solution domain is discretized.
Then the given first-order ordinary differential equation is solved by using the fourth-order
Runge-Kutta method at each specified grid point. To validate the applicability of the proposed
method, two model examples are considered and solved at each specific grid point on its
solution domain. Numerical and exact solutions have been presented in tables and graphs with
their corresponding Absolute error. The present method approximates the exact solution very
well. The numerical result presented in tables and graphs indicates that the approximate solution
is in good agreement with the exact solution.

Key Words:Ordinary differential equation, Runge-kutta method, Initial value problem, boundary
value problem.
1. INTRODUCTION:
Numerical analysis is a subject that involves computational methods for studying and solving
mathematical problems. It is a branch of mathematics and computer science that creates,
analyzes, and implements algorithms for solving mathematical problems numerically.
Numerical methods usually emphasize the implementation of the numerical algorithms. The aim
of these numerical methods is, therefore, to provide systematic techniques for solving
mathematical problems numerically. Numerical methods are well suited for solving
mathematical problems by using modern digital computers, which are very fast and efficient in
performing arithmetic operations. The process of solving problems using high precision digital
computers generally involves starting from initial data; the concerned appropriate algorithms are
then executed to yield the required results [1].
The ultimate aim of the field of numerical analysis is to provide convenient methods for
obtaining the solutions to mathematical problems and for extracting useful information from
available solutions that are not expressed intractable forms. Such problems may be formulated in
terms of an algebraic equations, transcendental equations, ordinary differential equations, and
partial differential equations [2] and [3].
The ordinary differential equation is a mathematical equation that is significant in physical
phenomena that occur in nature. The majority of ordinary differential equations difficult to
approximate by analytical methods. Its, therefore, important to be able to obtain an accurate
solution numerically.
Traditionally, methods such as the Taylor series method, Euler method, and Runge-Kutta method
of the second and third-order, have been used to approximate first-order ordinary differential
equation. Despite their great success in the past decades in mathematics problems, these methods
require time to consume to solve ordinary differential equations. The costs and difficulties in
creating the quality solutions, however, constitute one of the major bottlenecks in these methods.
However, the complications of these methods include a slow rate of convergence, instability, low
accuracy. To this end this Project aims to develop a fourth-order Runge-Kutta method, that is
capable of producing an accurate solution of first-order ordinary differential equations on a
specific given domain.
In this work, we propose a numerical method for solving the first-order ordinary differential
equation and the convergence has been shown in the sense of absolute error so that the local
behavior of the solution is captured exactly.

1.2. Objectives of the Study

1.2.1. General Objective


The general objective of this study is to develop classical fourth-order Runge-Kutta method for
solving first-order ordinary differential equation

1.2.2. Specific Objectives


The specific objectives of the study are:
1) To formulate the numerical method for solving first-order ordinary differential equation;
2) To test the extent to which the proposed method approximates the exact solution;
3) To describe the advantage of the present method over another method.

1.3 . Significance of the Study


The outcome of this study provides some background information for other researchers
who work on this and the related area of study It also introduces the application
of numerical methods in different fields of study.

1.4. Delimitation of the Study


This study is delimited to the fourth-order Runge-Kutta method for solving first-order ordinary
differential equation given in the form of:
'
y =f ( x ) , y ( x 0 ) , a ≤ x ≤ b

2. Review of Related Literatures


Most fundamental laws of Science are based on models that explain variations in physical
properties and states of systems described by differential equations [5]. This differential equation
is categorized into two parts. These two parts are the Ordinary differential equation and the
Partial differential equation. An ordinary differential equation is a differential equation that
involves derivatives of one or more dependant variables concerning at most one independent
variable. A partial differential equation is a differential equation that involves the derivative of
one or more dependant variables concerning two or more than two variables. An Ordinary
differential equation is categorized into Initial value problem and boundary value problem [1, 2].

2.1. Initial value problem


Initial value problems for ordinary differential equations (ODEs) occur in almost all the sciences,
notably in mechanics (including celestial mechanics), where the motion of particles (resp.,
planets) is governed by Newton’s second law – a system of second-order differential equations.
It is no wonder, therefore, that astronomers such as Adams, Moulton, and Conwell were
instrumental in developing numerical techniques for their integration. Still, when separated in
polar coordinates, it reduces to an ordinary second-order linear differential equation. Such
equations are at the heart of the theory of special functions of mathematical physics [4] .

Within mathematics, ordinary differential equations play an important role in the


calculus of variations, where optimal trajectories must satisfy the Euler equations, or
in optimal control problems, where they satisfy the Pontryagin maximum principle.
In both cases, one is led to boundary value problems for ordinary differential equations [4].
Initial Value Problem is types of ode that given Information at a single value of the independent
variable, typically at the beginning of the interval [5]. This initial value problem is given in the
' dy
form of y = =f (x), y ( x 0 )= y 0 , a ≤ x ≤ b, for x is an independent variable and x 0=a . Different
dx
numerical methods use to solve these types of problems, like the Euler method, Taylor series
method. But this numerical method is a low convergence rate and consumes time. So that we
develop and use the convergent numerical method which is called the classical fourth-order
Runge-Kutta method.

2.2.. Boundary Value Problem (BV)


Many problems in applied mathematics require solutions of differential equations
specified by conditions at more than one point of the independent variable. These are called
boundary value problems; they are considerably more difficult to deal with than initial value
problems, largely because of their global nature. Unlike (local) existence and uniqueness
theorems known for initial value problems and there are no comparably general theorems for
boundary value problems. Neither existence nor uniqueness is, in general, guaranteed [4].

We concentrate here on two-point boundary value problems, in which the system


' dy
of differential equations y = =f (x), y ( x 0 )= y 0 , y ( x n) = y n , a ≤ x ≤ b, for x is an independent
dx
variable x 0=a , x n=b and both y 0 and y n are boundary conditions given at boundary points of
specific domains respectively a and b. This problem has a different applications in the real-life
world. In this project we discuss initial value problem solving by using the Runge-Kutta method.

2.3. Runge Kutta Methods


One can distinguish between analytic approximation methods and discrete-variable methods. In
the former, one tries to find approximations to the exact solution y ap ( x ) ≈ y ( x ), valid for all
x ∈(a , b) where y ap approximate value and y (x ) exact values of the given problem. These
usually take the form of a truncated series expansion, either in powers of x, in Chebyshev
polynomials, or some other system of basic functions. So to approximate this solution by using a
single step and multistep methods. Single-step methods for IV problems are Euler Heun and
Midpoint/Improved Polygon and General Runge-Kutta methods. Multi-step methods for IV
problems are Newton-cotes Adams methods. To solve the initial value problem is given in the
' dy
form of y = =f (x), y ( x 0 )= y 0 , a ≤ x ≤ b, key to the various one-step methods is how the slope
dx
is obtained. this slope represents a weighted average of the slope over the
entire interval and may not be the tangent at (xi , yi). Hence in our work, we use Runge-Kutta
methods. Employing single-step

y i+ 1= y j +hφ (xi , y j , h)
Increment function or slope, φ (x i , y j , h) is a weighted average:
φ=a 1 k 1 i +a 2 k 2 j+ …+a j k ji +…+ an k ¿ ( nth order methods) where: a j= weighting factors (that
sum to unity)

k 1i=hf (x i , y j)

k 2i=h f ¿,

k 2i=hf ¿

………

k 2i=hf ¿

Now forms this general n stage Runge-Kutta Methods, the classical fourth-order Runge-Kutta
method employing single-step given as:

1
y i+ 1= [ k +2 k 2 +2 k 3 + k 4 ]
6 1

where k 1=hf (x i , y j) ,k 2=hf ¿,k 3=hf ¿,k 2=f ¿. Global truncation error, O(h 4 ). For our
discussion, we shall consider This explicit Runge-Kutta method only. However, Runge-Kutta
methods must compare with the Taylor series method when they are expanded about the point x
= xi.

3. Study Area and Period


This study is conducted at Ambo university department of mathematics in 2020 G.C.
conceptually; the study focused on classical fourth-order Runge-Kutta method for solving first-
order ordinary differential equation

3.1. Study Design


This study employed a documentary review and numerical experimental design.
3.2. Source of Information
This study utilized information from books, Google/ internet, and the experimental results
obtained through coding.
3.3. Mathematical Procedures
To achieve the stated objectives, the study followed the following steps:
1) Defining the problem or formulating of the problem;
2) Discrediting the solution domain;

3) Solving first-order ordinary differential equation by using the method


4) Validating the method via some numerical example.

4. Desiccation of Numerical Experiment.


In this section we use the fourth-order Runge Kutta method for finding the approximate
solutions of the initial value problem (IVP) of the first-order ordinary differential equation has
the form
'
y =f ( x , y ) , x ∈ ( x 0 , x n ) , y ( x 0 )= y 0 (1)
' dy
where y= , f ( x , y )is given smooth faction and y (x ) is the solution of Equation (1).
dx
Numerical methods employ Equation (1) to obtain approximations to the values of the solution
corresponding to various selected values of x n=x 0 +nh, ¿ 1 ,2 , 3 , … , N −1 . The parameter h is
called the step size. The numerical solutions of (1) are given by a set of points
{( x n , y (x n )) ,n=0 , 1 ,2 , … … } and each point (x n , y n) is an approximation to the corresponding

point ( x n , y (x n) )on the solution curve.

4.1. Investigating the Accuracy of the Method


In this section, we investigate the accuracy of the present method. There are two types of errors
in the numerical solution of ordinary differential equations. Round-off errors and Truncation
errors occur when ordinary differential equations are solved numerically. Rounding errors
originate from the fact that computers can only represent numbers using a fixed and limited
number of significant figures. Thus, such numbers or cannot be represented exactly in computer
memory. The discrepancy introduced by this limitation is called a Round-off error. Truncation
errors in numerical analysis arise when approximations are used to estimate some quantity. The
accuracy of the solution will depend on how small we make the step size, h. To show the
accuracy of the present method, the maximum absolute error e r is used to measure the accuracy
of the method. The maximum absolute error is calculated by e r= max (| y ( x n )− y n|) where N is
1≤ n ≤N

the maximum number of step, y ( x n ) is exact and y n approximation solution of IVP in Eq.(1) at the grid

point x n.

4.2. Numerical Experiments

Numerical results and errors are computed and the outcomes are represented tabular and
dy x
graphically. Example (1): solve IVP given by = , y ( 0 )=1 , and its exact solution is
dx y
y= √ x 2 +1 for 0 ≤ x ≤ 1.

dy
Example (2): Consider the initial value problem =x ( 1+ y ) , y ( 0 )=1. Compute y ( 0.8 ) with
dx
2
x
h=0.1. The exact solution is ¿−1+2 e 2 .

Table 1: Computations numerical and exact solution for the first order initial value problem
given in example 1 and listing their corresponding maximum absolute errors.

X_ (grid point) y_(Approximate solution) y_(Exact solution) er_(absolute error)


0 1.000000000000000 1.000000000000000 0
0.1 1.004987572425429 1.004987562112089 1.0313e-08
0.2 1.019803941472437 1.019803902718557 3.8754e-08
0.3 1.044030729213235 1.044030650891055 7.8322e-08
0.4 1.077033081960091 1.077032961426901 1.2053e-07
0.5 1.118034147228578 1.118033988749895 1.5848e-07
0.6 1.166190567243875 1.166190378969060 1.8827e-07
0.7 1.220655770449989 1.220655561573370 2.0888e-07
0.8 1.280625068576675 1.280624847486570 2.2109e-07
0.9 1.345362631261068 1.345362404707371 2.2655e-07
1 1.414213789413370 1.414213562373095 2.2704e-07
Fig 1. Graphs of the numerical and exact solution of example one and their absolute error expiration.

Table 2: Computations numerical and exact solution for the first order initial value problem given in
example 2 and listing their corresponding maximum absolute errors.

X_ (grid point) y_(Approximate solution) y_(Exact solution) er_(absolute error)


0 1.000000000000000 1.000000000000000 0
0.1 1.010025041666667 1.010025041718802 5.2135e-11
0.2 1.040402679516737 1.040402680053512 5.3677e-10
0.3 1.092055717771941 1.092055719817434 2.0455e-09
0.4 1.166574129640990 1.166574135349917 5.7089e-09
0.5 1.266296892235075 1.266296906133653 1.3899e-08
0.6 1.394434694825263 1.394434726243620 3.1418e-08
0.7 1.555242558938220 1.555242626409774 6.7472e-08
0.8 1.754255389803884 1.754255528671914 1.3887e-07
Fig 2. Graphs of the numerical and exact solution of example two and their absolute error expiration.

4.3. Discussion and Conclusion


In this project paper, we Appling the classical fourth-order Runge-Kutta method for solving first-
order ordinary differential equation. To demonstrate the competence of the method, we applied it
to two model examples. Numerical results obtained by the present method have been associated
with their exact solution and the results are summarized in Tables and graphs. As can be seen
from the numerical results predicted in the tables and graphs above, the present method is
approximate the exact solution very well. To further verify the applicability of the planned
method, graphs were plotted for the above examples for exact solutions versus the numerical
solutions with correspondence absolute errors. As fig. 1 indicates good agreement of
approximation of exact solution for example 1. Figs. 2 indicate the numerical solution has a
good agreement of the results with the exact solution for example 2. Further, the numerical
solutions presented in this Project paper validate the improvement of the numerical
approximation for the solution of the first-order ordinary differential equation.
ACKNOWLEDGEMENT
First of all, I would like to express my thanks to Allah, forgiving me life and time to accomplish my tasks.
In the name of Allah, The Most Greatest and Most Merciful, there is no power except by the power of
Allah and I humbly return my acknowledgment that all knowledge belongs to Allah. I thank God for
granting me this opportunity to broaden my knowledge in this field. Nothing is possible unless He made it
possible.
Secondly, greatly appreciate the help of my mather Shamo Busho and my father Aliyi Koroche, without
the help of them I would not be here today.
Last but not least, thanks a lot to all my beloved friends; your kindness and helps will be a great memory
for me.
REFERENCES
[1] Ray, S.(2018). Numerical analysis with algorithms and programming. CRC Press.
[2] Francis B. Hildebrand (1987). Introduction to numerical analysis, Second edition
[3] Sastry, S.S.(2006). Introductory method of numerical analysis, Fourth-edition,

[4] Walter Gautschi (2012) Numerical Analysis Second Edition

[5] Numerical Solution of Ordinary Differential Equations

You might also like