You are on page 1of 32

BONGA UNIVERSITY

COLLEGE OF NATURAL AND COMPUTATIONALSCIENCE

DEPARTMENT OF MATHEMATICS

NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS BY


USING EULER METHOD

PROJECT SUBMITTED TO BONGA UNIVERSITY COLLEGE OF NATURAL AND


COMPUTATIONAL SCIENCE DEPARTMENT OF MATHEMATICS FOR THE
PARTIAL FULFILLMENT OF THE REQUIREMENT OF BACHELOR OF
DEGREE (B.SC) IN MATHAMATICS

PREPERD BY: TERESSA GETACHEW

ADVISOR: FIKIRE WOLDEGEBREAL (MSc)

JULY, 2021G.C

BONGA; ETHIOPIA
This Project entitled Numerical Solution of ODE Using Euler Method A.Y. 2021 Prepared
and submitted byTeressa Getachew in partial fulfilment of the requirement for the degree of
BACHELOR OF SCIENCE has been examined and here by recommended for approval and
Acceptance.

FIKIRE WOLDEGEBREAL (MSc) _______________________


______________
Advisor Signature Date

APPROVED BY COMMITTEE OF EXAMINERS


1_____________ (MSc) ______________ ____________
Examiner Signature Date

i
ACKNOWLE DGEMENT
First of all, I would like to express my gratitude to my GOD for his permission to do my daily
activities. Next, I would like to express my deepest gratitude and great appreciation to my
advisor fikire W/G (MSc) for her efforts, and comments during the preparation of this project
and for her guidance and supporting me from starting point to its completeness. Again, I
would like to appreciate all of Bonga University library, staff members who supplied me with
journal books and also Bonga University internet lab. Furthermore, I wish to thank my
closest friends for their help and moral support. Last, my thanks to my family for their
unending support through financial and different materials throughout my project work.

ii
ABSTRACT
In this paper we introduce the notion of numerical solution of ordinary differential equation
by using Euler methods. It informs some materials and methods used to prepare project. The
given ordinary differential equation is analysed on Euler’s method to find the approximated
solution with the given initial conditions. Then, after investigating the numerical solution of
ordinary differential equation by using Euler’s method, we gave advantages and
disadvantages of Euler method. It comparing the approximated solutions or numerical
solutions with analytical solutions.

Keywords: Ordinary Differential Equations, Numerical solutions, Euler’s method.

iii
Contents
ACKNOWLE DGEMENT....................................................................................................................ii
ABSTRACT.............................................................................................................................................iii
CHAPTER ONE........................................................................................................................................1
1. INTRODUCTION.................................................................................................................................1
1.1. Background.................................................................................................................................1
1.2 Statements of the Problem...................................................................................................2
1.3 objectives......................................................................................................................................3
1.3.1 General Objective.............................................................................................................3
1.3.2 Specific Objectives................................................................................................................3
1.2.3. Significance of the Study......................................................................................................3
CHAPTER TWO.......................................................................................................................................4
2. REVIEW OF RELATED LITERATURE.....................................................................................................4
2.1. Ordinary Differential Equations,.............................................................................................4
2.2. Taylor Method............................................................................................................................5
2.3. Types of Errors...........................................................................................................................6
2.4. Single Step and Multi Step Methods...........................................................................................8
2.5 Finite Difference..........................................................................................................................8
CHAPTER THREE..................................................................................................................................10
3.1 Source of the Information..........................................................................................................10
3.2 Mathematical Procedure...........................................................................................................10
CHAPTER FOUR...............................................................................................................................11
4. SOLVING ORDINARY DIFFERENTIAL EQUATION BY EULER METHOD..........................11
4.1 Derivation of Euler’s Method.....................................................................................................11
Figure 1.1.........................................................................................................................................11
4.2. Modified Euler’s Method..........................................................................................................15
Figure 4.1.........................................................................................................................................19
4.3. Error Analysis of Euler’s Method..............................................................................................19
5. CONCLUSION...................................................................................................................................25
REFERENCE..........................................................................................................................................26

iv
CHAPTER ONE

1. INTRODUCTION
1.1. Background
Differential equation is an equation involving independent variable and dependent variable
and the derivatives or differentials of one or more dependent variable with respect to one or
more independent variables. Differential equations are of basic importance in engineering and
mathematics because many physical laws and relations as well as population growth and
decays appear mathematically in the form of differential equations. These equations also
occur as reformulations of other mathematical problems such as ordinary differential
equations and partial differential equations (John, sons, 1991).

In most real life situations, the differential equation that models the problem is too
complicated to solve exactly, and one of two approaches is taken to approximate the solution.
The first approach is to simplify the differential equations to one that can be solved exactly
and then use the solution of the simplified equation to approximate the solution to the original
equations. The other approach, which we will examine in this project, uses methods for
approximating the solution of the original problem. This is the approach that is most
commonly taken since the approximated methods give more accurate results and realistic
error information (Vilely, 1962).

Numerical methods are generally used for solving mathematical problems that are formulated
in science and engineering where it is difficult or even impossible to obtain exact solutions.
Only a limited number of differential equations can be solved analytically. There are many
analytical methods for finding the solution of ordinary differential equations. Even if then
there exist a large number of ordinary differential equations whose solutions cannot be
obtained in closed form by well-known analytical methods, where we have to use the
numerical methods to get the approximate solution of a differential equation under the
prescribed initial condition or conditions. There are many types of practical numerical
methods for solving initial value problems for ordinary differential equations In this project,
we present standard numerical methods, Euler method for solving initial value problems of
ordinary differential equations in the forms:

1
dy
=f ( x , y ) ; y ( 0 )= y 0
dx

Therefore, numerical methods are often very useful for understanding the behaviour of the
solutions (Vilely, 1962).

1.2 Statements of the Problem.


Up to this point practically every differential equation that we’ve been presented with
could be solved. The problem with this is that these are the exceptions rather than the
rule. The vast majority of first order differential equations can’t be solved.
In order to teach you something about solving first order differential equations we’ve had
to restrict ourselves down to the fairly restrictive cases of linear, separable, or exact
differential equations or differential equations that could be solved with a set of very
specific substitutions. Most first order differential equations however fall into none of
these categories. In fact, even those that are separable or exact cannot always be solved
for an explicit solution. Without explicit solutions to these it would be hard to get any
information about the solution.
So, what do we do when faced with a differential equation that we can’t solve? The
answer depends on what you are looking for. If you are only looking for long term
behavior of a solution you can always sketch a direction field. This can be done without
too much difficulty for some fairly complex differential equations that we can’t solve to
get exact solutions.

The problem with this approach is that it’s only really good for getting general trends
in solutions and for long term behavior of solutions. There are times when we will
need something more. For instance, maybe we need to determine how a specific
solution behaves, including some values that the solution will take. There are many
different methods that can be used to approximate solutions to a differential equation
and in fact whole classes can be taught just dealing with the various methods. We are
going to look at one of the oldest and easiest to use here. This method was originally
devised by Euler and is called, oddly enough, Euler’s Method.

However this project where discussed different question that may race numerical solution in
Euler methods. Therefore, this project was attempted to answer the following questions:

 How do you solve ordinary differential equations numerically?

2
 What do you mean by Euler’s method?
 Why do we use Euler’s method?
1.3 objectives
1.3.1 General Objective
The general objective of this project is

 To find the numerical solution of ordinary differential equation by using the Euler’s
method.

1.3.2 Specific Objectives


The following are specific objectives.

 To provide an approximate result for ODE with known initial condition


 To analysis error in Euler method for solving initial value problems of ODE.
 To compare numerical solutions with the exact solutions.
 To express the formula and effect size of step size has a role on the numerical solution
of ordinary differential equations.
 To provide the stability condition for Euler method

1.2.3. Significance of the Study


This project study will give great importance for the other project worker that focus their
project study related to this topic as a main reference. The Euler method is easy to implement
and is stable. It seeks to numerically analysis of differential equations of great importance in
both computational mathematics and practical engineering. In addition, it will be used as
document resource for the project worker in the future which to related with this title.

It also helps the student of mathematics to understand more about several numerical solution
of ordinary differential equation with the Euler methods. It provides a vehicle for you to
reinforce your understanding of mathematics. Because one function of numerical methods is
to reduce higher mathematics to basic arithmetic operations; enhanced understanding and
insight can be result from this alternative perspective. So doing project on the numerical
analysis of differential equation is very important for the development of a country.

3
CHAPTER TWO

2. REVIEW OF RELATED LITERATURE


2.1. Ordinary Differential Equations,
Although it is possible to derive solution formulas for some ordinary differential equations, as
is shown in Chapter 1, many differential equations arising in applications are so complicated
that it is impractical to have solution formulas. Even when a solution formula is available, it
may involve integrals that can be calculated only by using a numerical quadrature formula. In
either situation, numerical methods provide a powerful alternative tool for solving the
differential equation. (Sanfrancisico, et.al, 1988)

It will be useful to review some elementary definitions and concepts from the theory of
differential equations. An equation involving a relation between the values of an unknown
function and one or more of its derivatives is called a differential equation. We shall always
assume that the equation can be solved explicitly for the derivative of highest order. An
ordinary differential equation of order n will then have the form

n ' ( n−n)
y ( x )=f (x , y ( x ) , y ( x ) , … , y ( x ))……………………………………….…… (2.1)

By a solution of the above equation we mean a function ϕ (x ) which is n times continuously


differentiable on a prescribed interval and which satisfies the given equation; that is ϕ (x )
must satisfy ϕ n ( x )=f (x , ϕ ( x ) , ϕ ' ( x ) , … , ϕ (n +1) ( x ) )

The general solution of (2.1) will normally contain an arbitrary constant, and hence there
' n−1
exists an n-parameter family of solutions. If y ( x 0 ) , y ( x 0 ) , … , y ( x 0 ) are prescribed at one
point x=x 0, we have an initial-value problem. A simple example of a first-order equation is
x
y = y . its general solution is y ( x )=c e , where c is an arbitrary constant. If the initial
'

condition y ( x )= y 0 is prescribed, the solution can be written y ( x )= y 0 e x−x . Differential


0

equations are further classified as linear and nonlinear. An equation is said to be linear if the
function f in (2.1) involves y and its derivatives linearly. Linear differential equations possess
the important property that if

y 1 ( x ) , y 2 ( x ) , … , y m ( x ) Are any solutions of (2.1), then so is c 1 y 1 ( x ) +c 2 y 2 ( x )+ …+c m y m (x) for


arbitrary constantc i. A simple second-order equation is y ' ' = y . It is easily verified that e x and
−x
e are solutions of this equation, and hence by linearity the following sum is also a solution:
x −x
y ( x )=c 1 e + c2 e

4
Two solutions y 1 , y 2 of a second-order linear differential equation are said to be linearly
independent if the Wronskian of the solution does not vanish, the Wronskian being defined
by

W ( y 1 , y 2) = y 1 y 2− y 2 y 1

The concept of linear independence can be extended to the solutions of equations of higher
order. If y 1 ( x ) , y 2 ( x ) , … , y m ( m ) are n linearly independent solutions of a homogeneous
differential equation of order n, then

y ( x )=c 1 y 1 ( x )+ c 2 y 2 ( x ) + …+c m y m ( x ) is Called the general solution.

Among linear equations, those with constant coefficients are particularly useful since they
lend themselves to a simple treatment. We write the nth -order linear differential equation with
constant coefficients in the form
(n) (n−1) (0 )
L y = y +a n−1 y + …+a0 y =0 …………………………………………. (2.2)
where the a iare assumed to be real. If we seek solutions of (2.2) in the form e β ( x), then direct
substitution shows that β must satisfy the polynomial equation
n n−1
β +an −1 β + …+a0 …………………………………………………………….... (2.3)

This is called the characteristic equation of the nth-order differential equation (2.2). If the
equation (2.3) has n distinct roots β i i=1 , … , n , then it can be shown that
β1 ( x )
β ( x) β (x)
y ( x )=c 1 e +c 2 e + …+c n e
2
Where the c iare arbitrary constants, is the general solution
n

of (2.2). If β 1=α +iβ is a complex root of (2.3), so is its conjugate β 1=α −iβ . Corresponding
to such a pair of conjugate-complex roots are two solutions y 1=eαx cos βx and y 2=eα x sin βx ,
which are linearly independent solutions. When (2.3) have multiple roots, special techniques
are available for obtaining linearly independent solutions. In particular, if β 1 is a double root
of (2.3), then y 1=e βx and y 2=x e βx are linearly independent solutions of (2.2). (John Willy
&sons, 1989)

2.2. Taylor Method


The Taylor series is one of the earliest algorithms for the approximate solution for initial
value problems for ordinary differential equations. Newton used it in his calculation and
Euler describes it in his work. Since then one can find many mentions of it such as J.
Lowville, G. Piano, E. Picard. Many authors have further developed this algorithm,
Gibbons and R. E. Moore. The basic idea of these developments was the recursive
calculation of the coefficients of the Taylor series.

Definition: If a function has derivatives of all orders at x=c then the series

5
∞ (n ) (n )
f (c ) f (c )
∑ n!
n '
( x−c ) =f ( c ) + f ( c ) ( x−c ) +…+
n!
n
( x−c ) + …
n=0

Is called the Taylor series for f ( x ¿ at c Moreover, if c = 0, then the series is the McLaurin
series for f. (David Kennard, et.al 1991)

Taylor series method is the fundamental numerical method for the solution of the initial value
problem

'
y =f ( x , y ) , y ( x 0 )= y 0

Expanding y (x ) in Taylor series about any point x i, we obtain

f ( x i , y i ) h f ' (x i , y i)h2
y ( x i+1 )= y ( x i ) + + +…
1! 2!

Where h is the step size, i.e. h=x i−x i−1

2.3. Types of Errors.


The numerical optimists ask how accurate the computed results; the numerical pessimists
asks how much error has been introduced. The two questions are of course, one and the same.
Only rarely will the given data be exact, since it often originates in measurement process. So
there is probably error in the input information. If the number x ¿ is an approximation to the
exact answer x , then we call the difference x−x ¿ the error in x ¿; thus

Exact = approximation + error

1. Round off Error

The error that is produced when a calculator or computer is used to perform real-number
calculations is called round off error. It occurs because the arithmetic performed in a machine
involves numbers with only a finite number of digits, with the result that calculations are
performed with only approximate representations of the actual numbers.

In a typical computer, only a relatively small subset of the real number system is used for the
representation of all the real numbers.

2. Truncation Error

Truncation error is made when a partial sum is used to represent an infinite series. If we
consider the Taylor series

6
2 (n ) n
y ' 'i h yi h
y i+ 1= y i+ y ' i h+ + …+ +…
2! n!

Is exact when all terms are kept. If we truncate this series the remaining terms are the
approximation of the exact series and the terms which are truncated is error terms. Local
truncation error is the error generated in every steps and the error from all the steps is termed
as Global error.

3. Absolute Error

Absolute error is the numerical difference between the true value of a quantity and its
¿
approximate value. Thus if x is the approximate value of quantity x , then ¿ x−¿∨¿ is called
¿
the absolute error and denoted by E a. Therefore, E a=¿ x−x ∨¿. The unit of exact or unit of
approximate values expresses the absolute error.

4. Relative Error

The relative error Er defined by Er = | |


x−x ¿
x
=
Ea
True value
, where x ¿ is the approximate value

of quantity x . The relative error is independent of units.

5. Percentage Error

The percentage error in x ¿ which is the approximate value of x is given by

¿
x−x
E p =100 × Er =100×∨ ∨¿
x

The percentage error is also independent of units.

Example: Find the absolute, percentage and relative errors if x is rounded off to three
decimal digits. Given x = 0:005998.

Solution: If x is rounded off to three decimal places we get x = 0:006. Therefore

Error = True Value -Approximate Value

Error = 0.005998 - 0.006 = 0.000002

Absolute Value of error = E a = |Error| = 0.000002

Ea Ea 0.000002
Relative Error = Er = = = =0.0033344
True value 0.005998 0.005998

7
Percentage Error= E p =Er ×100=0.33344

2.4. Single Step and Multi Step Methods


The methods for the solution of the initial value problem

y ' =f ( x , y ) , y ( x 0 )= y 0 ………………………………………………..………. (2.4)

Can be classified mainly into two types. They are (i) single step methods, and (ii) multi step
methods. Single step methods: In single step methods, for solving IVP (2.4) are those
methods in which the solution y i+ 1 at the (i +1)th grid point involves only one previous grid
point where the solution is already known. Accordingly, a general one step method may be
written as

y i+ 1= y i+ hϕ (xi , y i ,h)

The increment function ϕ depends on solution y iat previous grid point x i and step size h: If
y i+ 1 can be determined simply by evaluating right hand side then the method is explicit
method.

It may be reasonable to develop methods that use more information about the solution
(functional values and derivatives) at previously known values while computing solution at
the next grid point. Such methods using information at more than one previous grid points are
known as multi-step methods and are expected to give better results than one step methods.
To determine solution y i+ 1, a multi-step method or k-step method uses values of y (x ) and
f (x , y ( x )) at k previous grid points x i−k , k=0, 1, 2… k-1. y iis called the initial point while
y i−k are starting points. The starting points are computed using some suitable one step
method. Thus multi-step methods are not self-starting method. (Delhi$ Iowa, 2009)

2.5 Finite Difference

Finite differences have had a strong appeal to mathematicians for centuries. Isaac Newton was
an especially a heavy user, and much of the subject originated with him. Given a discrete
function, that is, a finite set of arguments x k each having a mate y k , supposing the arguments
equally spaced , so that x k −x k−1=h , the differences of y k values are denoted
∆ y k = y k+ 1− y k
are called first differences. The difference of these first differences are denoted by

8
2
∆ y k =∆ ( ∆ y k )=∆ y k+1−∆ y k =∆ y k+2−2 y k +1+ y k are called second differences. In general,
n n−1 n−1
∆ y k =∆ y k +1−∆ yk
Defines the nth differences. Suppose f is a differentiable real-valued function on R . Le x ∈ R
and h> 0 .Then we have the following three popular difference approximations:
' f ( x +h )−f (x)
f (x)≈
h
f ( x )−f (x−h)
f ' (x)≈
h
f ( x+ h )−f (x−h)
f ' (x)≈
2h
These differences are called a forward difference, a backward difference and a cantered
difference, respectively. (Gadwall, et.al, 2003)

CHAPTER THREE
3. METHODOLOGY OF THE STUDY

3.1 Source of the Information


 To reach the goal, I will get from different resources. For instance I where from
internet, and related reference books.

9
 Primary source I will get directly from my advisor and secondary source I will get
from internet and reference books.
 The source of information for this study would be documentary source or secondary
source like article, internet and reference books.

3.2 Mathematical Procedure


 The best understood as a process of arriving at dependent solutions to the problems
through the systematic collection, analysis and interpretation of data.
 Having relevant data it would be analysed and processed using different procedure
such as some terms to be defined, the form to be proved.
 The project was elaborated by definitions and examples.
 More information that was obtained from the libraries can be recorded.
 The collected material was examined in detail.
 Finally, based on the information, analysed and interpreted by conclusion about the
project will be made.

CHAPTER FOUR

4. SOLVING ORDINARY DIFFERENTIAL EQUATION BY EULER METHOD


Euler’s method is the simplest one-step method. It is basic explicit method for numerical
integration of ordinary differential equations. Euler proposed his method for initial value

10
problems (IVP) in 1768. It is a first numerical method for solving IVP and serves to illustrate
the concepts involved in the advanced methods. It is important to study because the error
analysis is easier to understand.

4.1 Derivation of Euler’s Method


Euler's method is defined by

y ( x n+1 )= y ( x n ) + hf (x n , y ( x n )) y ( x 0 )= y 0 , n=0 , 1, …

Different viewpoints of it are given.

1. A geometric viewpoint

At x=0 , we are given the value of y 0= y ( x 0 ) . Let us call x=0 as x 0 .

Now since we know the slope of y with respect to x , that is, f (x , y ) then at x=x 0 , the slope
is f (x 0 , y 0 ). Both x 0 and y 0 are known from the initial condition y ( x 0 )= y 0 .

True value
(x 1 , y 1 )
(x0 , y0) Φ Predicted
Value

Step size, h
x

Figure 1.1: Graphical interpretation of the first step of Euler’s method.

From the graph let y 1 denotes y (x 1) and y 0 denotes y (x 0 ) . So the slope at x=x 0 as shown in
Figure 1 is

11
Rise
Slope =
Run

y ( x 1 )− y (x 0 )
f ( x 0 , y ( x 0 ) )=
x 1−x 0

From here

y ( x 1 )= y ( x 0 ) +f ( x 0 , y ( x 0) ) (x 1−x 0 )

Calling¿) step size h, we get

y ( x 1 )= y ( x 0 ) +f ( x 0 , y ( x 0) ) h

One can use the value of y (x i ) (an approximate value of y at x=x i) to calculate y ( x 2 ), that
would be the predicted value at x 2, given by

y ( x 2 )= y ( x 1 )+ hf (x 1 , y 1 )

x 2=x 1+ h

Based on the above equations, if we know the value of y= y n at x n, then

y ( x n+1 )= y ( x n ) + hf ¿ …………………….………………………………. (4.1)

This formula is known as Euler's Method.

2. Taylor Series

Expands
2
' h ''
y ( x n+1 )= y ( x n ) + h y ( x n ) + y ( ξ n ) where xn ≤ ξ n ≤ x n+1
2

By dropping the error term, we obtain the Euler's method (4.1).


2
h
NOTE: The termT ( x n ) = y ' ' (ξ n ) is called the truncation error or discretization error at x n+1
2

3. Numerical Differentiation

From the definition of a derivative,

12
y (x ¿¿ n+1)− y (x n) '
= y ( x n )=f (x n , y ( x n ) )¿
h

From this equation, we get

y ( x n+1 )= y ( x n ) + hf ¿

Example 4.1.1: Use Euler's method on the interval [0, 1] to find the solution to

dy
− y=0 When x=1. (use four steps, i.e., n = 4)
dx

b−a 1−0
Solution: From the given example step size h= = =0.25 .
n 4

We wanted to find the value of y at x=1 , provided that y (0) = 1.

From Euler's method we have;

y ( x 1 )= y ( x 0 ) +h ¿

y ( x 1 )= y ( 0 ) +0.25( y 0)

y ( x 1 )=1+0.25(1)

y ( x 1 )= y ( 0.25 )=1.25

y ( x 2 )= y ( 0.25 )= y ( x 1 ) +hf ( x1 , y ( x 1 ) )

y ( x 2 )= y ( 0.5 )=1.25+ 0.25 y ( x 1 ) =1.25+0.25 ( 1.25 )

y ( x 2 )= y ( 0.5 )=1.5625

y ( x 3 )= y ( 0.75 )= y ( x 2 ) +hf (x2 , y ( x2 ) )

y ( x 3 )= y ( 0.75 )=1.5625+0.25 ( y ( x 2 ) )=1.5625+ 0.25 ( 1.5625 )

y ( x 3 )= y ( 0.75 )=1.931

y ( x 4 ) = y ( 1 ) = y ( x 3 ) + hf (x 3 , y ( x 3 ))

13
y ( x 4 ) = y ( 1 ) =1.931+ 0.25 ¿

y ( x 4 ) = y (1) ≈ 2.4414

But from the given equation, by using the method of separation of variables, the exact value
of y ( x 4 ) =e ≈ 2.71828 …

dy
Example 4.1.2: Solve =f ( x , y )=x+ y+ 1 for x = [0, 2] with initial conditions y ( 0 )=0
dx
using the Euler's method: when

a .h=1

b . h=0.2

And compare the result with the exact solution y=2e x −x−2.

Solution: First consider h=1

y ( x 1 )= y ( x 0 ) +hf ( x 0 , y ( x 0 ) )

y ( x 1 )= y ( x 0 ) +h ( x 0 + y ( x 0 ) +1 )

y ( x 1 )= y ( 0 ) +1 ( 0+0+1 )

y ( x 1 )=0+1=1

y ( x 2 )= y ( x 1 )+ hf (x 1 , y ( x 1 ))

y ( x 2 )= y ( x 1 )+ h( x 1 + y ( x1 ) +1)

y ( x 2 )= y ( 2 )=1+1 ( 1+1+ 1 )=4

Hence y ( x 2 )=¿y(2)¿ 4 .

When h = 0.2;

y ( x 1 )= y ( x 0 ) +h ( x 0 + y ( x 0 ) +1 )

y ( 0.2 )= y ( 0 ) +0.2 ( 0+ 0+1 )=0.2

y ( x 2 )= y ( x 1 )+ hf (x 1 , y ( x 1 ))

y ( x 2 )= y ( x 1 )+ h( x 1 + y ( x1 ) +1)

y ( 0.4 )=0.2+0.2 ( 0.2+0.2+1 )=0.48

y ( x 3 )= y ( x 2 ) +hf ( x 2 , y ( x 2 ) )

14
y 0.6 ¿=0.48+0.2 ( 0.4+ 0.48+1 )=0.856

y ( x 4 ) = y ( x 3 ) + hf ( x3 , y ( x3 ) )

y ( 0.8 )=0.856+0.2 ( 0.6+0.856 +1 )=1.3472

y ( x 5 )= y ( x 4 ) + hf ( x 4 , y ( x 4 ) )

y ( 1 )=1.3472+0.2 ( 0.8+1.3472+1 )=1.97664

Continue with similar procedure, and finally we will get,

y ( 2 ) ≈ 8.28

This is a better approximation to the exact solution y=2e x −x−2 ≈10.778

Remark: From the example above as the step size (h) is getting very small, we will have a
better approximation.

4.2. Modified Euler’s Method


Here we wish to modify Euler’s method to get a better approximation. We

Know that Euler’s method states that

Y ( x n+1 ) = y (x n ) + h f( x n,y( x n)).

Suppose f¿ ¿, y (x o )¿ is the slope of a tangent line through (, x oy( x o)) and f( x 1,y( x 1)) is the slope
of a tangent line through ( x 1,y( x 1)) .Thus the slope

Of another line between the two lines is the average of the two slopes .i.e, the

New slope is given by the formula

Slope ¿ f ¿ ¿

And from the Euler’s formula, we have

Y ( x 1) = y( x o) + hf x o (, y( x o))

By replacing the new slope in the place of the slope at (x0,y(x0)) = f(, x oy() x o).

So we get

h(f (x o ; y ( x o ))+ f (x 1 ; y (x 1 )))


y ( x 1) = y( x o ) +
m
2

15
h
y ( x 1) = y(x o )+ ¿)
m
2

Where y m is the modified value of y at x1 and with similar procedure at x2

h
y ( x 2) = y( x o) + (f( x 1 ;y( x 1)) + f( x 2; y( x 2)) at x n+1 we will get
m
2

h
y ( x n+1 ) = y ( x n) + (f ( x n; y ( x n)) + f( x n; y( x n)):
m
2

This method is called the modified Euler's method. (Lepidus and G.H., 1971).
st
1 Remark: In the modified formula y( x n) is obtained by applying the

Concept of Euler's method.

That is y ( x n) = y ( x n−¿¿1) + hf( x n−¿¿1; y( x n−¿¿1))


nd
2 Remark: We obtain the iteration formula

h
y () x 1= y( x o)+ (f(; x o y( x o)) + f( x 1; y( x 1)) n = 0; 1; 2; ::
n +1
2

Where, y n( x 1) is the nth approximation toy( x 1). The above iteration

Formula can be started by y1(x1) from Euler's method.

y ( x 1)) = y( x o) + h(; x o y( x o))


o

dy
Example 2.2.1. Solve = f(x; y) = x + y + 1 for x = [0; 2] with initial
dx

Conditions y(0) = 0 using the Euler's method: when

a). h=1

b).h=0.2

And compare the result graphically with the exact solution y = 2e x -x - 2.

Solutions.

First consider h = 1

16
Y (x 1 )= y (x o )+ hf x o ¿

Y (x 1 )= y ( x o )+ h(x o + y (x o )+1)

Y (1)= y (0)+1(0+0+1)

Y (x 1 )=0+1=1

Y (x 2 )= y (x 1)+hf (x1 ; y (x 1))

Y (x 2 )= y ( x 1)+h (x 1+ y ( x1 )+ 1)

Y (x 2 )= y (2)=1+1(1+1+1)=4

Hence y (x 2)= y (2)=4.

Second consider h = 0:2;

Y (x 1 )= y ( x o )+ hf (x o ; y (x o))

Y (x 1 )= y (x o )+ h(x o + y (x o )+1)

Y (0 :2)= y (0)+ 0: 2(0+0+1)=0:2

Y (x 2 )= y (x 1)+hf (x1 ; y (x 1))

Y (x 2 )= y ( x 1)+h (x 1+ y ( x1 )+ 1)

Y (0 : 4)=0 :2+ 0:2 (0 :2+0 :2+1)=0 :48

Y (x 3 )= y ( x 2)+ hf (; x 2 y (x 2 ))

Y (0 :6)=0 :48+ 0:2 (0 :4 +0 :48+1)=0 : 856

Y (x 4 )= y (x3 )+hf (x 3 ; y (x 3))

Y (0 : 8)=0 :856+0 :2(0: 6+0 :856+1)=1 :3472

Y (x 5 )= y ( x 4 )+hf ¿

y ( 1 )=1 :3472+0 :2 ( 0: 8+1:3472+1 )=1: 97664

Continue with similar procedure, and finally we will get,

Y (2) ≈ 8:289.

Which is a better approximation to the exact solution of y = 2e x - x -2 ≈ 10:778

Remark: From the example above and the graph as the step size (h) is getting

17
Very small, we will have a better approximation

dy
Example 2.2.2. Use modified Euler method to solve = f(x, y) = x+y+1
dx

For x = [0, 2] with the initial condition y(x0) = 0. For h = 1 and compare

the results graphically with Euler method solution?

sol. Let’s find the solution using modified Euler method:

h
y ( x 1) = y( x o) + (f( x o,y( x o)) + f( x 1,y( x 1)),where y( x 1) = y( x o) + hf(+ x o y( x o))
m
2

h
y ( x 1) = y (0) + (f( x o,y( x o)) + f( x 1,y( x 1))
m
2

1
y ¿) = 0 + ((0 + 0 + 1) + (1 + y( x 1) + 1). But y( x 1) = 0 + 1(0 + 0 + 1) = 1
m
2

y ( x 1) = 0 + 0.5((0 + 0 + 1) + (1 + 1 + 1) = 2
m

h
y ( x 2) = y( x 1) + (f( x 1,y( x 1)) + f( x 2 ,y( x 2)).Where y( x 2) = y( x 1) +hf ( x 1+ y( x 1))
m
2

1
y ( x 2) = 1 + ((1 + 1 + 1) + (2 + y( x 2) + 1).But y( x 2) = 1 + 1(1 + 1 + 1) = 4
m
2

y ( x 2) = 1 + 0.5((1 + 1 + 1) + (2 + 4 + 1) = 6.
m

And for Euler method:

y (x 1) = x o + hf( x o+ y( x o))

y (x 1) = 0 + 1( x o+ y( x o) + 1)

y (x 1) = 0 + 1(0 + 0 + 1) = 1

y (x 2 ) = x 1 + hf( x 1+ y( x 1))

y (x 2 ) = 1 + 1( x 1+ y( x 1) + 1)

y (x 2 )=¿ 1 + 1(1 + 1 + 1) = 4.

The given example reveals the modified Euler’s method

Is a better approximation to the exact solution as compared to the Euler’s

Method.

18
Figure 4.1

4.3. Error Analysis of Euler’s Method


The numerical solution of ODEs involves mainly two types of error:

1. Truncation, or discretization, errors caused by the nature of the techniques employed to


approximate values of y.

2. Round-off errors caused by the limited numbers of significant digits that can be retained by
a computer. The truncation errors are composed of two parts. The first is a local

truncation error that results from an application of the method in question over a single step.
The second is a propagated truncation error that results from the approximations produced
during the previous steps. The sum of the two is the total or global truncation, error.

Insight into the magnitude and properties of the truncation error can be gained by deriving
Euler's method directly from the Taylor series expansion. To do this, realize that the
differential equation being integrated will be of the general form

'
y =f (x , y ) ................................................................................................................... (4.2)

19
' dy
where y = , x and y are the independent and the dependent variables respectively. If the
dx
solution that is, the function describing the behaviour of y has continuous derivatives, it can
be represented by a Taylor series expansion about a starting value ( x , y)

n
y ' 'i 2 yi n
y i+ 1= y i+ y ' i h+ h + …+ h + Rn ………………………………………. (4.3) Where h=
2! n!
( n+1 )
y (ξ) n+1
x i+1−x i and Rn =¿ the remainder term, defined as Rn = h …. (4.4) Where ξ lies
(n+1)!
somewhere in the interval from x i to x i+1. An alternative form can be developed by
substituting Eq. (4.2) into Eq. (4.3) and (4.4) to yield

( n−1)
f ' ' (x i , y i ) 2 f ( xi , yi )
y i+ 1= y i+ f ( x i , y i ) h+ h +…+ h n+ Ο(hn +1)…………… .. (4.5)
2! n!

Where Ο(h n+1 ) specifies that the local truncation error is proportional to the step size raised
to the (n+10)th power.

By comparing Eq. (4.1) and (4.5), it can be seen that Euler's method corresponds to the
Taylor series up to and including the term f ( x i , y i ) h. Additionally, the comparison indicates
that a truncation error occurs because we approximate the true solution using a finite number
of terms from the Taylor series. We thus truncate, or leave out, a part of the true solution. For
example, the truncation error in Euler's method is attributable to the remaining terms in the
Taylor series expansion that were not included in Eq. (4.1). Subtracting Eq.(4.1) from Eq.
(4.5) yields

( n−1)
f ' ' (x i , y i ) 2 f ( xi , yi )
y i+ 1= y i+ f ( x i , y i ) h+ h +…+ h n+ Ο(hn +1)…………… .. (4.5)
2! n!

Where Ο(h n+1 ) specifies that the local truncation error is proportional to the step size raised
to the (n+10)th power.

By comparing Eq. (4.1) and (4.5), it can be seen that Euler's method corresponds to the
Taylor series up to and including the term f ( x i , y i ) h. Additionally, the comparison indicates

20
that a truncation error occurs because we approximate the true solution using a finite number
of terms from the Taylor series. We thus truncate, or leave out, a part of the true solution. For
example, the truncation error in Euler's method is attributable to the remaining terms in the
Taylor series expansion that were not included in Eq. (4.1). Subtracting Eq.(4.1) from Eq.
(4.5) yields

f '( xi , y i) 2 n+1
Et = h + …+Ο(h )……………………………..………………………. (4.6)
2!

Where Et = the true local truncation error. For sufficiently small h, the errors in the terms

in Eq. (6) usually decrease as the order increases and the result is often represented as

f '(x i , yi ) 2 2
E a= h Or E a=Ο(h )
2!

Where E a = the approximate local truncation error.

Example 4.2.1: Use Euler's method to numerically integrate equation

dy 3 2
=−2 x =12 x −20 x +8.5 From x=0 to x=4 with a step size of 0.5. The initial condition
dx
at x = 0 is y = 1.The exact solution is given by y=−0.5 x 4 +4 x 3−10 x 2 +8.5 x+ 1

Solution; y n +1= y n +f ( x n , y n ) h can be used to implement Euler’s method.

y ( 0.5 )= y ( 0 )+ f ( 0 , 1 ) 0.5

Where y ( 0 )=1 and the slope estimate x=0 is

3 2
f ( 0 ,1 )=−2 ( 0 ) =12 ( 0 ) −20 ( 0 ) + 8.5=8.5

Therefore, y ( 0.5 )=1.0+ 8.5 ( 0.5 )=5.25

The true solution at x=0.5 is

4 3 2
y=−0.5 ( 0.5 ) + 4 ( 0.5 ) −10 ( 0.5 ) +8.5 ( 0.5 ) +1=3.21875

21
Thus, the error is

Et =true value−approximate val ue =3.21875-5.25=-2.03125

Or expressed as per cent relative error, Et =−63.1 %

For the second step

y ( 1 )= y ( 0.5 ) + f ( 0.5 ,5.25 ) 0.5

y ( 1 ) =5.25+ [−2 ( 0.5 )3 +12 ( 0.5 )2−20 ( 0.5 ) +8.5 ] 0.5

y ( 1 ) =5.875

The true solution at x = 1.0 is 3.0, and therefore, the percent relative error is -95.8%. The
computation is repeated, and the results are compiled in Table 1. Note that, Comparison of
true and approximate values of the integral of

3 2
y '=−2 x +1 2 x −20 x +8.5,

With the initial condition that y=1 at x=0 . The approximate values were computed using
Euler's method with a step size of 0.5. The local error refers to the error incurred over a single
step. It is calculated with a Taylor series expansion as in Example 25.2. The global error is
the total discrepancy due to past as well as present steps.

Example 4.2.2: Taylor Series Estimate for the Error of Euler's Method

Problem statement: Use Eq. (4.6) to estimate the error of the first step of Example 4.2.1.
Also use it to determine the error due to each higher-order term of the Taylor series
expansion.

Solution: Because, we are dealing with a polynomial, we can use the Taylor series to obtain
enact estimates of the errors in Euler's method. Equation (4.6) can be written as

f '( xi , y i) 2 f ' '(x i , y i ) 3 f (3) (x i , yi ) 4


Et = h+ h+ h
2! 3! 4!

Where f ' (x i , y i ) = the first derivative of the differential equation (that is, the second
derivative of the solution). For the present case, this is

f ' (x i , y i )=−6 x 2+ 24 x−20

22
And f ( {x} rsub {i} , {y} rsub {i} is the second derivative of the ODE

''
f ( x i , y i )=−12 x +24

(3 )
And f (x i , y i) is the third derivative of the ODE

(3 )
f ( x i , y i ) =−12

We can omit additional terms (that is, fourth derivatives and higher) because for this
particular case they equal zero. It should be noted that for other functions (for example,
transcendental functions such as sinusoids or exponentials) this would not necessarily be true,
and higher-order terms would have nonzero values. For example, the error due to truncation
of the second-order term can be calculated as

2
−6 ( 0.0 ) +24 ( 0.0 )−20
Et ,2= ( 0.5)2=−2.5
2

For the third order term:

−12 ( 0.0 ) +24


Et ,3= (0.5)3 =0.5
6

And the fourth order term:

−12
Et ,4 = ( 0.5 )4 =−0.03125
24

These three results can be added to yield the total truncation error:

Et =Et ,2 + Et ,3 + Et , 4=−2.5+ 0.5−0.03125=−2.03125

This is exactly the error that was incurred in the initial step of Example 4.2.1.

As illustrated in Example 4.2. 2, the Taylor series provides a means of quantifying the error
in Euler's method. However, there are limitations associated with its use for this purpose:

1. The Taylor series provides only an estimate of the local truncation error that is, the error
created during a single step of the method. It does not provide a measure of the propagated
and, hence, the global truncation error. In Table 1, we have included the local and global

23
truncation errors for Example 1. The local error was computed for each time step using the
true value of y i (the second column of the table) to compute each y i+ 1, rather than the
approximate value (the third column), as is done in the Euler method. As expected, the
average absolute local truncation error (25 per cent) is less than the average global error (90
per cent). The only reason that we can make these exact error calculations is that we know the
true value a priori. Such would not be the case in an actual problem. Consequently, as
discussed below, you must usually apply techniques such as Euler's method using a number
of different step sizes to obtain an indirect estimate of the errors involved ([8]).

2. As mentioned above, in actual problems we usually deal with functions that are more
complicated than simple polynomials. Consequently, the derivatives that are needed to
evaluate the Taylor series expansion would not always be easy to obtain. Although these
limitations preclude exact error analysis for most practical problems, the Taylor series still
provides valuable insight into the behaviour of Euler's method. It can also be demonstrated
that the global truncation error isΟ(h); that is, it is proportional to the step size.

These observations lead to some useful conclusions:

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


 . The method will provide error-free predictions if the underlying function (that is, the
solution of the differential equation) is linear, because for a straight line the second
derivative would be zero.

This latter conclusion makes intuitive sense because Euler's method uses straight-line
segments to approximate the solution. Hence, Euler's method is referred to as a first-order
method. It should also be noted that this general pattern holds for the higher-order one-step
methods. That is, an nth-order method will yield perfect results if the underlying solution is
an nth order polynomial. Further, the local truncation error will be Ο(h n+1 )and the global error
n
Ο(h ).

24
5. CONCLUSION

This paper examines one of the most popular numerical methods for solving the differential
equation of the form

'
y =f ( x , y ) , y ( x 0 )= y 0
One of the finite difference methods to solve the above types of initial value
Problems are the Euler's method. The purpose of the paper to investigate
The of derivation of Euler's method and its error analysis. Euler's method is
Defined by

The modified value of y at x1 and with similar procedure at x2

h
y ( x 2) = y( x 1) + (f( x 1; y( x 1)) + f x 2 (; y( x 2)) at x n+1 we will get
m
2

h
y ( x n+1 ) = y ( x n) + (f ( x n; y ( x n)) + f ( x n; y( x n)):
m
2

One of the finite difference methods to solve the above types of initial value problems is the
Euler's method. The purpose of the paper is to investigate the derivation of Euler's method
and its error analysis.

25
This paper also dealt with the error analysis of the Euler's method. And we are able to show
that the stability conditions of the Euler's method and it is found that the stability condition is

REFERENCE
Abhishek K Gupta (1840), Numerical methods using MATLAB.

Alto Quartering, Ricardo Sancho, Faustus salary (1980): Numerical

Approach, Mack Grew Hill Book Company, USA.

David Kincaid, Ward Chaney: (1957) Numerical Analysis Gerald,

David Kincaid, Ward Chaney: Numerical Analysis, university of

Douglass, Richard Burden A.L: (2002) Numerical Methods, Brooks Cole, 3rd

Edition,

Francis Shied: Schism’s (1624). Outlines Numerical analysis, M.C. Gadwall, 2nd

J.C.Buthcer (2003): Numerical Methods for Ordinary Deferential Equations

John Willy and Sons, England.

Kendal E.Atikson (1989): An Introduction To Numerical Analysis second edition, John Willy
and sons, University of Iowa.

L. Sham pine, , Chapman & Hall, Lepidus, L., and G.H.,( 1971)Numerical Solution of
Ordinary Differential Equations, Chapman & Hall, New York.

Madhumangal Pal( 1660): Numerical Analysis for Scientists and Engineers: Theory and C
Programs, Vidyasagar University, Midnapore 721102

New York Sanfrancisico, (1988) Edition

26
Publisher, Delhi, (2009).

S.D.Conte, Carl Boor(1780). Elementary Numerical Analysis an Algorithm

S.R.K.Iyenger, R.K.Jain, (1991): Numerical Methods, New Age International

Seinfeld(1993). Numerical solution of ordinary differential equations, Academic press,

Springer-Verilog, New York, (2000). Mathematics Texas, Brooks publishing, California

27

You might also like