0% found this document useful (0 votes)
118 views43 pages

Numerical Methods

1) The document discusses various numerical methods for finding the roots of equations, including bisection, Newton-Raphson, and modified Newton's method. 2) It describes five types of errors that can occur in numerical methods: truncation error, resolution error, round-off error, propagated error, and data/model error. 3) The bisection method and Newton-Raphson method are explained as techniques for iteratively approximating the roots of equations.

Uploaded by

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

Numerical Methods

1) The document discusses various numerical methods for finding the roots of equations, including bisection, Newton-Raphson, and modified Newton's method. 2) It describes five types of errors that can occur in numerical methods: truncation error, resolution error, round-off error, propagated error, and data/model error. 3) The bisection method and Newton-Raphson method are explained as techniques for iteratively approximating the roots of equations.

Uploaded by

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

ANNAMALAI UNIVERSITY – SLM

NUMERICAL METHODS
Unit – I
STRUCTURE

1.0 Objective
1.1 Introduction
1.2 Different Types of errors
1.3 Root of equations
1.4 Summary
1.5 Important Questions

1.0 Objective
 Different Types Of Errors
 Truncation Error
 Resolution error, etc.,
 Bisection Method

1.0 Introduction
Numerical Methods evolved out of necessity for simulation of physical
situations by mathematical models. A mathematical model when simulated on an
electronic digital computer with the help of numerical methods gives out the response
and behavior analogous to those of the physical situation under similar conditions. But
since the digital computer works on the basis of the four basic arithmetic symbols (+, -
,/,*) and logic operations ,all numerical methods are founded on these structural factors.

1.2 Different Types of errors


Basically an error will occur, while we indulged with solving any type of
Problems. Similarly In Numerical methods there are five types of errors, they are

1. Truncation error
2. Resolution error
3. Round off error
4.
5.
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
Propagated error
Data error

1. Truncation error
This is a type of error derived from the approximation in the numerical analysis
scheme itself. Truncation often refers to truncating a series representation either of a
function being used or sought. Taylor series is often truncated after a specified number of
terms and it is used in deriving a finite difference operator. This is a primary source of
error in finite difference schemes.

MCA SEMESTER – 1 NUMERICAL METHODS Page 1


ANNAMALAI UNIVERSITY – SLM

2. Resolution error
Another type of truncation can erode accuracy and that is due to limiting the
resolution of your representation.
 One must have a finite interval between grid points. The larger the interval the
worse the accuracy.
 Similarly, in a Galerkin method, the more functions we have, generally the better
our solution or more accuracy.

3. Round-off error
All computers represent non-integers with some imprecision. Some symbolic
algebra solutions may work with integer parts of rational fractions to gain a bit of
accuracy.

4. Propagated error
Propagated error means an error in succeeding steps depends on the error in
previous steps. This is an error type that often occurs due to a misuse of a numeric
scheme.

5. Data or Model error


There are limits to the accuracy of the input data. Errors by the measuring
devices, the representative ness of the measurement, data logging mistakes, etc. may be
important to the validity of the calculation.

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY

MCA SEMESTER – 1 NUMERICAL METHODS Page 2


ANNAMALAI UNIVERSITY – SLM

Root of equations
The most important problem in mathematics is to find the root of an equation .The
equation is of the form Transcendental and numerical algebraic equations.

Consider the following function of the form


f ( x)  a0 x n  a1 x n1  a2 x n2  .........  an1 x  an, a0  0

a , a , a ......, an are constants.


Where n is a positive integer and 0 1 2
If the above function is equated to zero, that is, f ( x)  0

a x n  a1 x n1  a2 x n2  ..........  an1 x  an  0


Then the equation is represented by 0
of degree n is known as Numerical algebraic equation. In this equation the function
f (x) is purely a polynomial in x

Some of the points to be remembered to locate the real root of an equation

 If f (x) is continuous from x  a and x  b and if f (a) and f (b) are opposite
signs, then the equation f ( x)  0 will have at least one real root between a and b .

 Every equation of an odd degree has at least one real root, whose sign is opposite to
that of its last term.

Bisection Method

The earliest method of finding the roots of an equation is known as Bisection method.
Consider a function f (x) , which is continuous and lies between the points a and b . Let
f (a) be negative and f (b) be positive, Then there is a root of f ( x)  0 , lying between
a and b . Let its approximate value be given by x 0 = (a  b) / 2 . If f ( x0 ) = 0 then x0 is
the root of the given equation f ( x)  0 . Otherwise the root lies between 0 and b or
x
ANNAMALAI
ANNAMALAI UNIVERSITY
x UNIVERSITY
between 0 and a , accordingly as
f ( x0 ) is negative or positive. Then as before bisect
the interval and continue the process until the root obtains a desired accuracy.

Linear Interpolation
x
Linear interpolation can be used between f (a) and f (b) to obtain 0 and that
between
f ( x0 ) and f (b) to obtain x1 , and so on till we obtain the root.

MCA SEMESTER – 1 NUMERICAL METHODS Page 3


ANNAMALAI UNIVERSITY – SLM

Method of Successive Approximations

The method is also known as Iteration method. In this method there is no


need to find points x  a and x  b at which the function f (x) is respectively negative
and positive. This method needs an initial approximation to start the iterations. Let
f ( x)  0 be the given equation whose roots are to be determined. In this method, the
given equation can be written in the form
x = f (x)

THEOREM:

If the iterative procedure is to converge to the solution point x  c for the given
equation x  f (x) ,then the next point x1 must move closer to point c as compared to 0
x
f ' ( x)  1
with respect to c. Let I be an interval containing the root c. If for all x in I,
x x
the sequence of approximations 0 , x1 , x2 , …. n will converge to root c.
Proof:
C is a root of the equation x  f (x)

Regula Falsi method


The method is also known as method of false position or method of chords. This
is the oldest method for finding the real roots of a numerical equation.

Newton Raphson Method


This is the most popular and powerful method widely used for finding the root of
an equation. Its formula can be easily derived as an improvement of the method of
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
successive approximation. By using this formula the solution or root of an algebraic
equation can be found out easily.

The formula for the Newton's method can be derived in two ways they are,
1. By using Taylor series
2. By using graphical method
By using Taylor series
Taylor series is given by,

MCA SEMESTER – 1 NUMERICAL METHODS Page 4


ANNAMALAI UNIVERSITY – SLM

h h2
f ( x)  f ( x0 )  f ' ( x0 )  f ' ' ( x0 )  ......
1! 2!
2. By using graphical method

Thus the values of


x3 , x4 , x5 ,..... can be obtained successively. If any of the two

consecutive values are same and equal to c then c is one of the roots of f ( x)  0 . Since
the method deals with the tangent line, this method is also known as method of tangents.

Convergence and Rate of Convergence of Newton’s Method:

The Newton’s formula is given by,


f xn 
xn1  xn 
f ' ( xn )
=
 ( xn )
The general form is given by,
x   (x)

The above relation shows that at each stage the subsequent error is proportional to
the square of the previous error.
Condition for convergence of Newton's method:
The Newton's formula is given by,
f ( xn )
xn 1  xn 
f ' ( xn )
xn1   ( xn )
i.e.,
 ' ( x)  1
Newton Raphson method converges only when
f ( x)
 ( x)  x 
f ' ( x)

Modified Newton’s method


ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
The Newton Raphson method is modified by Ralston to overcome the difficulty in
dealing with multiple roots. Ralston introduced a new function, which is shown below,
F ( x)
R( x) 
F ' ( x)

Since the function R(x) becomes zero for all values of x for which
F (x) vanishes, R(x) has same roots as those of F (x) . As such without loss of
generality, R(x) may be used in place of F (x) in the Newton Raphson method. Thus the
modified Newton’s formula is given by,

MCA SEMESTER – 1 NUMERICAL METHODS Page 5


ANNAMALAI UNIVERSITY – SLM

R( xi )
xi 1  xi 
R' ( xi )

Secant Method

There is another method known as Secant method. This method is similar to that
of Newton Raphson method except that the derivative
F ' ( xi ) in the Newton Raphson
method is replaced by a different expression. Hence it is not necessary to give the
derivative expression for F ' ( x) along with the Function F (x) in the program. This
method is handled only when it is difficult to differentiate the function.

Newton’s formula is given by,


F ( xi )
xi 1  xi 
F ' ( xi )
Here
F ' ( xi ) must be replaced, then
F ( xi )  F ( xi 1 )
F ' ( xi ) 
xi  xi 1
Hence the Newton’s formula becomes,
 
 
xi 1  x i  F ( xi ) 
 F ( xi )  F ( xi 1 ) 
 xi  xi 1 
 
xi 1 x x
Thus the value of can be found out only by using the past two values of i and i 1 .
x ,x
Hence to evaluate the value of x2 , the initial approximations 0 1 are required. This
method takes more iterations as compared to the conventional Newton Raphson method.

1.4 Summary
 To find the real root of rational integral equations, there is no closed formula for
ANNAMALAI
ANNAMALAI UNIVERSITY
it. UNIVERSITY
 Four methods such as Bisectional method, iteration method, Regula falsi method
and Newton Raphson method were introduced in this unit as a solution for the
above problem to find the real root of an equation.

 For all the above methods, the interval at which the root lies must be calculated in
a similar way.

MCA SEMESTER – 1 NUMERICAL METHODS Page 6


ANNAMALAI UNIVERSITY – SLM

 The initial approximation can be found out easily in the bisection method and
iteration method, but the convergence will be more rapid.

 In the above methods, there is a formula involved in Regula falsi method and
Newton Raphson method to find initial and successive approximations of the root.
af (b)  bf (a)
 f ( x0 )
For Regula falsi method, f (b )  f ( a ) ,
f ( xn )
xn 1  xn 
For Newton Raphson method, f ' ( xn ) .

1.5 Important Questions


1. Solve the following equation by using Bisection method
a) x  125  0
2

b) x  5x  2  0
2

1
x  sin x   0
c) 2
2. Using the Bisection method, Obtain a root of the following equations correct to
three decimal places
a) x  x  1  0
3

b) x  x  x  7  0
3 2

c) cos x  x  x  0
2

3. Find a real root of the equation Cosx  3x  1  0 correct to 3 decimal places using
the method of successive approximations.

4. Find the real root for the following equations by using iteration method,
3x  log10 x  6  0
a)
l3 l5 l7 l9 l 11
l      ...  0.4431
b) 3 10 42 216 1320
Find the real root of the equation xe  2  0 , correct to four decimal places using
x
5.
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
the method of false position.

6. Compute the real root of the following equations correct to three decimal places
using the Regula falsi method.
a) x  20  0
2

b) x tan x  1  0
x 2  log e x  12  0
c)
d) 2 x  3x  10  0
3

e) e  3x  0
x

MCA SEMESTER – 1 NUMERICAL METHODS Page 7


ANNAMALAI UNIVERSITY – SLM

7. Find a negative root of the following equation using Newton Raphson-method


x3  2 x  5  0

8. Using the Newton-Raphson method, find a real root of the following equations
a) x 2  12  0
b) x 2  4 sin x  0
c) x3  3x 2  5.5x  9.5  0
d) x 4  x  10  0
e)
x log10 x  1.2  0
1
x
9. Solve the equation N and hence prove that xn1  xn (2  Nxn )

10. Find the real root of the equation, 3x  cos x  1  0 using Regula falsi method
and Newton-Raphson method. Compare their results.

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY

MCA SEMESTER – 1 NUMERICAL METHODS Page 8


ANNAMALAI UNIVERSITY – SLM

NUMERICAL METHODS
Unit – II
STRUCTURE

2.0 Objective
2.1 Solution of Linear Algebraic Equations
2.2 Introduction to Iterative method
2.3 Summary
2.4 Important Questions

2.0 Objective
 Solution of Linear Algebraic Equations
 Introduction to Iterative method

2.1 Solution Of Linear Algebraic Equations

x , x ,........, xn
A Problem of Finding n Unknowns 1 2 in a system of m simultaneous
linear equations is known as solutions of linear algebraic equations. This way of
providing solutions arises in situations such as linear programming.

Simultaneous linear equations is of the form


a11x1  a12 x2  ............  a1n xn  b1
a21x2  a22 x2  ............  a2 n xn  b2
............................................................

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
............................................................
am1 x1  am 2 x2  ............  amn xn  bm
x , x ,.....xn b , b ,......bm
Where the coefficient 1 2 and 1 2 are constants

This method has got some limitations in solving large set of simultaneous
equations.
A
For example, in the above equation, if the matrix A is singular that is, equal to
or close to zero, unique solutions cannot be obtained. Hence to solve large set of
simultaneous linear equations two methods are used. They are:

MCA SEMESTER – 1 NUMERICAL METHODS Page 9


ANNAMALAI UNIVERSITY – SLM

1.Direct method
 Gauss elimination method
 Gauss-Jordan method

2.Indirect or iterative method


 Gauss-Siedel method

Before dealing with above methods two processes should be familiarized:


1. Forward Substitution
2. Backward Substitution

Direct Method
This method eliminates the elements the unknowns one by one and transforms the
given set of equations to a triangular form.

Let us now deal with a direct method that is, Gauss Elimination method

GUASS ELIMINATION METHOD

This is an effective direct solution technique. It is quite efficient, but the round off
errors are significant for large set of equations. The method successively eliminates the
elements of coefficient matrix below the diagonal by manipulation of equations with
simple arithmetic operations without changing the equality on both sides of equations.
Consider the following set of equations
a11x1  a12 x2  a13 x3  b1
a21x1  a22 x2  a23 x3  b2
a31x1  a32 x2  a33 x3  b3

aij ' s
While performing arithmetic operations on these equations, only the constants and
bj ' s x ,x ,x
undergo changes but the value of 1 2 3 remains unaltered.

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
Gauss - Jordan Method

This method has got some modification to Gauss elimination method. In Gauss’s
method, after Triangularisation, values of variables have to be obtained by back
substitution. In Jordan’s modification the co-efficient matrix is reduced to a diagonal
matrix rather than a triangular matrix as in Gaussian method. Here the elements above the
diagonal are also eliminated along with the elimination of elements below the diagonal.
This method is therefore suitable for computer implementations. After completion of
Gauss-Jordan method the equation becomes

MCA SEMESTER – 1 NUMERICAL METHODS Page 10


ANNAMALAI UNIVERSITY – SLM

 1 0 0 ............ 0   x1   b1 
     
 0 1 0 ............ 0   x2   b2 
 ........ ......... ........... ............ ..........   ........    ......... 
     
 ........ ......... ........... ............ ..........   ........   ......... 
 0  x   b 
 0 0 ............ 1   n   n 

For Gauss-Jordan method first five steps are similar to Gauss method

Consider the following set of equations

a11x1  a12 x2  a13 x3  b1


a21x1  a22 x2  a23 x3  b2
a31x1  a32 x2  a33 x3  b3

While performing arithmetic operations on these equations only the constants


aij ' s b 's x ,x ,x
and j undergo changes but the value of 1 2 3 remains unaltered.

Indirect Or Iterative Method


In the above two direct methods the solutions can be arrived at finite number of
steps with unavoidable round of errors. In indirect method the solution is got by
successive approximation. Successive approximation is called Iteration. In indirect
method the number of iteration depends on the desired degree of accuracy. This method
is not applicable to all systems of equations. When the equation is of the form described
below the iteration may succeed. Each equations of the system must have one co-efficient
much larger than the others in the equation and this large co-efficient must be attached to
different unknown. This can be achieved if the large co-efficient are along the leading
diagonal of the matrix of the co-efficient.
One of the most popular and effective iterative methods is Gauss-Seidel Method.
Guass – Seidal Method

Consider the following set of equations


ANNAMALAI
ANNAMALAI
a x a x a x b
UNIVERSITY
UNIVERSITY
11 1 12 2 13 3 1 (1)
a21x1  a22 x2  a23 x3  b2
(2)
a31x1  a32 x2  a33 x3  b3
(3)

This may be rewritten as

MCA SEMESTER – 1 NUMERICAL METHODS Page 11


ANNAMALAI UNIVERSITY – SLM

(b1  a12 x2  a13x3 )


x1 
a11 (4)
(b2  a21x1  a23x3 )
x2 
a22 (5)
(b3  a31x1  a32 x3 )
x3 
a33 (6)

a  0. If necessary the three equations can be


Assume that a11  0, a22  0 and 32
interchanged to arrive at the above assumptions.

x1  x2  x3  0
To start with guess the initial estimate of the solution as . Using
these values in equation (4) the equation obtained is:
b  a (0)  a13 (0)
x11  2 12
a11

x  0 in equation (5) the value of x21 is obtained


Using the value of x11 and 31 .
b2  a21x11  a23 (0)
x21 
a22

x
Using the value of x11 and x21 in equation (6) value of 31 is obtained.
b a x a x
x31  3 31 11 32 21
a33

Note that the initial guess x1  0 is not used at all. The values of x11, x21 and 31
x
x ,x ,x
may be used in the above equations again to obtain 12 22 32 and this process may be
iterated again and again until the values of unknown converge. In general form the
equation may be rewritten as

b1  a12 x2 I  a13 x3 I
x1 ( I  1) 
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
a11

b2  a21x1 ( I  1)  a23x3 I
x2 ( I  1) 
a22

b3  a31x1 ( I  1)  a32 x2 ( I  1)
x3 ( I  1) 
a33

MCA SEMESTER – 1 NUMERICAL METHODS Page 12


ANNAMALAI UNIVERSITY – SLM

The equation (2) is iterated for the value of I  0,1,2,3........... until


xj ( I  1)  xjI   ( forj  1,2,3)
Where  is fixed in accordance with the requirements of
accuracy. The system will be convergent if the magnitude of the diagonal element is the
largest in each of the equations.

(i.e.,)
n
aii   aij i  1,2,3...........n, i j
j 1

2.3 Summary
 Basically Cramer's rule is applicable for solving simultaneous linear algebraic
equations.

 If the number of simultaneous equations is larger, otherwise if there are more than
3 or 4 simultaneous equations, Cramer's rule will not give the desired result,
Hence we go for some other methods to solve the simultaneous linear equation.

 Two methods such as direct and indirect methods were used to solve the above
problem of finding the roots of an simultaneous equation.

 Gauss elimination method and Gauss Jordan method are known as direct methods.
Thus the roots of the simultaneous equation can be found out directly at last
without iteration.

 Gauss Siedal method is known as iterative method. The convergence will be very
slow and it takes time to find the root of the simultaneous equations, because of
its large number of iterations.

2.4 Important Questions

1. Obtain the solution of following set of simultaneous linear algebraic equations by


Gauss elimination method.
2 x  2 x2  4 x3  18
ANNAMALAI
ANNAMALAI UNIVERSITY
a.) 1 UNIVERSITY
x1  3x2  2 x3  13
3x1  x2  3x3  14

b.)
2 x1  4 x2  2 x3  15
2 x1  x2  2 x3  5
4 x1  x2  2 x3  0

MCA SEMESTER – 1 NUMERICAL METHODS Page 13


ANNAMALAI UNIVERSITY – SLM

c.) 2 x  3.5 y  z  22.35


 5x  3 y  3.3z  9.08
12 x  7.8 y  4.6 z  21.38

d.) w  2 x 12 y  8z  27
5w  4 x  7 y  2 z  4
 3w  7 x  9 y  5z  11
6w  12 x  8 y  3z  49

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY

MCA SEMESTER – 1 NUMERICAL METHODS Page 14


ANNAMALAI UNIVERSITY – SLM

2. Solve the following set of equations by using Gauss-Jordan method

a.) 10 x  y  z  12
2 x  10 y  z  13
x  y  5z  7

b.) 5x  2 y  3z  18
x  7 y  3z  22
2 x  y  6 z  22

2 x  4 x2  x3  3
c.) 1
3x1  2 x2  2 x3  2
x1  x2  x3  6

d.)
5x1  x2  x3  x4  4
x1  7 x2  x3  x4  12
x1  x2  6 x3  x4  5
x1  x2  x3  4 x4  6

3. Solve the following set of equations by using Gauss-Seidal method.

a.) 8x  y  z  8
2x  4 y  z  4
x  3 y  5z  5

4 x1  2 x2  x3  5
b.)
x1  3x2  2 x3  13
2 x1  x2  3x3  9

c.) 28x  4 y  z  32
x  3 y  10 z  24
2 x  17 y  4 z  35
ANNAMALAI
ANNAMALAI
6 x  y  z  11.33
UNIVERSITY
UNIVERSITY
d.)
 x  6 y  z  32
 x  y  6 z  35

e.) 27 x  6 y  z  85
6 x  15 y  2 z  72
x  y  54 z  110

MCA SEMESTER – 1 NUMERICAL METHODS Page 15


ANNAMALAI UNIVERSITY – SLM

NUMERICAL METHODS
Unit – III
STRUCTURE

3.0 Objective
3.1 Finite Differences
3.2 Interpolation
3.3 Interpolation with Unequal Intervals
3.4 Summary
3.5 Important Questions

3.0 Objective
 Finite Differences
 Interpolations
 Newton’s forward interpolation formula
 Differentiation using central difference formula
 Interpolation with Unequal intervals

3.1Finite Differences
Finite Differences and associated concepts bear much importance in numerical
analysis. In the digital computer, it is tedious to perform the Operation of differentiation
as it is done in the classical theory of calculus. Hence to compute the differentiation using
digital computer four arithmetic operations and some logical functions may be used. This
is done by the Finite Differences.
The derivatives so computed may then be used in Taylor series or to find a
polynomial, matching the given data and so on.

Let y  f (x) be a given function of x and let y0 , y1 , y2 .......... be the values of

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
y corresponding to x0 , x0  h, x0  2h........... of the values of x .

i.e., y0  f ( x0 ), y1  f ( x0  h), y 2  f ( x0  2h),................ y n  f ( x0  nh)

The difference between two consecutive values of x is called the interval of


differencing. It is denoted by h, which is a constant one.

MCA SEMESTER – 1 NUMERICAL METHODS Page 16


ANNAMALAI UNIVERSITY – SLM

Differentiation Using Forward difference


The Taylor series expansion of f (t ) about t  a is given by,

(t  a) 2 (t  a)3 (t  a) n ( n )
f (t )  f (a)  (t  a) f ' (a)  f ' ' (a)  f ' ' ' (a)  ......  f (a)......
2! 3! n!
Where f ' (a)  df / dt and f ' ' (a)  d 2 f / dt 2 and so on.
The analyticity of f (t ) at t  a implies that f (t ) and all its derivatives at t=a must
exist with a finite value. Since Taylor series can be used to find the value of f (t ) for any
t , assume t  b . Then the Taylor series becomes,
(b  a) 2 (b  a) 3 (b  a) n ( n )
f (b)  f (a)  (b  a) f ' (a)  f ' ' (a)  f ' ' ' (a)  ......  f (a)......
2! 3! n!
Consider an analytic function f (t ) as shown in the figure below. Using b  t  h ,
a  t and the deviation (b  a)  h , in the above Taylor series, the equation obtained is:
h2 h3
f (t  h)  f (t )  hf ' (t )  f ' ' (t )  f ' ' ' (t )  ..............
2! 3!

In general,
n f i  (n1 f i )

The corresponding forward difference expressions for derivatives of any order can
be obtained as follows,
d n f n f i
 n  0(h)
dt 2 h

Difference Table

In many problems it will be convenient if the successive Differences of a function


are displayed. Hence finite differences can be displayed in a standard format of difference
table as shown below.
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY x0 y0
y 0
y1 2 y 0
x1 y1 3 y 0
2 y1 4 y 0
x2 y2 y 2 3 y1
2 y 2
y3 y 3
x3

MCA SEMESTER – 1 NUMERICAL METHODS Page 17


ANNAMALAI UNIVERSITY – SLM

y4

x4

In the above table all difference values link with each other

3.2 Interpolation
Experimental data of physical phenomena is often available at discrete instants of
time and it becomes necessary, at times, to find its value either between discrete points or
outside the range of available observations.
Consider the following table

x x0 x1 x2 ........................xn
f (x) f ( x0 ) f ( x1 ) f ( x2 ) ………… f ( xn )

If the value of f ( y) is to be found at some point y in the interval [ x0 , xn ] and y


is not one of the tabulated points. Then the value of f ( y) is estimated by using the
known values of f (x) at the surrounding points. This process of computing the value of a
function inside the given range is called interpolation. Interpolation can be classified
into two ways they are,
 Interpolation with equal intervals:
 Newton's Forward interpolation formula
 Newton's Backward interpolation formula
 Stirling's Central difference formula
 Interpolation with unequal intervals:
 Newton's divided difference interpolation formula
 Lagrange's interpolation formula

Newton’s forward interpolation formula


Though the values of a function are known at discrete points, more accurate
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
results of interpolation are obtained if the variation of function over the discrete point is
smooth, or, to be more precise, analytic.

Differentiation using Backward differences

The Taylor series expansion of f (t ) about t  a is given by,


(t  a) 2 (t  a)3 (t  a) n n
f (t )  f (a)  (t  a) f ' (a)  f ' ' (a)  f ' ' ' (a)  .........  f (a).........
2! 3! n!

MCA SEMESTER – 1 NUMERICAL METHODS Page 18


ANNAMALAI UNIVERSITY – SLM

Where f ' (a)  df / dt and f ' ' (a)  d 2 f / dt 2 and so on.

The analyticity of f (t ) at t  a implies that f (t ) and all its derivatives at t  a must


exist with a finite value. Since Taylor series can be used to find the value of f (t ) for any
t , assume t  b . Then the Taylor series becomes,
(b  a) 2 (b  a)3 (b  a) n n
f (b)  f (a)  (b  a) f ' (a)  f ' ' (a)  f ' ' ' (a)  .........  f (a)........
2! 3! n!

The difference approximation of backward difference can be obtained by


considering b  t  h, a  t and (b  a)  h in the above equation.

Difference Table
Since the forward differences use data values in forward direction, forward
interpolation formula is used at a point near the beginning of the table, where the
backward points are not available. When the interpolation is desired at the end of the
table forward points and hence the forward differences are not available. Hence to
acquire the interpolation at the end of the table backward differences are used.

x y y 2 y 3 y 4 y
x4  x0  4h y 4
y3
y 3  2 y 2
x3  x0  3h y2 3 y1
 2 y1  4 y0
y 2
x2  x0  2h y1  3 y0
y1  2 y0
y 0
x1  x0  h y0

x0  y0

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
Newton's backward interpolation formula
As interpolation is dealt with already, while deriving forward interpolation
formula, the formula for backward interpolation, is derived here straightly.

It is known that, y1  y1  y0


 (1  ) y1  y0
 y1  (1  ) 1 y0 (1)
Also it is know that from forward interpolation formula,

MCA SEMESTER – 1 NUMERICAL METHODS Page 19


ANNAMALAI UNIVERSITY – SLM

y1  (1  ) y0 (2)

Differentiation using central difference formula


The first central difference approximation to f'(t) can be obtained from the values
of first forward difference approximation and first backward difference approximation of
f'(t).It is clearly derived as follows:

h3
f (t  h)  f (t  h)  2hf ' (t )  f ' ' '......
3
By Re-arranging
f (t  h)  f (t  h) h 2
f ' (t )   f ' ' ' (t )  ........
2h 6

Central Difference formula


In the previous sections about Newton's forward interpolation formula and
backward interpolation formula were discussed, which were suited for interpolation near
the beginning and end values of the given data. If the interpolation near the middle of the
data is to be found, a new formula should be derived known as central difference
formula.

The central difference operator is denoted by  and is defined by


yx  yx  h 2  yxh 2

Gauss's Forward Formula


ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
The Newton's Forward interpolation formula is

n(n  1) 2 n(n  1)(n  2) 3


y( x0  nh)  y 0  ny0   y0   y0  ....
2! 3!

From the table we know that,


2 y0  2 y1  3 y1
 2 y0  2 y1  3 y1

MCA SEMESTER – 1 NUMERICAL METHODS Page 20


ANNAMALAI UNIVERSITY – SLM

Similarly, 3 y0  3 y1  4 y1


 3 y0  3 y1  4 y1
Thus the value of 4 y0 , 5 y0 and so on can be calculated.

Gauss's Backward Formula

The Newton's forward interpolation formula is,


n(n  1) 2 n(n  1)(n  2) 3
y( x0  nh)  y0  ny 0   y0   y0  ........ (1)
2! 3!

Stirling's Formula
Stirling's central difference formula can be derived by using the Gauss's forward
and backward formulas. By taking the mean of the two different formulas, Stirling's
central difference formula can be obtained.

Hence by taking the mean of two above formulas i.e., Gauss's forward and Backward
formula, the equation obtained is:

 y  y1  n 2
2
n(n 2  1)  3 y1  3 y2  n 2 (n 2  1) 4
y( x0  nh)  y0  n 0    y1      y2  ......
 2  2! 3!  2  4!

This formula is called as Stirling's formula.

3.3 Interpolation with Unequal intervals


The above-derived formulas were based on equally spaced intervals. But it is not
always possible to obtain data experimentally or numerically at equally spaced points due
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
to physical inaccessibility or numerical difficulties. Moreover, Newton's forward and
backward interpolation formula involves only the difference in the values of y' s such as
y1  y0 , y2  y1...... etc, but it does not involves with the changes of x' s . If the changes or
differences in the values of x' s or arguments are taken into account together with the
values of y' s then the differences is called as Divided differences.

Newton's divided difference interpolation formula


Let y0 , y1 , y2 ,....... yn be the values of function y  f (x) corresponding to the
arguments x0 , x1 , x2 ,.......xn . Then the divided difference is given by,

MCA SEMESTER – 1 NUMERICAL METHODS Page 21


ANNAMALAI UNIVERSITY – SLM

f ( x)  f ( x0 )
 f ( x, x0 ) 
x  x0

The above formula is called as Newton's divided difference interpolation


formula for unequal intervals.

Lagrange interpolation formula

The Newton's forward and backward interpolation formulas can be used only
when the values of the independent variable x are equally spaced. Also the differences of
y must become ultimately small. In such situations Lagrange's interpolation formula can
be used.

3.4 Summary

 Series of values of x and f (x) are given and the intermediate value of f (x) to be
found out. This process is called interpolation.

 Newton's forward and backward interpolation formula were suited for


interpolation near the beginning and end of the table. Hence the intermediate
value of f (x) at the beginning and end of the table can be found out by using
them.

 Stirling's formula was used to find the value of f (x) at the middle of the table.

 The above formulas were suited only for the interpolation with equal
intervals.The formulas, which were used for the interpolation with unequal
intervals, are Newton's divided difference formula and Lagrange's interpolation
formula.

3.5 Important Questions


ANNAMALAI
ANNAMALAI UNIVERSITY
1. Find
UNIVERSITY
a)  sin x
b)  tan x
c)  log x
Take h as the interval of differencing

2. Calculate f (1.02) correct to 3 decimal places using Newton's forward


interpolation formula from the following table.

MCA SEMESTER – 1 NUMERICAL METHODS Page 22


ANNAMALAI UNIVERSITY – SLM

x 1.0 1.1 1.2 1.3 1.4


f (x) 0.841 0.891 0.932 0.964 0.985

3. Calculate f (1.9) using Newton's backward interpolation formula from the


following table.

x 1.00 1.25 1.50 1.75 2.00


f (x)  e  x 0.3679 0.2865 0.2231 0.1738 0.1353

4. Find the value of y at x = 2.7 from the following table using Gauss's forward
formula.

x 1.5 2.0 2.5 3.0 3.5 4.0


y 37.9 246.2 409.3 537.2 636.3 715.9

0
5. Find the value of Cos 51 42' by using Gauss's backward formula from the
following table

x 500 510 520 530 540


Cos x 0.6428 0.6293 0.6157 0.6018 0.5878

log10 337.5
6. Find the value of by using Stirling's formula from the following table.

x 310 320 330 340 350 360


log10 x 2.4914 2.5052 2.5185 2.5315 2.5441 2.5563

7. Find the cubic function f (x) from the following table using Newton's divided
difference formula.
ANNAMALAI
ANNAMALAI
x
UNIVERSITY
UNIVERSITY 0 1 4 5
f (x) 8 11 78 123

8. Find the value of f (2) using Lagrange's interpolation formula from the following
table

x 0 1 3 4
f (x) 5 6 50 105

MCA SEMESTER – 1 NUMERICAL METHODS Page 23


ANNAMALAI UNIVERSITY – SLM

9. Find the function f (x) from the following table using Lagrange's interpolation
formula by a polynomial of degree 2.

x 1 2 -4
y 3 -5 4

NUMERICAL METHODS
Unit – IV

STRUCTURE

4.0 Objective
4.1 Numerical Differentiation
4.2 Numerical Integration
4.3 Summary
4.4 Important Questions

4.0 Objective
 Numerical Differentiation
 Numerical Integration
 Newton cote’s Formula

4.1 Numerical Differentiation


The process of computing the value of the derivative of x that is, dy / dx from the
given data ( xi , yi ) , when the actual relation between x and y is not known, is known as
numerical differentiation. Using differential equations can solve the problems that cannot
be solved by means of analytical methods. There are various methods to solve a
differential equation to arrive at the solution with the given initial Conditions. The
procedure is to replace the relation y  f (x) by approximating the polynomial y  (x)
and then differentiate it.
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
The interpolation formula to be used depends as usual on the particular value of x
at which the value of dy / dx is required. Consider the following steps when x are equally
spaced.
 If the value of dy / dx is required at a point near the Beginning of the table,
Newton – Gregory forward formula is used.
 If the value of dy / dx is required at a point near the end of the table, Newton –
Gregory backward formula is used.

MCA SEMESTER – 1 NUMERICAL METHODS Page 24


ANNAMALAI UNIVERSITY – SLM

 If the value of dy / dx is required at a point near the middle of the table, one of
the central difference interpolation formula are used.
 If the value of x is not equally spaced, Newton’s divided difference formula
should be used to represent the function.

Forward Difference Formula to Compute the Derivatives

Newton’s forward interpolation formula is given by,


r (r  1) 2 r (r  1)(r  2) 3
f ( x0  rh)  y0  ry0   y0   y0
2! 3!
r (r  1)(r  2)(r  3) 4
  y0  ..................
4!

Backward Difference formula to compute the derivatives

Newton’s Backward Difference Formula is

r (r  1) 2 r (r  1)(r  2) 3 r (r  1)(r  2)(r  3) 4


f ( x0  rh)  y0  ry0   y0   y0   y0  ....
2! 3! 4!

Central Difference Formula For Computing the Derivatives

Stirling’s central difference formula is

 y  y1  r 2
2
r (r 2  1)  3 y1  3 y2 
y ( x0  rh)  y0  r  0    y   
3! 
1
 2  2! 2 
r 2 (r 2  1) 4 r (r 2  1)(r 2  4) 5

4!
 y 2 
5!
 
 y2  5 y3  .....

 y  y1  r 2
2
(r 3  r )  3 y1  3 y2 
y ( x0  rh)  y0  r  0    y1   
 2  2! 3!  2 
(r 4  r 2 ) 4 (r 5  5r 3  4r ) 5

   y 2   y2  5 y3  .....
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY4! 5!

4.2 Numerical Integration


Usually Analytical evaluation of integration will be done, Instead Numerical
integration is used to reduce the difficulties in analytical Integration However, when it is
possible to obtain closed form expression by analytical integration it must be preferred
for it’s exactness and generality. The term numerical integration is nothing but the
numerical evaluation of a definite integral.

MCA SEMESTER – 1 NUMERICAL METHODS Page 25


ANNAMALAI UNIVERSITY – SLM

Consider the integral,


b
A   f ( x)dx
a

Where a and b are given constants and f (x) is a continuous function given
analytically by a formula or empirically by a table of values.

Newton cote’s formula

Consider the Newton’s forward difference formula


 n(n  1)  2  n(n  1)(n  2)  3
y( x)  y( x0  nh)  y0  ny0    y 0    y 0  ...................
 2!   3! 

By replacing ' n ' by ' r ' the equation obtained is:


 r (r  1)  2  r (r  1)(r  2)  3
y( x)  y( x0  rh)  y 0  ry0    y 0    y 0  ...................
 2!   3! 
Hence integrate the above equation over n equidistant intervals

1. Trapezoidal Rule
2. Simpson’s Rule (OR) Simpson’s 1/3 Rule
3. Simpson’s 3/8th Rule

Trapezoidal Rule
It is well known that the area under the curve f (x) is in between the ordinates
x  a and x  b . Let the interval a  x  b be divided into n equal parts, each of same
width h given by
(b  a)
h
n

Simplest form of Trapezoidal rule:


It is known that Newton cote’s formula is
ANNAMALAI
ANNAMALAI
x0  nh
 n
UNIVERSITY
1n n 
UNIVERSITY
1n   2 3 2 4

x y( x)dx  hny0  2 y0  2  3  2  y0  6  4  n  n  y0  ......


2 3 2 3

0  
By putting n  1 the equation obtained is:

x0  h
 1 
 y( x)dx  h y
x0
0  y0 
2 
(By neglecting higher order differences)

MCA SEMESTER – 1 NUMERICAL METHODS Page 26


ANNAMALAI UNIVERSITY – SLM


h
2 y0  y0 
2
  y0  ( y0  y0 
h
2
  y0  y1 
h
2
Thus the above equation can be written as,
x0  nh

 y( x)dx  2 ( y  yn )  2( y1  y2  ......................  yn1 )


h
0
x0

Simpson’s Rule

This method provides a modification of the trapezoidal rule for better


approximation. Let the truncation error be written as,
et  Ch 2
(b  a) f ' ' ( )
Where C  
12
By neglecting the higher order terms in the trapezoidal rule, the integration may be
written as,
I  I t (h)  Ch 2
Where I t (h) denotes the numerical integration by
trapezoidal rule with step size h . If the interval (b  a) is divided into m segments, the
interval size is changed to k  (b  a) / m .

The simple way of finding the formula for Simpson’s rule without truncation error
is given below:

Consider the curve LMN shown below, whose equation is y  a  bx  cx 2 . This


is a parabola whose axis is parallel to the y - axis Let the y - axis cut this curve at point
M and let L and M be the points on the curve such that their abscissa are  h and h
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
respectively. Draw the Ordinates LP and NQ. Then OP =  h and OQ = h .

L
M N

MCA SEMESTER – 1 NUMERICAL METHODS Page 27


ANNAMALAI UNIVERSITY – SLM

P O Q X

Simpson’s three-eighth rule

It is another integration formula to find the value of integration. It is distinguished


from the Simpson’s one-third rule by the assumption of k, where the value of k  2h is
assumed. Here in the Simpson’s three-eighth rule, the value of k  3h is to be assumed, in
the improved value of integration, which is already seen while deriving the formula for
Simpson’s one-third rule.

Trapezoidal rule

The trapezoidal rule of integration is given by


h n 1

I   f 0  f n  2 f i 
2 i 1 
where f 0 , f1 ,........, f n are functions of x i.e., Sinx

 I  Sin (0)  Sin ( / 2)  2Sin ( / 8)  Sin ( / 4)  Sin (3 / 8)


h
2

I  8
0  1  20.3827  0.7071  0.9238
2

I  5.0272
16
I  0.98708
Simpson’s rule
The Simpson’s rule of integration is given by,
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
I   f 0  f n  4 f1  f 3  .......  f n1   2 f 2  f 4  ...........  f n2 
h
2
Where f 0 , f1 , f 2 ,................, f n are functions of x i.e., Sinx

 I  Sin (0)  Sin ( / 2)  4Sin ( \ 8)  Sin (3 / 8) 2Sin ( / 4


h
3

 8
0  1  40.3827  0.9238 20.7071
3

 7.6402
24

MCA SEMESTER – 1 NUMERICAL METHODS Page 28


ANNAMALAI UNIVERSITY – SLM

I  1.00009

Some practical applications of Simpson’s rule

1. If the ordinates in the integral represent cross sectional areas at equal


intervals, then Simpson’s rule gives the volume of the solid.

2. If the ordinates denote velocities at equal intervals of time, then Simpson’s


rule gives the distance travelled.

3. This method is much useful to civil engineers for calculating the amount of
earth that must be moved to provide a level highway or supplied to fill a
depression or make a dam.

4. Profiles of the earth levels along different sections are prepared from surveys
and contour maps, and the average height is calculated by the one-third rule,
with respect to the desired level.

Summary: -
 In Numerical differentiation, the derivatives of a given function are calculated by
means of a table, given values of that function.

 The derivatives are f ' ( x), f ' ' ( x),...

 Three formulas called Forward difference, Backward difference and Central


difference formula were used to find the derivatives of a given function.

 Similar to Numerical differentiation, Numerical integration is used to find the


b
value of the definite integral. The definite integral is of the form  f ( x)dx .
a
 By using three rules such as Trapezoidal rule, Simpson's 1/3 rule and Simpson's
3/8th rule, the value of the definite integral can be found out.

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
Important Questions

1. Calculate the value of f ' ( x) and f ' ' ( x) at x  1.35 from the following table
using Newton's forward interpolation formula.

x 1.2 1.2 1.3 1.4 1.5 1.6


f (x) -1.62628 0.15584 2.45256 5.39168 9.12500 13.83072

2. Determine the first and second derivative using the Newton's backward difference
formula from the following data.

MCA SEMESTER – 1 NUMERICAL METHODS Page 29


ANNAMALAI UNIVERSITY – SLM

x 0 1 2 3 4 5
f (x) 0 1 8 27 64 125

dy d2y
3. Find the values of and 2 for x  1.15 , from the following table using
dx dx
Stirling's formula.

x 1.00 1.05 1.10 1.15 1.20 1.25 1.30


f (x) 1.0000 1.0247 1.0488 1.0723 1.0954 1.1180 1.1401

2
4. Using the Trapezoidal rule, evaluate  ydx from the following table.
0 .6

x 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0


f (x) 1.23 1.58 2.03 4.32 6.25 8.36 10.23 12.45
2
1
5. Evaluate x
0
3
1
dx using Simpson's rule by dividing the range into 4 equal parts.

6. The following table gives the values of f (x) at equal intervals of x .

x 0.0 0.5 1.0 1.5 2.0


f (x) 0.399 0.352 0.242 0.129 0.054
2
Evaluate the value of  f ( x)dx
0
using Simpson's 1/3 rule and Simpson's 3/8th rule.

Compare the results.

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY

MCA SEMESTER – 1 NUMERICAL METHODS Page 30


ANNAMALAI UNIVERSITY – SLM

NUMERICAL METHODS
Unit – I
STRUCTURE

5.0 Objective
5.1 Differential Equation
5.2 Predictor and Corrector Methods
5.3 Summary
5.4 Important Questions

5.0 Objective
 Differential Equation
 Euler Method
 Runge – Kutta Method
 Heun’s Method
 Predictor and Corrector Methods
 Adams, Milne’s Predictor & Corrector Methods

5.1 Differential Equation


Using analytical method. Even some linear and nonlinear differential equations
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
present difficulties and require some special attention for their analytical solution. But
numerical methods, on the other hand are more versatile.

Consider the first order differential equation,


dy
 f ( x, y ) (1)
dx
With initial conditions y( x0 )  y0

If the solution is not obtained using the formula or if it is tedious to attain the
solution for that particular problem, Step – by – Step method can be followed. This

MCA SEMESTER – 1 NUMERICAL METHODS Page 31


ANNAMALAI UNIVERSITY – SLM

Method starts from y( x0 )  y0 and proceeds with the approximate value of y1 of the
solution of y of (1) at x  x1  x0  h .

In the second step, an approximate value of y2 of the solution at


x  x2  x0  2h.......... is found.

h is known as step size.

Several methods for solving differential equations are listed as follows:

Euler Method
Runge kutta Method
Milne’s predictor and corrector methods

Euler Method
The simplest method to obtain the solution of differential equation is the Eulers
method. To obtain the solution one should assume the solution curve to be a straight line
over the integration interval. Euler method is a step-by-step method, which gives result in
a set of tabulated values of x and y . It is very inaccurate.

Taylor series, if y  f (x) at the point x  x0 is


( x  x0 ) 2 ( x  x0 )3
f ( x)  f ( x0 )  ( x  x0 ) f ' ( x0 ) f ' ' ( x0 )  f ' ' ' ( x0 )  ............
2! 3!
Now it is explained on how to arrive at the solution of Euler’s method:
Consider the first order differential equation
dy
 f ( x, y )
dx
Condition is y( x0 )  y0

The above solution gives y as a function of x . Hence it can be written as,


y  f (x)
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
Runge Kutta Method
A Runge-Kutta method is a class of most popular methods used in solving
ordinary Differential Equations. Runge-Kutta method doesn’t require the calculation of
higher order derivatives unlike in Taylor’s series in which calculation of these higher
order derivatives is over headache.

MCA SEMESTER – 1 NUMERICAL METHODS Page 32


ANNAMALAI UNIVERSITY – SLM

The higher order derivatives in the Taylor’s series are computed indirectly by
evaluating f ( x, t ) at more than one value of point ( x, t ) over the integration interval
between ti and ti 1 to obtain xi 1

Heun’s Method
With Euler method one can get only approximate solution. To get accurate results
Euler method is modified a bit. A better value of xi 1 can be obtained by finding the
average of slopes at xi and xi 1 in place of f ( xi , ti ) in equation (above equation). For the
differential equation,
dx
 f ( x, t ), x(t0 )  x0
dt

Modified Euler Method

In this method value of xi 1 is found by using slope at an average of two points ti


and ti 1 (i.e. ti  h / 2 ) is used here to evaluate xi 1

Then xi 1 is given by
xi 1  xi  hR*

This method is also called Improved Polygon Method

Fourth order Runge-Kutta Method

This method is popularly known as Runge-Kutta method and it is widely used for
its better accuracy. The solution for this method can be obtained as,

h
xi 1  xi  ( K1  2 K 2  2 K 3  K 4 ) (1)
6
Where K1  f ( xi , ti )

ANNAMALAI
ANNAMALAI
2

K  f x 

hK
2
i
h
,t  
2
1
UNIVERSITY
UNIVERSITY
i

 hK h
K 3  f  xi  2 , ti  
 2 2
K 4  f xi  hK3 , ti  h

Summary of Runge kutta method

MCA SEMESTER – 1 NUMERICAL METHODS Page 33


ANNAMALAI UNIVERSITY – SLM

As seen earlier, the derivations for second order, third order, fourth order formulas
for Runge kutta method are more elaborate. Hence, The above formulas are discussed
here briefly.

1. Second order runge-kutta method:


Steps to be involved to solve a problem :-

 In a problem, the differential equation will be given with initial conditions of x


and y .
The differential equation is represented by the function f ( x, y)
 The task is to find the two increment values for second order method. The
incremental values are represented as K1 , K 2 .
 Hence K1  hf ( x0 , y0 ) and K 2  hf ( x0  h / 2, y0  K1 / 2)
 Then y  K 2

2. Third order Runge kutta method:

 In a problem, the differential equation will be given with initial conditions of x


and y . The differential equation is represented by the function f ( x, y) .
 The steps involved in this method for finding a value of K 2 is same as the steps
involved in second order runge kutta method.
 To find the incremental value K 3 , Where K3  hf ( x0  h, y0  2K 2  K1 ) .

Then y  K1  4 K 2  K 3 
1

6

3. Fourth order Runge kutta method:

Steps to be involved to solve a problem

 In a problem, the differential equation will be given with initial conditions of x


and y . The differential equation is represented by the function f ( x, y) .
 The steps involved in this method for finding a value of K 2 is same as the steps

 ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
involved in second order runge kutta method.
To find the incremental value K 3 . Where K3  hf ( x0  h / 2, y0  K 2 / 2)
 To find the incremental value K 4 . Where K 4  hf ( x0  h, y0  K3 )

Then y  K1  2 K 2  2 K 3  K 4 
1

6

Runge-kutta methods for simultaneous first order differential quations


Consider the simultaneous differential equations,

MCA SEMESTER – 1 NUMERICAL METHODS Page 34


ANNAMALAI UNIVERSITY – SLM

dy dz
 f1 ( x, y, z );  f 2 ( x, y, z )
dx dx
Subject to the conditions y( x0 )  y0 and z ( x0 )  z0

Solution of higher order differential equations by Runge-kutta method


Let the following second order differential equation be considered of the form

d2y  dy 
 g  x, y , 
 dx 
2
dx

Properties of Runge-kutta methods

 The Runge-kutta method does not require prior calculation of the higher
order derivatives of y (x) , as it is done in the Taylor's method.

 The Runge-kutta formulas involve the computation of f ( x, y) at various


positions, instead of derivatives.

 The Runge-kutta methods are one-step methods.

 Runge-kutta methods agree with Taylor series solution upto the terms of
x
h , where r differs from method to method and is known as the order of that
Runge-kutta method.

 Since the differential equations arising in applications are often


complicated, the calculation of derivatives may be difficult.

PREDICTOR & CORRECTOR METHOD

While using the Runge-Kutta methods for the solution of differential equations,

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
information at only previous point ( xi , ti ) is used to evaluate xi 1 at ti 1 . It is easier when
( x0 , t0 ) is used to evaluate x1 and t1 .

Adam and Milne derived the predictor and corrector formulas.

Adams Predictor formula


A more accurate Predictor – corrector formula is obtained at the fourth order open
Adams formula and fourth order closed Adams formula.

MCA SEMESTER – 1 NUMERICAL METHODS Page 35


ANNAMALAI UNIVERSITY – SLM

Let the first order differential equation be of the form,


dx
 f ( x, t ) and x(t0 )  x0
dt

Adams Corrector Formula


By using the backward expansion of x(t ) about x(t  h) in the Taylor series
h2 h3
x(t )  x(t  h)  hf i 1 
f 'i 1  f ' 'i 1
2 6
Using the relation xi  x(ti ) and xi 1  x(ti 1 ) , the equation obtained is:
h2 h3
xi  xi 1  hf i 1  f 'i 1  f ' 'i 1 (1)
2 6

This would reduce a time and such pairs of formulas are called as Predictor-
Corrector methods.
Consider a second order Adams closed formula, which is equivalent to the
predictor formula of second order

xi(01)  xi 1  2hf i (2)

The estimate of the truncation error at the (i  1)th stage is obtained as,

et 
1
5

xi 1  xi(01) 

Where xi 1 is the value of xi(m11) obtained after the last iteration of equation (4).
The equation converges if h  2 / S , where S is the maximum value of df / dx over the
integration interval.

Hence the more accurate corrector formula is obtained at the fourth order closed
Adams formula.
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
It can be written as,

 9 ( m) 19 5 1 
xi(m11)  xi  h f i 1  fi  f i 1  f i 2 , m  0,1,2,......
 24 24 24 24 

This is called as Adams corrector formula.

Milne's Predictor formula

MCA SEMESTER – 1 NUMERICAL METHODS Page 36


ANNAMALAI UNIVERSITY – SLM

Consider the differential equation,

dy
 f ( x, y ) , Subject to the condition y( x0 )  y0 .
dx

The equation is known as Milne's Predictor formula.

Milne's Corrector formula

In Milne's corrector formula, the equation (1) should be integrated with respect to
x over the interval x0 to x0  2h , whereas in Milne's predictor formula, the equation (1)
will be integrated with respect to x over the interval x0 to x0  4h . Hence the only
difference in deriving the Milne's predictor and corrector formula is their intervals.

Hence equation (1) becomes


x0  2 h x0  2 h
r (r  1) 2
 y' dx 
x0
 ( y '  ry '
x0
0 0
2
 y0 '...........)dx (1)

By neglecting the error in the above equation, the equation obtained is:
 yn 1  yn 1   y'n 1 4 y'n  y'n1 
h
3

The equation is called as Milne's corrector formula.

The problems given here are solved using two methods shown below:
1.Euler's method
2.Modified Eulers method

Problem:

1. The differential equation is given by dy / dx  x 2  y , where the initial conditions

ANNAMALAI
ANNAMALAI UNIVERSITY
are
UNIVERSITY
y(0)  1.0 , It is desired to obtain the value of y(0.2), y(0.4) . Here h  0.1

1. Euler's method:

By Euler's method, y1  y0  hf ( x0 , y0 )
dy
Given: f ( x, y)   x2  y
dx
x0  0, y0  1.0 (Since y (0) = -1.0)
h  0.2

MCA SEMESTER – 1 NUMERICAL METHODS Page 37


ANNAMALAI UNIVERSITY – SLM

Solution:

(i) It is known that, y1  y0  hf ( x0 , y0 )


f ( x0 , y0 )  x02  y0
= 0 + 1.
 f ( x0 , y0 )  1.0

2. Modified Eulers method:

Eulers modified formula in general can be written as,


y m1  y m   f ( xm , y m )  f ( xm  h, y m  hf ( xm , y m ))
h
2
Here f ( xm , y m )  ( xm  y m )
2

Let m  0 , Therefore the above equation can be written as,


y1  y 0   f ( x0 , y0 )  f ( x0  h, y0  hf ( x0 , y0 ))
h
2

Therefore f ( x0 , y0 )  ( x0  y0 )
2

 f ( x0 , y0 ) = 0 + 1.0
 f ( x0 , y0 ) = 1.0
And, f ( x0  h, y0  hf ( x0 , y0 ))  f (0  0.2,1.0  0.2(1.0)) {given x0  0 &
y0  1.0 }
f ( x0  h, y0  hf ( x0 , y0 ))  f (0.2,1.2)

Therefore f (0.2,1.2)  (0.2) 2  1.2


ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY = 1.24

Problem:
Obtain the value of y(0.4) using Adam's and Milne's method, given that,
dy
 x 2  y, y(0)  1; y(0.1)  0.90516; y(0.2)  0.82127; y(0.3)  0.74918.
dx

Solution:

MCA SEMESTER – 1 NUMERICAL METHODS Page 38


ANNAMALAI UNIVERSITY – SLM

To find y(0.4) i.e., y4 = ?

dy
Given:  x 2  y  y'
dx

x0  0; y0  1
x1  0.1; y1  0.90516
x2  0.2; y2  0.82127
x3  0.3; y3  0.74918
x4  0.4

Adam's predictor method:


Adam's predictor formula is given by,
yn 1, p  yn  55 y'n 59 y'n1 37 y'n2 9 y'n3 
h
24
By putting n  3 , so as to get y4, the equation obtained is:
y4, p  y3  55 y'3 59 y'2 37 y'1 9 y'0 
h
(1)
24

Adam's corrector method

Adam's Corrector formula is given by,


yn1,c  yn  9 y'n1 19 y'n 5 y'n1  y'n2 
h
24
By putting n  3 , so as to get y4, the equation obtained is:
y4,c  y3  9 y'4 19 y'3 5 y'2  y'1 
h
(2)
24
ANNAMALAI
ANNAMALAI
y'  x  y 
4
UNIVERSITY
UNIVERSITY
2
4

 x  y4
2
4

 (0.4) 2  0.6896
 0.5296

Milne's predictor method


Milne's predictor formula is given by,

MCA SEMESTER – 1 NUMERICAL METHODS Page 39


ANNAMALAI UNIVERSITY – SLM

4h
2 y'n2  y'n1 2 y'n 
yn1, p  yn 3 
3
By putting n  3 , So as to get y4 , we get

y4, p  y0  2 y'1  y'2 2 y'3 


4h
(3)
3

Milne's corrector method


Milne's corrector formula is given by,
yn1,c  yn 1   y'n1 4 y'n  y'n1 
h
3
By putting n  3 , So as to yield y4 , the equation obtained is:

y4,c  y2   y'2 4 y'3  y '4 


h
(4)
3

Problem:
Determine the value of y(0.1) , y(0.2) , y(0.3) by using Runge-kutta method.
Using the above values, find y(0.4) through Adam's predictor-corrector method. The
given values are y(0)  1 and the differential equation is given by,
dy 1
 xy
dx 2
Solution:
Given:
dy 1
f ( x, y)   xy
dx 2
y(0)  1 , h  0.1

Therefore, x0  0 y0  1
Using Runge-kutta method to find y(0.1) , y(0.2) , y(0.3)

ANNAMALAI
ANNAMALAI

UNIVERSITY
UNIVERSITY
Adam's predictor formula is,

yn 1, p  yn 
h
55 yn'  59 yn' 1  37 yn' 2  9 yn' 3
24

By putting n = 3, we can obtain the value of y(0.4) . So that,


y4, p  y3 
h
24

55 y3'  59 y2'  37 y1'  9 y0'  (1)

MCA SEMESTER – 1 NUMERICAL METHODS Page 40


ANNAMALAI UNIVERSITY – SLM

5.3 Summary
 In this unit, we saw that the numerical solution of an ordinary differential
equation can be found out with the given initial conditions.

 Euler's method, Runge kutta method, Milne's predictor corrector method, Adam's
predictor corrector method are the four methods used to find the solution of an
ordinary differential equation.

 For Milne's predictor corrector method and Adam's predictor corrector method, at
least four values prior to the required value must be required.

 The values can be obtained by using Runge kutta method, if it is not given.

5.4 Important Questions

dy y  x
1. Solve the first order differential equation  in the interval 0  x  0.1 by
dx y  x
Euler's method taking h=0.02 and y(0)  1 . find the value y(0.1) .
dy  1
2. Using Euler modified method, solve the differential equation  y y   by
dx  x
taking y = x =1 and h=0.1.find the value of y at x =1.6.

3. Solve, using Fourth order Runge-kutta method,


dy y
 3x  ; y(0)  1
dx 2
Find the value of y(0.2)
dy
4. Given  x  y 2 , y(0)  0, y(0.2)  0.02, y(0.4)  0.0795 and y(0.6)  0.1762
dx
ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY
Find the value of y(0.8) correct to 4 decimal places by using Milne's Predictor
Corrector method.

5. Find the solution of the initial value problem by using Adam's Predictor Corrector
dy
method at y(1.4) . Given  x( x  xy ) , y(1)  1, y(1.1)  1.233, y(1.2)  1.548
dx
and y(1.3)  1.979 .

MCA SEMESTER – 1 NUMERICAL METHODS Page 41


ANNAMALAI UNIVERSITY – SLM

dy
6. Calculate y(0.4) from  3e x  2 y using Adam's Predictor Corrector method
dx
by calculating the value of y(0.1), y(0.2), y(0.3) using fourth order Runge-kutta
method. Given y(0)  0 .

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY

MCA SEMESTER – 1 NUMERICAL METHODS Page 42


ANNAMALAI UNIVERSITY – SLM

References
1. M.K.Jain, S.R.K.Iyengar and R.K.Jain, “Numerical methods for
Scientific and Engineering Computation”, New Age International (P)
Ltd, Publishers, 1996.
2. Steven C.Chapra and Raymond p. Canale, “Numerical Methods for
Engineers with programming and Software Applications”, Third
Edition, TMH, NewDelhi. 2000.

ANNAMALAI
ANNAMALAI UNIVERSITY
UNIVERSITY

MCA SEMESTER – 1 NUMERICAL METHODS Page 43

You might also like