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

M.Sc.-Mathematics-Numerical-Analysis

The document outlines the syllabus for the M.Sc. Mathematics Semester III course on Numerical Analysis at the University of Mumbai. It includes course outcomes, unit topics, and detailed content on numerical integration methods such as the Trapezoidal Rule and Simpson's Rule, along with their applications and error estimates. The document also lists recommended textbooks and provides a structured approach to learning numerical techniques for solving mathematical problems.

Uploaded by

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

M.Sc.-Mathematics-Numerical-Analysis

The document outlines the syllabus for the M.Sc. Mathematics Semester III course on Numerical Analysis at the University of Mumbai. It includes course outcomes, unit topics, and detailed content on numerical integration methods such as the Trapezoidal Rule and Simpson's Rule, along with their applications and error estimates. The document also lists recommended textbooks and provides a structured approach to learning numerical techniques for solving mathematical problems.

Uploaded by

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

31

M.Sc. Mathematics
SEMESTER - III (CBCS)

MATHEMATICS PAPER -IV


NUMERICAL ANALYSIS
SUBJECT CODE : PSMT/PAMT3010
© UNIVERSITY OF MUMBAI

Prof. Suhas Pednekar


Vice-Chancellor,
University of Mumbai,

Prof. Ravindra D. Kulkarni Prof. Prakash Mahanwar


Pro Vice-Chancellor, Director,
University of Mumbai, IDOL, University of Mumbai,

Programme Co-ordinator : Shri Mandar Bhanushe


Asst. Prof. cum Asst. Director in Mathematics,
IDOL, University of Mumbai.

Course Co-ordinator : Mr. Sumit M. Dubey


Assistant Professor,
IDOL, University of Mumbai
Course Writer : Dr. B.S. Jaiswar
Birla College of Arts, Science & Commerce,
Birla College Road, Kalyan (W), Thane
: Prof. Prakash U. Sansare
Birla College of Arts, Science & Commerce,
Birla College Road, Kalyan (W), Thane
: Prof. Gajanan V. Dhumal
Birla College of Arts, Science & Commerce,
Birla College Road, Kalyan (W), Thane
: Prof. Krishna E. Ghode
Birla College of Arts, Science & Commerce,
Birla College Road, Kalyan (W), Thane
: Prof. Manish Pithadia
Viva College,
Virar, Thane

October 2021, Print - 1

Published by : Director,
Institute of Distance and Open Learning ,
University of Mumbai,
Vidyanagari, Mumbai - 400 098.

DTP Composed : Mumbai University Press


Printed by Vidyanagari, Santacruz (E), Mumbai
CONTENTS
Unit No. Title Page No.

1 Numerical Integration - I 1
2. Numerical Integration - I 21
3. Approximation of Function 36
4. Least Squares Approximation 52
5. Numerical Solution of Differential Equation - I 69
6. Numerical Solution of Differential Equation - II 87
7. Numerical Solution of Partial Differential Equations 114


I

Syllabus
M.Sc. Mathematics Part - II, Paper - IV
Numerical Analysis
Course Outcomes :
1. Students will be able to grasp the concept of numerical solution of
various mathematical problems and corresponding errors.
2. Students will be able to understand the approximation of functions by
least square method.
3. Students will aware about applications of various numerical techniques
in the solution of difference equations, ordinary and partial differential
equations.
Note : Numerical methods be taught with error estimate, convergence and
stability
Unit I: Approximation of functions (15 Lectures)
Least squares approximation, Weighted least squares method,
Gram-Schmidt orthogonalizing process, Least squares approximation by
Chebyshev polynomials. Discrete Fourier Transform and Fast Fourier
Transform.
Unit II: Differential and Difference Equations (15 Lectures)
Differential equations: Solutions of linear differential equations
with constant coefficients by Predictor corrector methods and Milne's
method. Galerkin's method for two point linear boundary value problems.
Difference Equations: Linear difference equation with constant
coefficients and methods of solving them.
Unit III: Numerical Integration (15 Lectures)
Derivation of a formula for numerical integration in terms of finite
1
difference and its special cases viz Trapezoidal, Simpson's rule and
3
3
Simpson's rule. Boole's and Weddle's rule, Guass Legendre numerical
8
integration, Gauss-Chebyshev numerical integration, Gauss-Hermite
numerical integration, Gauss-Laguree numerical integration with the
derivation of all methods using the method of undetermined coefficients.
Romberg's method. Gaussian quadratures, Multiple integrals.
Unit IV: Numerical solutions of Partial Differential Equations (15
Lectures)
Classifications of Partial Differential Equations, Finite Difference
approximations to derivatives. Numerical methods of solving elliptic,
parabolic and hyperbolic equations.
Recommended Text Books
1. H. M. Antia, Numerical Analysis, Hindustan Publications.
2. K. E. Atkinson, An Introduction to Numerical Analysis, John Wiley
and sons, 2008.

1

1
NUMERICAL INTEGRATION – I
Chapter Structure

1.1 Objective
1.2 Introduction
1.3 Newton – cote’s quadrature formula
1.4 Trapezoidal Rule
1.5 Error in Trapezoidal rule
1.6 Simpson’s one third rule
1.7 Error in Simpson’s 1/3rd rule
1.8 Simpson’s 3/8th rule
1.9 Error in Simpson’s (3/8)th rule
1.10 Review
1.11 Unit End Exercise

1.1 OBJECTIVE

* After going through this chapter you will be able to :


* Solve any definite integral in interval [a, b].
* Solve unknown function integral by numerical method.
* Learn different technique for solving definite integral by numerical
method.
* Solve definite integral very efficient way.

1.2 INTRODUCTION

Differentiation and integration are basic Mathematical operation


with a wide range of applications in many areas of science.

In this we are going to explose various ways for approximating the


integral of a function over a given domain. These are various reasing as of
why such approximations can be useful.

i) Not every function can be analytically integrated.


1 1 1 tan x
e.g. :  dx or 0 x dx .
0 1  x3

ii) Even if a closed integration formula exists it might still not be the most
efficient way of calculating the integral.
2

iii) It can happen that we need to integrate an unknown function in which


only some examples of the functions are known.

b
A simpler approach for approximating the value of  f  x  dx
a
would be
to complete the product of the value of the function at one of the end points of
the interval by the length of the interval.

In case we choose the end-point where the function is evaluated to be


x = a we obtained
b

 f  x  dx ~ f  a  b  a 
a

This approximation is called rectangular method or the rectangular


quadrature. The points x0 , x1 ,....., xn that are used in the quadrature formula are
called quadrature points.

y
y=f(x)

y1 y2 yi yn

x0 x0 + n x0 + ih x0 + nh x

We may approximate the integrate by a linear curve i.e. (y = a + bx) or by


a second degree curve
i.e. by (y = a + bx + cx2) …. and soon.
Here we will learn till three degree polynomial by numerical integration
using :
i) Trapezoidal rule (linear curved)
ii) Simpson’s one-third rule (second degree)
iii) Simpson’s third-eight rule (third degree)
3

1.3 Newton – cote’s quadrature formula :


The newton cote’s is an extremely useful and straight forward family of
numerical integration techniques using this we can derive the all three numerical
integration formula which we need.

b
Let I   f  x  dx
a

Let us divide the interval (a, b) into n – sub intervals of width h. as shown
in figure (1) so that x0 = a, x1 = x0 + h, x2 = x0 + 2h ….. + xn = x0 + nh = b.

x0  nh
Then I   f  x  dx
x0

taking x  x0  ph  dx  hdp
x0  nh
I   f  x0  ph  dph
x0

= By newton’s forward interpolation formula.


n  2
p  p  1 yw p  p  1 p  2  3 
 h   y0  pyo    y0  ... dp
0 
 2! 3! 

Integrating term by term we obtain


2
 n n  2 n  3 2 n  n  2 3 
 nh  y0  y0   y0   y0  .....
 2 12 2h 

x0  nh 2
 n n  2n  3 2 n  n  2 3 
  f  x  dx  nh  y0  y0   y0   y0  ....
x0  2 12 2n 

Which is known as the newton –cote’s quadrature formula using this we


can deduce the following rule taking n = 1, 2, 3, …..

1.4 Trapezoidal Rule :

Taking n = 1 in newton cote’s formula at the curve (x0, y0) to (x1, y1) as a
straight line.

i.e. polynomial of order are so that higher order difference become zero
we get,
4

x0  h  1 
 f  x  dx  h  y0  y0 
x
 2 
h
  y0  y1 
2
x  2h h
Similarly  f  x  dx   y1  y2 
x0 2
.
.
.
x0  nh h
x0 f  x  dx  2 yn 1  yn  
Adding these integrals we get
x0  nh h
x0 f  x  dx  2  y0  yn   2  y1  y2  ...  yn1 
This is known as the trapezoidal rule.

y
y = f (x)

x0 = a x0 +n x0 +2n x 0 + nh x
b
Working of trapezoidal rule. For  f  x  dx
a
Let y = f (x) take n value of x in interval [a, b]

x x0 x1 x2 ..... xn
y y0 y1
y2 ..... yn
b h
a f  x  dx  2  y0  yn   2  y1  y2  .....  yn 1  
ba
where h 
n
5

Example :
6 1
1) Evaluate  dx taking h = 1 by using trapezoidal rules.
0 1  x3

Solution :
Divide the interval (0, 6) into six parts each of width h = 1. The value of
1
f  x  are given below :
1  x3
x 0 1 2 3 4 5 6
y 1 0.5 0.11 0.0357 0.0154 0.0079 0.0046
y0 y1 y2 y3 y4 y5 y6
by trapezoidal rule
b h
a f  x  dx  2  y0  yn   2  y1  y2  .....  yn 1 
1
 1  0.0046   2  0.5  0.11  0.0357  0.0154  0.0079  
2
1
 1.0046   2  0.669  
2
1
 1.0046  1.338
2
1
  2.3426 
2
 1.1713

Ex.2 :
1
Evaluating  sin x  cos x dx taking 5 sub-intervals using trapezoidal rules.
0

Soln :

Here n = 5, a = 0, b = 1
b  a 1 0
h   0.2
n 5

x 0 0.2 0.4 0.6 0.8 1


y 1 1.0857 1.1448 1.1790 1.1891 1.1755

by trapezoidal rule
b h
a f  x  dx  2  y0  yn   2  y1  y2  .....  yn1 
0.2
 1  1.1755   2 1.0857  1.1448  1.790  1.1891 
2 
 0.1  2.1755  2  4.5986  
6

 0.1  2.1755  9.1972


 1.13727

Ex.3 :
1 dx
Evaluate  1 x 2
by trapezoidal rule.
0

6 – coordinate, also determine absolutely error.

Soln :
Here a = 0, b = 1, n = 5

b  a 1 0
h   0.2
n 5
1
f  x 
1  x2

x 0 0.2 0.4 0.6 0.8 1


y 1 0.9615 0.8621 0.7353 0.6098 0.5

by trapezoidal rule
b h
a f  x  dx  2  y0  yn   2  y1  y2  .....  yn1 
0.2
 1  0.5   2  0.9615  0.8621  0.7353  0.6098  
2 
 0.1 1.5  2  3.1687  
 0.1 1.5  6.3374 
 0.78374 .

1 1 1 1 
 f  x  dx   1  x dx   tan 1  x    tan 1 1  tan 1  0  
2
0 0 0 4

Absolute error   0.78374
4
 0.00165 .
7

1.5 Error in Trapezoidal rule :

y y = f (x)
y1 = f (x)

A1 A2

x=x0 x=x 1 x=b x


 The expression of y = f (x) about x = x0 by
Taylor’s theorem is given by

y  f  x   f  x0    x  x0  f
 x  x0 
1
 x0   f 11  x0   .....
2!
x1
f  x  dx 
x1   x  x0  f 11 x  .....
 f  x0    x  x0  f  x0  
1
   1 
x0 x0
 2! 
2 3 x1
x1   x  x0  1  x  x0  11 
 f  x  dx   xf  x0   f  x0   f  x0   .....
x0
 2 6  x 0
2 3

  x  x0  f  x0  
 x1  x0  f 1  x0  
 x1  x0  f 11  x0   .....
2 6

Put x1  x0  h

x1 h2 1 h3 11
 f  x  dx  hf  x   f  x0   f  x0   .....
x0 2 6

Area of trapezoidal in the interval  x0 , x1  is


h
A1   y0  y1 
2
by trapezoidal rule
h
A1   f  x0   f  x0  h  
2
by taylor’s Thm
8

h  h 2 11 
A1   f  x0   f  x 0   hf 1
 x0   f  x0   .....
2  2! 
2 3
 h 1 h 11 
A1   hf  x0   f  x0   f  x0   .....
 2 4 

Let  1 be the error in the interval  x0 , x1 


x1
1   f  x  dx  A1
x0

1 1 
 h 3    f 11  x0   .....
6 4
–1 3 11
1  h f  x0 
12
Similarly :
x2 –1 3 11
1   f  x  dx  A2  h f  x1 
x1 12
x3 1 3 11
2   f  x  dx  A3  h f  x2 
x2 12
.
.
.
xn 1 3 11
n   f  x  dx  An  h f  xn 1 
xn  1 12
The total error
   1  .....   n
h3
  f 11  x0   f 11  x1   f 11  x2   .....  f 11  xn1  
12 
Choose f 111  max  f 11  x0  , f 11  x1  , f 11  x2  , .....
h3
1  f 11   1  n
12
h3
 b  a  11
1    f 1 
12
 h 
1  
b
 a  2 11
h f 1 
12
Which is the required error in trapezoide rule.

Practice Problem :

Evaluate the following integral by using trapezoidal rule.


2
i)  x 2 dx with n  0 Ans. : 2.68
0
9

5 dx
ii)  with n  10 Ans. : 0.4055
0 4x  5

0.6 2
iii)  e x dx with n  6 Ans. : 0.5357
0

1.6 Simpson’s one third rule :

While taking n = 2 in newton cote’s formula we get


x  nh h
x0 f  x  dx  3  y0  yn   4  y1  y3  .....  yn1   2  y2  y4  .....  yn2 
0

This is known as the Simpson’s one third rule.

In Simpson’s rule the given interval must be divided into even number of
equal sub-interval since we find the area of two strips at 0 time.
b
Working of Simpson’s one third rule for  f  x  dx .
a

Let y  f  x  , taking n – value of x in [a, b].


x x0 x1 x2 x3 ..... ..... xn
y y0 y1 y2 y3 ..... ..... yn
x
0 nh
h
 f  x  dx   y0  yn   4  y1  y3  .....  yn 1   2  y2  y4  .....  yn  2  
x0 3 

Where h  b – a / n

Ex. 1 :

8 dx
Calculate upto 4 decimal places  dx by using Simpson’s
3
16 x  x 2
(1/3)th rule taking n = 5.
Soln :
1
Here f  x   a = 3, b = 8, n = 5,
16 x  x 2
ba 83
h  1
n 5

x 3 4 5 6 7 8
y 0.1601 0.1443 0.1348 0.1291 0.1259 0.125
y0 y1 y2 y3 y4 y5

using Simpson’s (1/3)rd rule.


10

b h
 f  x  dx  3  y
a
0  y1   4  y1  y3  .....  yn1   2  y2  y4  .....  yn 2  

1
  0.160  0.125   4  0.1443  0.1291  2  0.1348  0.1259  
3

1
 0.2851  1.0936  0.5286
3
1
 1.9073 
3
 0.6357

Ex. 2 :

 sin 2 x
Evaluate  dx by taking 5 ordinates by Simpson’s (1/3)rd rule.
0 5  4cos x

Soln :

We divide the interval  0,   into 4 - equal part i.e. (5 ordinates).


ba  0 
h  
n 4 4

x 0   3   using calculate 
4 2 4
in degree mode 
y 0 0.0639 0.2 0.2302 0  
y0 y1 y2 y3 4

by Simpson’s (1/3)rd rule.

b h
 f  x  dx  3  y
a
0  yn   4  y1  y3  .....  2  y2  y4  ..... 


 4  0  0   4  0.0639  0.2302   2  0.2  
3  

 1.1764  0.4
12
 0.4127 .
11

1.7 Error in Simpson’s 1/3rd rule :

fi

fi+ 1 fi + 2

xi xi + 1 xi + 2

Let y  f  x  be a continuous functions and continuous derivation of all


orders in [a, b]. Divide the interval [a, b] into n equal sub-intervals by the points
a  x0 , x1 , ....., x n  b & x1  x0  ih i  1.2 ..... n .
The Taylor’s expression of y  f  x  atleast x  x0 is
2 3

y  f  x   f  x0    x  x0  f
 x  x0   x  x0 
1
 x0   f 11
 x0   f 11  x0  .....
2! 3!

2 3
x2  x2 1  x  x0  11  x  x0  111 
 f  x  dx    f  x0    x  x0  f  x0   f  x0   f  x0   ..... dx
x0

x0 2! 3! 

2 3 4 x2
  x  x0  1  x  x0  11  x  x0  111 
  xf  x0   f  x0   f  x0   f  x0  
 2! 3! 4!  x 0

2 3
  x2  x0   x2  x0  11 
  x2  x0  f  x0   f  x0  
1
f  x0   .....
 2! 3! 
Put x2  x0  2h
4 2
 2 hf  x0   2h 2 f 1  x0   h3 f 11  x0   h 4 f 11  x2  …………. (I)
3 3

by Simpson’s 1/3 rd rule.


h
A1   y0  4 y1  y2 
3
12

h
  f  x0   4 f  x0  h   f  x0  2 h  
3 

Using taylor’s thm.


h   h 2 11 h 3 11 
A1   f  x0   4  f  x0   hf 1  x0   f  x0   f  x0   .....  
3   2 6 

2
4 h 2 11 8h 3 11 
f  x0   2hf 1
 x0   f  x0   f  x0   .....
2 6 

h  1 8h 2 11 
  6 f  x0   6 hf  x0   f  x0   2 h3 f 11  x0  
3  2 

4 3 11 2
 2 hf  x0   2h 2 f 1  x0   h f  x0   h 4 f 111  x0   ..... (I)
3 3

Let 1 be the error in the interval  x0 , x1 


x2
E1   f  x  dx  A1
x0

4 5
 h5 f IV
x0  
   .....
 15 15 
5
h IV
 f
90  x0 

Similarly

x4  h5 IV
E3   f  x  dx  A2  f
x2 90  x2 
.
.
.
xn  h5 IV
En 1  x f  x  dx  An2  f  xn 2 
n 2 90

 The total error

E  E1  E2  .....  En 1
 h5
  f II  x0   f IV  x2   .....  f IV  xn 2  
90 

Choose fIV
1
 M ax f IV
x0  
, f  IV
x2 
, ....., f x 
n2
IV

13

h 5 n IV
E f  
90 2
h5  b  a  IV
E f  
90 h
 b  a  4 IV
E h f   x0    hn
180
Which is the required even in composited Simpson’s 1/3rd rule.

1.8 Simpson’s 3/8th rule :

While taking n = 3 in newton’s take formula we set all differences uppers


then 3 rd forward difference will becomes zero.
x3  9  3 
x0 f  x  dx  h 3 y0  2  y1  y0   h  y2  2 y1  y0   8  y3  3 y2  3 y1  y0   .....

3h
 8 y0  12  y1  y0   6  y2  2 y1  y0    y3  3 y2  3 y  y0   .....
8 
3h
  y0  3 y1  3 y2  y3 
8
Similarly
x6 3h
x3 f  x  dx  8  y3  3 y4  3 y5  y0 
.
.
.
xn 3h
xn3 f  x  dx  8  yn3  3 yn2  3 yn1  yn 
[where n is divisible by 3]

We add all above integral

b x3 x6 xn
 f  x  dx  
a x0
f  x  dx  
x3
f  x  dx  ..... 
xn 3
f  x  dx

3h
  y0  3 y1  3 y2  y3    y3  3 y4  3 y5  y6   .....   yn3  3 yn 2  3 yn1  yn 
8 

3h
  y0  yn  3( y1  y2  y4  y5  .....  yn2  yn 1   2  y3  y6  y9  .....  yn3 
8 

b
Working of Simpson’s (3/8)th rule for  f  x  dx
a
14

Let y  f  x  take n- value of x in [a, b]


x x0 x1 x2 ..... ..... xn
y y0 y1 y2 ..... ..... yn
b 3h
 f  x  dx  8  y
a
0  yn   3  y1  y2  y4  y5  .....  2  y3  y6  ..... 
ba
where h  .
n

Ex 1 :

5.2
Evaluate  log e x dx by Simpson’s (3/8)th rule taking n = 6 sub interval.
4

Soln :
Dividing the interval [4, 5.2] in six equal part taking h = 1 we get f  x 
value f  x   log e x are given below.
b  a 5.2  4 1.2
h    0.2
n 6 6

x 4 4.2 4.4 4.6 4.8 5.0 5.2


y 1.3863 1.4351 1.4810 1.5260 1.5686 1.6094 1.6484

by using Simpson’s (3/8)th rule.

b 3h
 f  x  dx 
a
 y0  yn   3  y1  y2  y4  y5  .....  2  y3  y6  ..... 
8 

3  0.2
 1.3863  1.6486   3 1.4351  1.4816  1.5886  1.6094   2 1.5260  
8

 0.075 3.0349  3  6.1147   2 1.5260  


 0.075  3.0349  18.3441  3.052
 0.075  24.431
 1.8323

Ex 2 :

0.6 2
Evaluate  e x dx taking n = 6 by Simpson’s (3/8)th rule.
0
15

Soln :
2
Here f  x   e x a0 b  0.6 n6
b  a 0.6  0
h   0.1
n 6

x 0 0.1 0.2 0.3 0.4 0.5 0.6


y 1 0.99 0.9608 0.9139 0.8521 0.7788 0.6976
y0 y1 y2 y3 y4 y5 y6

by using Simpson’s (3/8)th rule.


b 3h
 f  x  dx   y0  yn   3  y1  y2  y3  y4  .....   2  y3  y6  ..... 
a 8 

3  0.1
 1  0.6976   3  0.99  0.9608  0.8521  0.7788   2  0.9139  
8
 0.0375 1.6976  10.745  1.8278
 0.0375  14.2705
 0.5351 .

1.9 Error in Simpson’s (3/8)th rule :

Let y  f  x  be a continuous function and hence continuous derivatives


of all under in [a, b]. Divide the interval [a, b] into n sub interval by the point
a  x0 , x1 , x2 , ....., x n b & xi  x0  ih i  1, 2, ....., n

The taylor’s expansion of y  f  x  about x  x0 is


2

y  f  x   f  x0    x  x0  f
 x  x0 
I
 x0   f II  x0  
2!
3 4
 x  x0  f III  x0  
 x  x0  f IV  x0   .....
3! 4!
x3 x3
  f  x  dx   [ f  x0    x  x0  f I  x0  
x0 x0
2 3 4
 x  x0   x  x0   x  x0 
f II
 x0   f III
 x0   f IV  x   .....]dx
2! 3! 4!

2 3 4 5 x3
  x  x0  f I x   x  x0  f II x   x  x0  f III x   x  x0  f IV x  .....
  xf  x0    0  0  0   0
 2 6 24 120 
x0
16

2 3
 x3  x0   x3  x0 
  x3  x0  f  x0   f I
 xa   f II  x0 
2 6
4 5
 x3  x0   x3  x0 
 f III  x0   f IV  x0   .......II
24 120
Put x3  x0  3h

9 2 I 27 3 II 81 4 IV 243 5 IV
 3h f  x0  h f  x0   h f  x0   h f  x0   h f  x0 
2 6 24 120
…. (I)
th
By Simpson’s 3/8 rule

3h
A1   y0  3 y1  3 y2  y3 
8
3h
  f  x0   3 f  x0  h   3 f  x0  2 h   f  x0  3h  
8 

Using Taylor’s thm

3h   1 h2 11 h3 111 h 4 iv 
A1   f  x0   3  f  x0   hf  x0   f  x0   f  x 0   f  x0   ....
8   2 6 24 
2 3
 4h II 8h 16 4 IV 2 
 3  f  x0   2hf II  x0   f  x0   f III  x0   h f  x0   ..... 
 2 6 24 
 9 27 3 III 81 4 IV 
  f  x0   3hf I  x0   h 2 f II  x0   h f  x0   h f  x0   ..... 
 2 6 24 

3h  I 2 II 132 4 IV 
 8 f  x0   12hf  x0   12 h f  x0   9h3 f II  x0   h f  x0   .....
8 24 

9 2 I 9 27 4 III 33 5 IV
 3hf  x0   h f  x0   h3 f II  x0   h f  x3   h f  x0 
2 2 8 16
…… (II)

Let E1 be the error in the interval  x0 , x3 


h
I2   y0  y1   2  y2  
2
1
 0.5  0.1667   2  0.3333 
2
I 2  0.6666
3h5 5 IV
 h f  x0 
80
17

Similarly
x6 3 5 IV
 f  x  dx  A3  h f  x3 
x3 80
.
.
.
xn 3 5 IV
 f  x  dx  An3  h f  xn 3 
xn  3 80
3h5
 Total error =  f  x0   f IV  x3   .....  f IV  xn3  
80 
Choose Max f IV   1   M ax  f  x0  , f IV  x0  ..... f IV  xn 3 
h5
n f IV  1 
E
80
h5
 n f IV  1 
80
  b  a  5 IV
 h f 1 
80
Which is required error in Simpson’s 3/8th rule.

v0  nh h
 f  v  dt   y0  yn   4  y1  y3  y5  .....  yn1   2  y2  y4  .....  yn 2  
v0 3 

ba
where h  a  v0 b  v0  nh
n
In Simpson’s (1/3)rd rule the given interval must be divide into even number of
equal sub intervals.

Ex. 1 :

The velocity V km/min of a train which strats from rest is given at a fixed
interval of time (min) as follows :

t : 0 2 4 6 8 10 12 14 16 18 20
v : 0 10 18 25 29 22 20 11 05 02 0

Estimate approximately the distance covered in 20 minutes by train.

Soln :

Let S (km) be the distance covered in t (min) by train


ds
 v
dt
18

ds  vdt
20
S   v dt
0
by Simpson’s (1/3)rd rule h  b  a / n
20  0
 2
10
h  2.
20 h
  v dt   y0  yn   4  y1  y3  .....   2  y2  y4  ..... 
0 3
2
  0  0   4 10  25  32  11  2   2 18  24  20  5  
3
2
  0  4  80  2  72
3
 309.33 km.
Hence in 20 mins train covered 309.33 kms distance.

 Simpson’s (3/8)th rule :

This is 3 rd child of newton cote’s


 n  3 we get

v0 nh 3h
 f  v  dt 
 y0  yn   3  y1  y2  y4  y5  .....  2  y3  y6  ..... 
v0 8 
ba
where h  a  v0 b  v0 nh
n
while applying the Simpson’s (3/8)th rule the number of sub interval should be
taken as multiple of 3.

Ex. a) :

The water under portion of a water tank is divided by horizontal plane’s


one meters apart into the following areas : 472, 392, 302, 198, 116, 60, 34, 12, 4
sq.m. use the Simpson’s (3/8)th rule to find the volume in cubic meter between
the two extreme ends.

Soln :

As given condition we can write :

Distance (S) : 1 2 3 4 5 6 7 8 9
Area (A) : 472 398 302 198 116 60 34 12 04

Here sub interval are multiple of 3


b  a 9 1
h   1
n 8
19

9 3h
 Ads   y0  yn   3  y1  y2  y4  y5   2  y3  y0  ..... 
1 8 
3 1
  472  4   3  398  302  116  60  12   2 198  34  
8 
3
  476  2664  464
8
 1351.5 cube meters.

Using these three numerical integration techniques. We can evaluate integration


very easily.

Example :

Evaluate the following integral by using Simpson’s 3/8th rule.

6 1
i)  1  x  2
dx with n = 6 Ans. : 0.912
0


ii)   4  2sin x  dx
0
with n = 6 Ans. : 16.5679
14
  sin x  log e  dx with 12
x  ex
iii) Ans. : 3.2561
0.2

1.10 Review :

1) Newton’s cote’s formula


2) Trapezoidal rule & error
3) Simpson’s (1/3)rd rule & error
4) Simpson’s (3/8)th rule & error

1.11 Unit End Exercise :

1) Obtained trapezoidal rule using newton cote’s formula. Obtained error in


composite Trapezoidal rule.
2
2) Compute the trapezoidal approximation for  x dx with n = 6. Compare
0
the estimate with the exact value.
4 2
Ans. : T = 1.81948, exact =  1.8856 , error = 0.035076.
3
2
3) Use Simpson’s (1/3)rd rule to approximate  x dx with n = 6. Compare
0
the estimate with the exact value.
Ans. : T = 1.8569, E.V. = 1.8856, Error = 0.01521.
1
 x  x  1 dx with n = 10 using trapezoidal rule. Compute
2
4) Compare
0
the error exactly and the error expression.
20

5) Obtain Simpson’s (1/3)rd rule by from newton cote’s formula.

6) Obtain Simpson’s (3/8)th rule by from newton cote’s formula.

7) Obtain error in composite of Simpson’s (1/3)rd rule.

8) Obtain error in composite of Simpson’s (3/8)th rule.

3
 x  3 x  dx with n = 6 by Simpson’s (3/8)th rule.
3
9) Compute
0

dx
6
10) Evaluate  with n = 6 using Simpson’s (1/3)rd rule.
0
x 1
Ans. : 3.2961.


21

2
Numerical Integration – II

Chapter Structure
2.1 Objective
2.2 Introduction
2.3 Romberg’s Method
2.4 Gaussian Quadrature
2.4 Gaussian Quadrature
2.5 Gaussian Quadrature for 3 points formula
2.6 Numerical evaluation of double integrals
2.7 Simpson’s rule for double integrals
2.8 Review
2.9 Unit & Exercise

2.1 Objective :

After going through this chapter you will able to :


 Solve integral equation which hose analytical solution.
 Solve multiple integral by using numerical method.
 Solve integral by different numerical integral methods.

2.2 Introduction :

Integral equation are of special application in applied mathematics. There


are such integral who have no analytic solution. To solve that we can use
numerical method of integration. Multiple integral equation are difficult to solve
using numerical method. It is easy to solve using this methods we can comparing
with the numerical expect value to find the error.

2.3 Romberg’s Method :

Richardson extrapulation is used as the formation of a numerical


integration called Romberg integration.

Consider the integral


b
I   f  x  dx
a
22

Let I1, I2 be approximated values of I obtained by using trapezoidal rule


with different sub intervals of width h1 & h2 respectively.

Let E1 & E2 be the corresponding errors.


 The errors in trapezoidal rule is of order h2.

I  I1  E1  I1  kh12 ……… (I)


2
I  I 2  E2  I 2  kh 2 ……… (II)
from equations I & II
I1  kh12  I 2  kh22
I1  I 2  k  h22  h12 
I1  I 2
k 
 h22  h12 
Substituting value of k in equation (I) we get
I  I2
I  I1  12 h12
 h2  h1 
2

  h22  h12  I1   I1  I 2  h12 h2


2  h12 
h22 I1  h12 I 2
I 
 h22  h12 
Put h1  h & h2  h / 2 we get
h2
I1  h 2 I 2
I  4
h2
 h2
4
4 I  I1
I  2
3
This is known as Romberg’s formula. Working of Romberg’s integration
method difference

h I  h   I1
4 I 2  I1 4 I 23  I12 4 I 234  I123
h / 2 I  h / 2  I2 I12  I123  I1234 
3 3 3
4I 3  I 2 4 I 234  I 23
h / 4 I  h / 4  I3 I 23  I 234 
3 3
4I  I 3
h/8 I  h / 8  I 4 I 34  4
3

where h  b  a .
23

1 dx
Use Romberg’s formula to evaluate the integral  1 x correct upto 4
0

decimal place.

Soln :

1 dx
Given : integral is  1 x
0

Here a  0, b  1  h b  a 1 0 1
1
y  f x 
1 x
x 0 1
Taking h  1
y 1 0.5

 by trapezoidal rule.
h 1
I1   y0  y1   1  0.5  0.75
2 2
 I1  0.75

x 0 1/ 2 1
Taking h  1/ 2
y 1 2 / 3 0.5

By trapezoidal rule
h
I 2   y0  y2   2  y1  
2
1
 1  0.5   2  2 / 3  
4
I 2  0.7083
1
Taking h 
4

x 0 1
1 3 1
4 2 4
y 1 0.8 0.6667 0.5714 0.5

by trapezoidal rule
h
I 3   y0  yn   2  y1  y2  y3  
2
1
 1  0.5   2  0.8  0.6667  0.5714  
8
I3  0.6970
24

Taking
1
h
8

x 0 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1


y 1 0.8889 0.8 0.7273 0.6667 0.6154 0.5714 0.5333 0.5

h
I4   y0  y8   2  y1  y2  y3  y4  y5  y6  y7  
2 

1
 1  0.5   2  0.8889  0.8  0.7273  0.6667  0.6154  0.5714  0.5333  
16 

I 4  0.6914

 by Romberg’s integration method.

h I
4 I 23  I12  0.698
1 0.75 I12  4 I 2  I1 / 3  0.6944 I123 
3 4 I123  I 234
4I3  I 2 4 I 34  I 23 I1234   0.6931
1 0.7083 I 23   0.6932 I 234   0.6930 3
2 3 3
1 4 I  I3
0.6970 I 34  4  0.6931
4 3
1 0.6941
8

Ex. 2 :

2 dx
Use Romberg’s formula to evaluate the integral  2
correct upto
0 x 2
4 decimal places.
Soln :

2
Given integral dx

0 x2  2
Here a  0 b2 hba202
f x  1 / x  2 2

Taking h  2
x 0 2
y 0.5 0.1667
h
 y0  y1 
I1 
2
Taking h  1
x 0 1 2
y 0.5 0.333 0.1667
25

h
I2   y0  y1   2  y2  
2
1
 0.5  0.1667   2  0.3333 
2
I 2  0.6666
2
  0.5  0.1667   0.6667
2
I1  0.6667

1
Taking h 
2
x 0 0.5 1 1.5 2
y 0.5 0.4444 0.3333 0.2353 0.1667

h
I3   y0  y4   2  y1  y2  y3  
2
1
  0.5  0.1667   2  0.4444  0.3333  0.2353 
4
I 3  0.6732

1
Taking h 
4

x 0 0.25 0.5 0.75 1 1.25 1.5 1.75 2


y 0.5 0.4848 0.4444 0.3902 0.3333 0.2807 0.2353 0.1975 0.16667

h
I4   y0  y8   2  y1  y2  y3  y4  y5  y6  y7  
2 
1
 [ 0.5  0.1667   2 (0.4848  0.4444  0.3902 
8
0.3333  0.2807  0.2353  0.1975
I 4  0.6749

1
Taking h 
8

x 0 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1 1.125 1.25 1.375
y 0.5 0.4961 0.4848 0.4671 0.4444 0.4183 0.3902 0.3616 0.3333 0.3062 0.2807 0.2570

x 1.5 1.625 1.875 2


y 0.2353 0.1975 0.1813 0.1667
26

h
I5  [ y0  y16   2( y1  y2  y3  y4  y5  y6  y7 
2
y8  y9  y10  y11  y12  y13 y14  y15 )]
1
  0.5  0.1667   2  0.4961  0.4848  0.4671  0.4444  0.4183 
16 
0.3902  0.3616  0.3333  0.3062  0.2807  0.2570 
0.2353  0.2154  0.1975  0.1813)
I 5  0.6753
 hI  I1 
By Romberg’s integration method  I12  2 
 3 

h I
2 0.6667
1 0.6666 I12  0.6665
1 0.6732 I123  0.6754 I123  0.6783
2
1 0.6749 I34  0.6755 I 234  0.6755 I1234  0.6745
4
1 0.6753 I 45  0.6754 I345  0.6754 I 2345  0.6754
8

I12345  0.6757

Ex. 1 :
Evaluate the following integral by Romberg’s method :
1
 x2
i) e dx Ans. : 0.7468
0

2.4 Gaussian Quadrature :

In general Gaussian quadrature is of the form


b n

 w  x  f  x  dx   a f  x 
a
k 0
k k

where w(x) > 0 In [a, b] is called the weight function and ak, xk are called
weights and nodes respectively.

Gaussian quadrature function for two points also known as Gauss


Legendre integration method.
Consider the integral
1
I   f  x  dx
1
2
Let I  a f x 
k 1
k k
27

 a1 f  x1   a2 f  x2  ……….. (I)

Here x1 & x2 are nodes & a1 , a2 are weights.


To find 4 unknowns a1 , a2 , x1 , x2 . Here we required h
conditions. The condition that equation I is valid where f  x  is a polynomial of
degree  3 .
In this case equation I is true for f  x   x 3 , x 2 , x, 1 .
where f  x   x3
1
 x 3 dx  a1 x13  a2 x23  a1 x13  a2 x23  0 ….. (II)
1

where f  x   x 2
1
 x 2 dx  a1 x12  a2 x22  a1 x12  a2 x22  3 ….. (III)
1 2
where f  x   x
1
 x 2 dx  a1 x1  a2 x2  a1 x1  a2 x2  0 ….. (IV)
1

where f  x   1
1
 1 dx  a1  a2  a1  a2  2 ….. (V)
1

Multiply equation (IV) by x12 & subtract from (II) we get,


a2 x2  x22  x12   0
 a2 x2  x2  x1   x2  x1   0
 a2  0 or x2  0 or x2  x1 or x1   x2 .
The cases a2  0, x2  0 & x2  x1 . Give result to invalid equations.
 we choose x1   x2
 from equation IV
a1 x1  a1 x1  0 ….. (VI)
From equation V & VI we get
a1  1 & a2  1
From equation III we get
2 x12  2
3
x1   1
3
We take x1  1 & x2   1 / 3 ( x2   x1 )
3
Substitute the value of a1a2 & x1 x2 in equation (I)

 f  x  dx  f  1   f   1 
1

1  3  3
This is known as Gaussian quadrature two points functions.
Note :
1
Above answer gives solution of  f  x  dx
1
28

b
we need  f  x  dx
a

There are, let x  mt  c


If x  a  t   1
If x  b  t  1

Such that a   m  c
bmc

Solving this equation we get,


ba ba
m ,c
2 2
ba ba
x  t
2 2
ba
 dx  dt
2

Substituting value of x & dx we get


b 1 b  a b  a b  a
a f  x  dx  1 f  2 t  2   2  dt
Ex. 1 :

5
 2x  3 x  dx by two points
3
Evaluate
2
Gaussian quadrature formula

Soln :
5
 2x  3 x  dx
3
Given integral
2
Gaussian two points quadrature formula is given by
1    
1 f  x  dx  f  1 3   f   1 3 

Here f  x    2 x 2  3x  a  2, b5

Put
b  a  t  b  a 
x
2
3t  7
x
2
3dt
dx 
2
Where x  2  t   1
x  5  t  1
29

5   3t  7 2
1  3t  7    3 
2  2 x  3 x2
 dx  
1   2   2   2  dt
 2   3
 
2
1  9t  42t  49 9t  21  3
   dt
1
 2 2  2
3 1
  9t 2  33t  28 dt
4 1
1
  g  t  dt
1

3
Where 9  t  
4
 9t 2  33t  28 
 by Gaussian two points quadrature formula
3 
  g  1   g   1  
4  3  3 
2
3 
  9  1   33   1   28 
4  3  3 
2
 
  9  1   33   1   28 
  3  3 
3
  31  31
4
 46.5
5
   2 x 2  3 x  dx  46.5
2

2.5 Gaussian Quadrature for 3 points formula :

Consider the integral


1
I   f  x  dx
1
3
Let I   a f x 
k 1
k k

i.e. I  a1 f  x1   a2 f  x2   a3 f  x3  ……….. (I)

Where the nodes x1 x2 x3 & weights a1 a2 a3 are to be determine.


To determine we use some as we had done in Gaussian two point’s
quadrature formula & we get,
1 1   3  3 
1 f  x  dx   5 f    8 f  0   5 f 
 5  

9   5    
[Few are left for exercise]
30

Ex. 2 :

1 dx
Evaluate  1 x by Gaussian 3 points quadrature formula.
0

Soln :

1 dx
Given integral  1 x
0

1
f  x  , a  0, b 1
1 x

Put
b  a   b  a 
x
2
t 1
x
2
dx  dt
2
Where x  0 t  1
x 1 t 1
dt
1 dx 1 1 dt
0 1  x  1  t 2 1   
1 t3
1 
 2 
1
  g  t  dt
1

1
 g t  
t 3

By Gaussian 3 points quadrature formula


1 1   
0 f  x  dx  9 5 g 3 5  8 g  0   5g  3 5 
  
1  1  1   1 
 5 8 5 
9  3  0  3   3 
 5  3  5  3 
1  5 5 8 5 5 
    
9  33 5 3 3  3 5
1  75 8 
   
9  42 3 
1
 f  x  dx  0.4947 .
0
31

Ex. 2 :

Evaluate the following example by two point Gaussian quadrature


formula or three points.
1
2t
i)  te dt Ans. : 2 points = 3477.5439
0
3 points = 4967.1067

2.6 Numerical evaluation of double integrals :

If f  x, y  is a continuous function & defined on a closed rectangle.


R  x, y  / a  x  b, c  y  d  then
d b

 f  x, y  dx dy    f  x, y  dx dy
R c a

Hence we are going to double integral using trapezoidal rule &


Simpson’s 1/3 rd rule.

Trapezoidal rule of double integral :


yi  z xi  z

Consider I    f  x, y  dx dy
yj xi
where h  xi  1  xi & k  y j 1  y j .

y
R
yj + 2

yj + 1

yj

0 xi xi + 1 xi + 2

yj2
I  xi  2 f  x, y  dx  dy
yj   xi 
Apply trapezoidal rules inner integration.
yj2 h
I  f  xi , y   2 f  xi 1 , y   f  xi2 , y   dy
yj 2 
32

 again applying trapezoidal rule we get,


hk
I  [ f  xi , yi   2 f  xi , y j 1   f  xi , y j  2 
4
 2  f  xi 1 , y j   2 f  xi 1 , y j 1    f  xi 1 , y j  2 

 f  xi  2 , y j   2 f  xi  2 , y j 1   f  xi  2 , y j  2 ]
Continuously working we can solve triple integral also
but it is more complex to solve.

Ex. 1 :
7 7
1
Evaluate  x dx dy
2
3 3
 y2
using trapezoidal rule with h  2 & k  2 .

Soln :
7 7
1
Given integral  x 2
dx dy
3 3
 y2
Here h2 x : 3, 5, 7
k2 y : 3, 5, 7

x 3 5 7
y
x1 x2 x3
y1 3 18 34 58
y2 5 34 50 74
y3 7 58 74 98

 by trapezoidal rule form multiple integral


hk 
I   
f  2 fi , j 1  f i , j  2 
4   ij 
 
 
 2 fi  1, j   2 f i 1, j 1  f i 1, j  2 


 f i  2, j
 2 f i  2, j 1  f i  2, j  2 
22
  f  3,3   2 f  3,5   f  3, 7   2  f 8,3   2 f  3,5   f  5, 7   
4 
  f  7,3  2 f  7, 5   f  7, 7   
 1 18  2  34  58  2  34  2  50  74   58  2  74  98 
 864 .
33

2.7 Simpson’s rule for double integrals :

It is same as trapezoidal we had done we need to apply Simpson’s 1/3 rd


rule twice we get,

hk 
I f
9   xi , y j 
 4 f  xi , y j 1   f  xi , y j 2   
 4 f  xi 1, y j 

    
 4 f x , y   f x ,y   f x , y   4 f x , y   f x , y  
i1 j 1 i1 j 2 i 2 j i 2 j 1 i 2 j 2

 
Ex. :
1 2
Evaluate   xy dx dy by Simpson’s rule taking h  0.5, k  0.5 .
0 0

Soln :
1 2
Given integral I    xy dx dy
0 0

Here h  0.5 x  0, 0.5, 1


k 1 y  0, 0.5, 1, 1.5, 2

x x1 x2 x3
y
0 0.5 1
y1 0 0 0 0
y2 0.5 0 0.25 5
y3 1 0 0.5 1
y4 1.5 0 0.75 1.5
y5 2 0 1 2

By Simpson’s 1/3rd rule for double integration integral.


hk
I   f  x1 , y1   f  x1 , y5    4  f  x1 , y2   f  x1 , y4    2 f  x1 , y3  
9 
 4  f  x2 , y1   f  x2 , y5   4  f  x2 , y2   f  x2 , y4    2 f  x2 , y3  
 f  x3 , y1   f  x3 , y5   4  f  x3 , y2   f  x3 , y4   2 f  x3 , y3   

0.5  0.5
  0  0  4  0  0   0   4  0  1  4  0.25  0.75   2  0.5  
9
  0  2   4  0.5  1.5   2 11 
0.25
  0  24  12
9
34

 0.25  36
9
 1.

2.8 Review :

 Romberg’s method of integration.


 Gaussian quadrature formula for 2 & 3 points.
 Multiple integral by trapezoidal rule & Simpson’s 1/3 rd rule.

2.9 Unit & Exercise :



1) Evaluate  sin x dx h  2 by Romberg’s integration method
0
Ans. : 1.99857
5 dx
2) Evaluate  by Romberg’s integration method
1 x
Ans. : 1.6289
 /2

 x  x  1 cos xdx by Romberg’s integration method


2
3)
0

Ans. : 2.032
b
4) For an integral  f  x  dx , derive the two point
a
Gaussian quadrature formula.
b
5) For an integral  f  x  dx , derive the Romberg’s integration method
a
using trapezoidal rule.
b
6) For an integral  f  x  dx , derive the three point Gaussian
a
quadrature formula.
2 2
7) Evaluate   x  y dx dy by trapezoidal rule by taken h  k  1 .
0 0
2 3
1
8) Evaluate  dx dy by Simpson’s 1/3rd rule by taking h  k  1 .
 2
0 0 x  y
1
9) Evaluate  dx by two points Gaussian quadrature.
2x  3
0
3
cos 2 x
10) Evaluate  1  sin x dx dy Gaussian 2 & 3 points formula.
2
5
dx
11) Evaluate  1  sin x by Gaussian 2 & 3 points quadrature formula.
4
0.6 0.4
rd
12) Evaluate   sin x cos y dx dy by Trapezoidal & Simpson’s 1/3 rule, by
0 0

taking h  k  2 .
35

5 5
d .1
13) Evaluate  dx dy using Trapezoidal rule, by taking h  k  2 .
1 1 x  y2
2

Ans. : 4.1345
 /2  /2
14) Evaluate   sin  x  y  dx dy by Simpson’s 1/3rd rule, by taking
0 0

h  k   /4. Ans. : 2.0091


1.5 1
15) Evaluate  e
x y
dx dy by Trapezoidal & Simpson’s 1/3rd rule, by taking
0 0
h  k  0.5
Ans. : Trapezoidal = 6.2334
Simpson’s = 5.0171.


36

3
Approximation of function
Chapter Structure
3.1 Objective
3.2 Introduction
3.3 General least squares method
3.4 Fitting of a straight line
3.5 Fitting of a curve of second degree polynomial to fit the second
degree polynomial OR (parabola)
3.6 Fitting of a polynomial of degree M
3.7 Fitting of curve for exponential function
3.8 Review
3.9 Unit End Exercise

3.1 Objective :

After going through this chapter you will be able to :


 Fit a straight line by least square.
 Fit a second degree polynomial by least square method.
 Fitting a polynomial of degree M by least square method.
 Fit a curve for exponential function.

3.2 Introduction :

The function approximations needs for many branches of applied


mathematics and computer science. In mathematics, least squares can be applied
to approximating a given functions. The best approximation can be defined as
that which minimizes the difference between the original function and the
approximation we also going to used weighted approximation.

The process of finding the equations of curve of best fit which may be
most useful for predicting the unknown n values is known as curve fitting. Here
we get two value are by observation and other by the predicating value. The
difference between this values is called residual an error.

Thus, the principle of least square’s status that “The sum of the residuals
squares of is minimum”.
37

3.3 General least squares method :

Let  xi , yi  where i  1, 2, ....., n be given n-points.


To fit the curve
y  p  x, a0 , a1 , a2 , ....., an  ……. (I)

To the given n-points where a0 , a1 , a2 , ....., an are unknowns parameters


whose values are to be determined. Taking x  xi the value of y obtained from
equation (I) we can write as
yi  P  xi , a0 , a1 , ....., ak 

The quantity yi is called the predicated or expected values of y at point


x  x0 and yi is called the observed values of y .

The difference  yi  yi  is called the residual or error corresponding to


point x  xi .

Let E  E  a0 , a1 , ....., ak  be the sum of square of the residual then


n
2
E    yi  Yi 
i 1
n
2
   yi  P  xi ; a0 , a1 , ......, ak  
i 1

by the principle of least square the value of E will be minimum i.e.

E E E
 0,  0, ....., 0
a0 a1 ak

These equation are called normal equations.


To solve these normal equations with help of given points and we obtain
the values of ai where i  1, 2, ....., k .
Suppose the values of ai are a0  a0* , a1  a1* , ....., ak  ak *
substitute all these values in equation I.

yi  P  xi , a0* , a1* , ....., ak * 

Which is required best fitting curve.


38

3.4 Fitting of a straight line :

Given the general form of a straight line


y  ax  b
Where a, b are unknown parameters whose values are to be determine.
Let P1  x1 , y1  , P2  x2 , y2  , ....., Pk  xk , yk  , ......, Pn  xn , yn 
are the given n-points.

, y n)
( xn
yn Pn

y0

yk(axk +b)
P3
P1 P5
P2
xk xh

Taking x  xk the observed value of y is yk and corresponding value on


then fitting of a straight line is yk  axk  b .
If Ek is the residual of approximation at x  xk then
Ek  yk  Yk
Let E  E  a , b  be the sum of squares of the residuals then
n
2
E    yi  Yi 
i 1
n
2
   yi   axi  b   ………. (II)
i 1

by principle of least square the values E will be minimum if


E E
 0,  0, .....,
a b
 n 2
...............   yi   axi  b    0
a i  1
39

 2  y   ax
i 1
i i  b     xi   0
n

  x y i i  ax12  bxi   0
i 1

n n
2
 x y   ax
i 1
i i
i 1
1  bxi

n n n
  xi yi  a
i 1
 xi2  b  xi
i 1 i 1
………. (III)

Similarly
n
 2

b
  y   ax
i 1
i i  b    0
n

 2  y   ax
i 1
i i  b    1  0
n

  y   b  ax   0
i 1
i i

n n

 y   ax
i 1
i
i 1
i b
n n

y
i 1
i a x
i 1
i  nb ………. (IV)

From the equation (III) & (IV) are called normal equation of a straight
line.

Solving these normal equations with the help of given points and we
obtained the values of a  a* & b  b*

 y  a* x  b*

Which is required best fit of a straight line.

Ex :

Use least squares method to fit a straight line for the following data :

x 3 2 1.5 2 0.5
y 2 1 0.5 1 2

Also estimate the total error.


40

Soln :

Equation of straight line


y  ax  b ……. (I)

Normal equation of a straight line are


y  ax  bn ..…. (II)

xy  ax 2  bx ..…. (III)

x y x2 xy
3 2 9 6
2 1 4 2
1.5 0.5 2.25 0.75
2 1 4 2
0.5 2 0.25 1
2
x  5 y  3.5 x  19.5 xy  2.25 N=5

We get two equation


3.5  5a  5b …… (IV)

2.25  19.5a  5b .…. (V)

Solving equation (IV) and (V) we get


a  0.0862 b  0.7862

Put value of ‘a’ and ‘b’ in equation (I)


y   0.0862 x  0.7862

This is equation straight line

x y Yi Ei   yi  Yi  Ei2
 obseved   expected 
   
 value   value 
3 2 0.5276 1.4724 2.1679
2 1 0.6136 1.6138 2.6043
1.5 0.5 0.6569 1.1569 1.3384
2 1 0.9586 0.0414 0.00071
0.5 2 0.7431 1.2569 1.5798
7.6921
41

 The total error


5
2
E  y
i 1
i  Yi   7.6921

Case i) :

Fitting a straight line for odd numbers i.e. (n = odd number)

The procedure of fitting a straight line by the method of least square for
odd numbers may be simplified as follows :

xM
x
h

Where M is the middle term h is difference between any two successive


value.
Here x  0 normal equation can be written as
y
y  nb  b 
n
 xy
xy  x 2  a 
 x2

Case ii) :

Fitting a straight line for even numbers of term if n is even them

x  M 
x2
 h 

Where M is the arithmetic mean of two middle values.


h is difference between any two successive value.

Here x  0 normal equation given by


y  nb  b  y
n
xy  ax 2  a   xy
x2

Ex :
Fit a straight line y  ax  b to the following data :.

x 2010 2011 2012 2013 2014 2015 2016


y 12 16 21 24 28 32 38
42

Soln :

The value of x is to high


 we use change of origin.

Here n = 7 which odd number


middle value M = 2013, h = 1.

xM
x y x x2  y
h
2010 12 3 9 36
2011 16 2 4 32
2012 21 1 1 21
2013 24 0 0 0
2014 28 1 1 28
2015 32 2 4 64
2016 38 3 9 114
y  171 x  0 y 2  28 xy  117

Normal equation are

 xy 117
a   4.1786
 x2 28

y 171
b   24.4286
h 7

 The remained best

 The fit of straight line is

y  ax  b

y  4.1786 x  24.4286

 x  2013 
y  4.1786    24.4286
 1 

y  4.1786 x  8411.5218  24.4286

y  4.1786 x  8387.0932
43

Ex. :

Fit a straight line by method of least squares also find an


estimated value for the year 2020.

Year 2011 2012 2013 2014 2015 2016


Production
30 35 42 48 53 60
termunits

Soln :

Magnitude of years are high


 we use charge of origin
Here n  6 which even
M = Arithmetic mean of middle year

2013  2014
  2013.5
2
h  1year
 x  2  x  2013.5  /1

Year Production x  2  x  2013.5  x2 xy


x y
2011 30 5 25 150
2012 35 3 9 105
2013 42 1 1 42
2014 48 1 1 48
2015 53 3 9 159
2016 60 5 25 300
2
y  268 x  0 x  90 xy  210

 Normal equation for even numbers of terms


  y 210
a  3
x 2 70
y 268
b   44.67
h 6

 The best fit of a straight line is


y  ax  b
y  3x  44.67
y  3  2  x  2013.5    44.67
y  6 x  12081  44.67
44

y  6 x  12036.33
Where x  2020 then
y  6  2020   12036.33
y  83.67 tones.

3.5 Fitting of a curve of second degree polynomial to fit the


second degree polynomial OR (parabola) :

P  x   ax 2  bx  c …. (I)

Where a, b, c are unknown parameters where values are to be determine.

Taking x  xk the observed value of y is yk and corresponding value on


the fitting of a second degree polynomial is

yk  ax 2 k  bxk  c

If Ek is the error of approximation at the points x  xk then,


Ek  yk  Yk

This error may be negative or +ve zero.

Let E  E  a, b, c  be the sum of squares of residuals then


n
2
E  y
i 1
i  Yi 
n 2
   yi   axi2  bxi  c  
i 1

By the principle of least squares. The value of E will be minimum.

E E E
i.e.  0, 0 & 0
a b c
Now,
E
0
a
n

 2  y   ax
i 1
i
2
i  bxi  c     xi2   0
n
2
x , y i i  axi4  bxi3  cxi2 ………. (II)
i 1
45

E
0
b
n
2   yi   axi2  bxi  c     xi   0
i 1
n n n n

x i yi  a  xi3  b xi2  c xi ……. (III)


i 1 i 1 i 1 i 1

E
0
c
n
2   yi   axi2  bxi  c    1  0
i 1
n n
yi  a  xi2  b xi  n c ……. (IV)
i 1 i 1

The equation (II) (III) (IV) are called normal equation as solve the normal
equations with the helps of given data and we obtain a  a* , b  b* & c  c*

Put these values in equation ………. (I)

y  P  x   a * x 2  b * x  c*

Which is required best fit for second degree polynomial.

Ex. :

Fit a second degree parabola using the method of least square.

x 3 1 0 2 4
y 8 3 3 8 11

Soln :

Let equation of 2nd degree polynomial.


y  ax 2  bx  c ………. (I)

and normal equation are


y  ax 2  bx  n c ………. (II)

xy  ax 3  bx 2  cx ………. (III)

x 2 y  ax 4  bx 3  cx 2 ………. (IV)


46

x y x2 x3 x4 xy x2 y
3 8 9 27 31 24 72
1 3 1 1 01 03 03
0 3 0 0 00 00 00
2 8 4 8 16 16 24
4 11 16 64 256 44 176
2 3 4 2
x  2 y  1 x  30 x  44 x  354 xy  87 x y  125

 Normal equation are


30a  2b  5c  11 ………. (V)

44a  30b  2c  87 ………. (VI)

354a  44b  30c  125 ………. (VII)

Solving equation (V), (VI), (VII) we get


a   0.2269, b  3.0774, c  2.3303

Put value of a, b, c in equation (I)


y   0.2269 x 2  3.0774 x  2.3303

Which is the required best fit of second degree polynomial.

3.6 Fitting of a polynomial of degree M :

To fit the mth degree polynomial.


y  P  x   am x m  am 1 x m 1  am  2 x m  2  .....  a1 x  a0

Where am , am 1 , am  2 , ....., a1 , a0 unknown parameters are whose values to


be determine. Taking x  xk the observed value of y is yk and corresponding
values as the fitting of a mth degree polynomial is

yk  am xkm  am 1 xkm 1  am2 xkm  2  .....  a1 xk  a0

If Ek is the residual of approximation at the point x  xk then,


Ek  yk  Yk
This error may be negative an +ve an zero.
47

 
Let E  E1 am , am 1 , am  2 , ....., a0 be the sum of squares residual then,
n
2
E  y
i 1
i  Yi 
n 2
   yi   am xim  am 1xim1  .....  a1 x  a0  
i 1

By principle of least squares the value of E will be minimum,

E E E
If  0,  0, ....., 0
am am 1 a0

n
E
Now  2   yi   am xim  am1xim1  .....  a1x  a0   1  0 
a0 i 1

n n

y i  na0  a1 x i  a2xi2  .....  amxim


i 1 i 1

Similarly

E
0
a1
n

x i yi  a0 xi  a1xi2  .....  amxim1


i 1

.
.
.
E
 0 we get
am
n

x i
m
yi  a0 xim  a1xim 1  .....  amxi2 m
i 1

The above equation is called normal equation.

Solve the normal equation with the help of given data and we obtain
am  am* , am1  am1* , am2  am2* , ......, a1  a * , a0  a0* .

Put all these values in equation …...... (I)

y  P  x   am* x m  am* 1 x m1  .....  a1* x  a0*

Which is required best fit for mth degree polynomial.


48

3.7 Fitting of curve for exponential function :

Let the exponential curve


y  a0ebx
taking log on both side we get
log y  log a  bx
We can write this as
y  A  Bx ……. (I)

Where y  log y, A  log a0 and B  a .

Thus equation is straight line.

 we can use fitting of curve of straight line by least square method.


Similarly we can curve for any exponential curve like
y  ab x , y  axb .

Ex. :

Fit a curve of the type y  aebx to the following data :

x 2 6 10 14
y 2.5 3.2 4.7 5.9

Soln :

Given curve
y  ab x
taking log both sides we get
log y  log a  x log b

Put log y  Y , A = log a , x  log x, Y  A  bx ……. (II)

This is straight line least square method.

 Normal equation are

y  nA  bx

xy  Ax  bx 2


49

x y x  log x y  log y x2 xy
2 2.5 0.6931 0.9163 0.4804 0.6351
6 3.2 1.7918 1.1632 3.2105 2.0892
10 4.7 2.3026 1.5476 5.3020 3.5635
14 5.9 2.6391 1.7750 6.9648 4.6544
x  7.4266 y  5.4021 15.9577 10.9672

 Normal equation

5.4021  4 A  7.4266b
10.9672  7.4266 A  15.9577b

A  0.5482 b  0.4322

Equation become

Y  0.5482  0.4322 X
But A  log e a

 0.5482  log ea
a  e0.5482
a  1.7301

Equation (I) becomes


 y  1.7301; x  0.4322
Which is the required least fit of curve.

3.8 Review :

 We have learn to fit a straight line by least squares method.


 We have fit quadratic curve fit by least squares method (second degree).
 We have fitting of a polynomial of degree M.
 We have fitting of a curve for exponential function.
50

3.9 Unit End Exercise :

1) Fit a straight time y  a  bx for the following data by using least square
method.

x 4 3 8 7 9
i)
y 11 10 14 12 18

Year  x  2009 2010 2011 2012 2013 2014 2015


ii)
Production 2.5 3 4.2 4.8 5.3 6.4 7.3

x 0.2 0.4 0.8 1 1.2 1.4


iii)
y 3 4 6 9 13 10

x 2 1 1.5 1
6 3
iv)
y 1  5 2 2
6 3

2) Fitting of a second degree curve using the method of least square :

x 5 3 0 8 5
i)
y 11 8 2 0 4

x 1941 1951 1961 1971 1981 1991 2001


ii)
y 1.1 1.3 1.6 2 2.7 3.4 4.1

3) Fit the curve X  a  bx 2 to the following data :

x  10 20 30 40 50
y  8 10 15 21 30

4) Fit a curve of the type Y  axb to the following data :

x 10 20 30 40 50
y 3.5 6.2 9.5 15.3 20.4

5) The pressure & volume of the gas are relation by the equation pv   k
where  & k are constant fit this relation for the following data using
principle of least square :
51

x 0.5 10 1.5 2.0 2.5 3.0


y 1.62 1 0.75 0.62 0.52 0.46

6) Using ‘Principle of least squares’ fit a straight line y  a  bx for n-points.

Using principle of least squares fit a second degree polynomial


y  ax 2  bx  c for n-points.

7) Using principle of least squares fit a polynomial of degree M for n-points.

8) Using principle of least squares fit a straight line for relation y  ab x .

9) Using principle of least squares for a straight line for relation y  aeb x .


52

4
Least squares approximation
Chapter Structure
4.1 Objective
4.2 Introduction
4.3 Orthogonal Function
4.4 Gram – Schmidt or thogonalizing process
4.5 Chebyshev polynomials
4.5 Chebyshev polynomials
4.6 Discrete Fourier Transforms (DFT)
4.7 Fast Fourier Transforms (FFT)
4.8 Review
4.9 Unit End Exercise

4.1 Objective :

After going through this chapter you will be able to :


 Fit polynomial for continuous function by least squares method.
 Orthogonalization approximation by Gram – Schmidt process.
 Fit a curve for chebyshev polynomial by least square method.
 Compute different point of sequence by DFT & FFT.

4.2 Introduction :

A more general least squares problems is the weighted least squares


approximation problem. We consider a weight function w (x) to be continuous an
(a, b) with positive mass.

b
i.e.  w x  0
a

Given set of points  x1 , y1   x2 , y2  .....  xn , yn  to given importance to the


points we assigning weights. If all the data points have amount of weights then
the weights as w  x   1 .

Here w  x  and y are known functions.


53

 The above  k  1 equations is a system of line equation with  k  1


unknowns.

 This system has a unique solution.


Let the solution is

a0  a0* , a1  a1* , ....., ak  ak*

Put all values in equation (I) we get

P  x   a0*  a1* x1  a2* x 2  .....  ak* x k  .....ak* x k

Which is required best approximation.

Ex. :

Construct a least squares linear approximation to the function y  x 3


on the interval [0, 1] with respect to the weight function w  x   1 .

Soln :

Let the linear approximation be


p  x   a0  a1 x ………. (I)

Where a0 , a1 are unknown parameter which are to be determine.


Let E  E  a0 , a1  be the sum of squares of residuals, then,

b 2
E  w  x   y  p  x   dx
a
1 2
2
  1  x   a  a x   dx
0 1
0

By principle of least squares the values of E will be minimum.

E E
 0 and 0
a0 a1

E
 For 0
a0

1
3
 2  x   a
0 0  a1 x    1 dx  0

1 1
   a0  a1 x  dx   x 3 dx
0 0
54

1 1
 x2   x4 
 a  a 
2  0  4  0
0 1

a 1
a0  1 
2 4

4a0  2a1  1 ………. (II)

E
For 0
a1
1
 2  x   a  a1 x     x  dx
3
0 0

1 1
  a x  a x  dx  
2
0 1 x 4 dx
0 0

1 1
x2 x3   x5 
a0  a1    
2 3 0  5 0

a0 a1 1
 
2 3 5

15a0  10a1  1 …. (III)

Solving equation (II) & (III) we get


a0  0.8 a1   1.1

Put a0  0.8 & a1   1.1 in I we get


p  x   0.8  1.1x

Which is the remind least square linear or approximation.

4.3 Orthogonal Function :

The set of function  f0  x  , f1  x  , ....., f n  x  in [a, b] is called


a set of orthogonal functions, with respect to a weight function w  x  , if
b
 w  x  f  x  , f  x  dx 
a
j i 0 if i j
ci if i  j
Where c j is a real positive number further more,
if c j  1, j  0, 1, ....., n than the orthogonal set is called an orthonormal set.
55

Least squares approximation of a function using orthogonal polynomial :

Let y  f  x  be continuous function an [a, b] and it is approximated by


th
k degree polynomial given by,

p  x   a0 p0  x   a1 p1  x   .....  ak pk  x  ………. (I)

Which orthogonal polynomial and a0 , a1 , ....., ak are unknown


parameters which are to be determine.

Let E  E  a0 , a1 , ....., ak  by the sum of squares of residual then,

b 2
E  w  x   y  P  x  dx
a
b 2
E   w  x   y  a P  x   a P  x   .....  a P  x  
0 0 1 1 k k dx
a

 By principle of least squares the value of E will be minimum if,

E1 E E
 0,  0, ....., 0
a0 a1 ak
Now,

E b
 2 w x  P  x   y  a P  x   a P  x  , ....., a P  x  dx  0
0 0 0 1 1 k k
a0 a

b b
 P0  x  y dx  w  x    a0 P0  x   .....  ak Pk  x   P0  x  dx
a a

nk
Since  Pn  x   k  0 is an orthogonal set we have
b
2
 w  x  P  x  dx  c
a 0 0

b
&  P  x  P  x  dx  0
a 0 i i0
Applying the above orthogonal property we get
b
 w  x  P  x  y dx  c a
a 0 a 0

1 b
 a0 
c0  w  x  P  x  Y . dx
a
0

Similarly

E b
  2w  x   P  x   y  a P  x   a P  x  ..... a P  x  dx  0
1 0 0 1 1 k k
a1 a
56

1 b
a1  w  x  P1  x   Y dx
c1 a
In general we have
1 b
an  w  x  Pn  x  y  dx n  0, 1, ....., k
cn a
b
 w  x  P  x  dx
2
Where cn  n
a

Let the values of an be a0  a0* , a1  a1* , ....., ak  ak* substitute all these
value in equation I, we get p  x   a0* , p0  x   a1* p1  x   .....  ak* pk  x 

Which is the required least squares approximation.

4.4 Gram – Schmidt or thogonalizing process :

The classical Gram – Schmidt process can be used for this p starting with
the set of monomials purpose c, x, ....., x n  we can generate the orthonormal set
of polynomials  Pk  x  with respect to weight function w  x  can be generated
from the relation.
k 1
Pk  x   x k   akr Pr*  x  k  1, 2, .....
r 0

where
b w  x  x k g r*  x  dx
akr   & g 0*  x   1
a w  x  x k g r2  x  dx

Ex. :

Using Gram – Schmidt orthogonal rizing process first three orthogonal


polynomial P0  x  , P1  x  and P2  x  on [0, 1] with respect to weight function
w  x   1 using this polynomial obtain the least squares approximation second
degree for the function y  x on [0, 1].

Soln :

Use Gram – Schmidt orthogonalizing process to determine


P0  x  , P1  x  , P2  x  .
k 1
f k*  x   x k  a kr f r*  x  k  1, 2, .....
r 0
b b
k
where akr   w x x f r*  x  dx *2
 w  x  f  x  dx &
r
a a

f 0*  x   1
here f 0*  x   1  P0  x 
57

now f1*  x   x   a10 f 0*  x  


1
1 1  x2  2 1
where a10   1 x 1 dx  11 dx     x 0
0 0
 2 0
a10  1
2
1  1
 f1*  x   x   1   x   P1  x 
2  2
Now,
f 2*  x   x   a20 f 0*  x   a21 f1*  x  

Where a20 
1 x 2 1 dx
1

 x 3  1
3

0 1 12 dx  x ! 3

1  3 1  1 1
  x  x 2  dx

1 1 x 2
 x  1 / 2  dx 0 2 
a21   2
 1  4 6 1
0 1 1 1
1
0  x  x  1 / 4  dx 3  2  4
2
1  x   dx
 2

a21  1

f 2*  x   x 2  1/ 3 1  1  x 1/ 2  

 x 2  1/ 3  x  1/ 2 

f 2*  x   x 2  x  1/ 6  P2  x 

Let P  x   a0 P0  x   a1 P1  x   a2 P2  x  ………. (I)

Where a0 , a1 , a2 are unknown parameter whose values are to be


determine.

Using the condition of orthogonality

ai 
 w  x   y  P  x  dx
0
i
b
2
 w  x   P  x  dx
a
i

1
1  x 32 
 1 x 1  dx 
 3 2  0 2
a0  0 b  1

 1 1
2
dx
a
 x 0 3
58

1
 x5/2 x3/2  2 1
1   
0 1 x  x  1/ 2  dx  5 / 2 2 3 / 2 0  5  3 
   4
2
1  x  1/ 2  dx  x3 x 2
1
1/ 3  1/ 2  1/ 4 5
x
 3  2  4
 0

 a1  4
5

1
 1 x  x  x  1/ 6  dx
2
0
a2  b 2
 1  x  x  1/ 6  dx
2
a

1
 x 
5/2
 x3/2  x / 6 dx
0

1  4 2 2 1 1 
  x  2 x3  x 2  x  x  dx
0 3 3 36 

1
 x7/2 x5/2 1 x 3/2 
   
 7 / 2 5 / 2 6 3 / 2 0
 1
 x5 2 x 4 x3 1 x 3 1 x 2 1 
      x
 5 4 3 3 3 3 2 36  0

2 2 1
 7  5  9 

1 1 1 1 1 1
 5  2  3  9  6  36 

1/ 315 4
 
2.9 23 7

45 36

 a2  4
7

Put all values in equation (I) we get


2 4 4
p  x   1   x  1/ 2    x 2  x  1/ 6 
3 5 7
p  x   0.1714  1.3714 x  0.5714 x 2
59

4.5 Chebyshev polynomials :

The set of polynomials defined by Tn  x   cos  n  cos 1  x   n  0 on


[-1, 1] are called the chebyshev polynomial of degrees.

It can be written as

Tn  x   cos  n  cos 1  x  
 cos n θ n = 0, 1, .....
Where θ = cos 1 x on x = cosθ
we derive a recursive relation by noting that

taking n  0 T0  x   1
taking n  1 T1  x   x

Tn 1  x   cos  n  1 θ
 cos n θ cosθ  sin n θ sin θ
Tn 1  x   cos  n 1 θ = cos n θ cos θ  sin n θ sin θ
 Tn 1  x   Tn 1  x   2 cos n θ cos θ
 But we know that cos θ = x, so,
Tn 1  x   2cos θ cos θ  Tn 1  x 
Tn 1  x   2 x  Tn  x   Tn 1  x  n 1
This above is a three term recurrence relation to generate the chebyshev
polynomials.

11.5.1 The orthogonal polynomial of the chebyshev polynomial :

1) Tn  x  is a chebyshev polynomial of degree n, if n is even than Tn  x  is


even. If n is odd then Tn  x  is odd.

2) Tn  x   1 for x   1, 1 .

3) The chebyshev polynomial Tn  x  are orthogonal with respect to the weight


1
function w  x   & in the interval  1, 1 .
1  x2
 0 if mn
1
Tm  x  Tn  x  
 dx   if mn0
1  x2 2
1 
  if nm0
60

The first seven chebyshev polynomial are :

T0  x   1
T1  x   x
T2  x   2 x 2  1
T3  x   4 x3  3 x
T4  x   8 x 4  8 x 2  1
T5  x   16 x5  20 x3  5 x
T6  x   32 x 6  48 x 4  18 x 2  1

It is also possible to express powers of x in terms of chebyshev


polynomials we find
1  T0  x 
x  T1  x 
1
x2  T2  x   T0  x  
2
1
x 3  T3  x   3T1  x  
4
1
x 4  T4  x   4T2  x   3T0  x  
8
1
x5  T5  x   5T3  x   10T1  x  
16 
1
x6  T6  x   6T4  x   15T1  x   10T0  x  
32 
and so on …..

Ex. :

Use chebyshev polynomial to obtain the least squares approximation of


second degree for the function f  x   x3 on the interval  1, 1 with respect to
1
the weight function w  x   .
1  x2

Soln :

The least square approximation of second degree be


p  x   a0T0  x   a1T1  x   a2T2  x  ……. (I)

Where T0 , T1 , T2 and chebyshev polynomial & a0 , a1 , a2 are unknown


parameter whose values are to be determine.
61

Using the condition of orthogonalizing we obtain


b

ai 
 w  x  yT  x  dx
a
i
i  0, 1, 2, .....
b
2
 w  x  T  x  dx
a
i

1 1
 x 3  1 dx
1 2
1 x
a0  2
1 1 dx
 1
1 x2

1 1
 T3  x   3T1  x   T1  x  dx 1  x2

1 4
1 T  x T  x
0 0
1 1  x 2 dx

1
0  0  0
 4

[ By property of chebyshev polynomial]
0
a0  0 .

1
x3T1  x  1


1 1  x2
dx
 14 T  x   3T  x  T  x  dx
1
3 1 1

a1  
1
T  x  
2 1
T  x T  x 
1
dx  dx

1 1 x 2 1 1 x 2
1  3  
 4 0  2   3
a1    
 4
2
1

 x T  x  w  x  dx
3
2 1  x2
1
a2  1
T2  x  
 dx
2
1 1  x
1

 1 4 T  x   3T  x  T  x  dx
1
3 1 2

1  x2
 1

 T  x T  x 
2 2 1  x 2 dx
1
62

1
0  0
 4
 2
0
 Put a0 , a1 and a2 in equation (I)
3
P  x   0T0  x   T1  x   0T2  x 
4
3
P  x   T1  x 
4
Which is the required least square approximation.

4.6 Discrete Fourier Transforms (DFT) :

A finite sequence of n real a number is given by


x   x  0  , x 1 , ....., x  n 1
The n-points discrete Fourier transform of sequence x is defined by
1 n 1
FU x  k   X  k    x  j  e 2 jk / n
n j0
Where k  0, 1, 2, ....., n  1
 The discrete Fourier transformation of n-points sequence ‘r’ of complex
numbers.
X  k    x  0  , x 1 , ....., x  n  1

The n-points inverse discrete Fourier transform of sequence X is defined


by
n 1
1 2 ijk /n
FN1 X  k   x  k    x j e
n j0

Ex. :

Compute the 4 points DFT of sequence x   3, 4, 5, 6  .

Soln :

Given real sequence


 x  0   3, x 1  4, x  2   5, x  3   6
 The 4 points DFT of sequences is given by
1 3
F4 x  k   x  k    x  j  e 2 ijk /4
4 j0
where k = 0, 1, 2, 3

1
F4 x  0    x  0  e0  x 1 ei k /2  x  2  ei k  x  3  e3i k /2 
2 
63

1
F4  x  0   3  4ei k /2  5ei k  6e3i k /2 
2
1 1
F4 x  0   3  4e0  5e0  6e0   18  9
2 2
F4 x  0   9
1
F4 x 1  3  4ei /2  5ei  6e3i / 2 
2

1     
F4 x 1  3  4  cos 2  i sin 2   5  cos   i sin    6  cos 3 / 2  i sin 3 / 2  
2    
1
F4 ( x) 1  3  4i  5  1  6  i  
2 
1
F4  x 1   2  2i   1  i
2
F4 x 1   i  j
1
F4 x  2   3  4ei  5e z i  6e3 i 
2

1
F4 x  2   3  4  cos   i sin    5  cos 2  i sin 2   6  cos 3  i sin 3  
2 
1
F4 x  2   3  4 1  5 1  6  1 
2
F4 x  2    1
1
F4 x  3   3  4e3i /2  e53i  639 i /2 
2
1
F4 x  3   3  4  i   5  1  6   i  
2
1
F4 x  3    2  2i 
2
F4 x  3   i  1
The 4 points DFT of sequence ‘x’ is

Ex. :2

Compute the 4 points inverse DFT of sequences


  1 
x   1 , i  , 1 , i  1 
 2  2 2 2 
64

Soln :

Given complex sequence is


  1 
x   1 , i  , 1 ,  i  1 
 2  2 2 2 

 x  0   1 , x 1  i  1 , x  2   1 , x  3    i  1
2 2 2 2

 The 4 points inverse DFT of sequence ‘x’ is defined by


1 3
F41 x  k   x  k    x  j  e2 ji k /4
4 i 0

1
F41 x  k    x  0  e0  x 1 e ik /2  x  2  e i k  x  3  e 3 k /2 
2 

1 1  1  i k /2 1  ik  1 
F41 x  k   2  i  2 e  e   i   e 3 k /2 
2    2  2  

where k = 0, 1, 2, 3

1 1 1 
F41 x  0      i 1/ 2  O 0  e0   i  1/ 2  e0 
2 2 2 

1 1 1 1 1
F41 x  0     i    i 
2 2 2 2 2

F41 x  0   0

F41 x  0   0

1 1 1 
F41 x 1     i  1/ 2  ei /2  ei   i  1/ 2  e3 /2 
2 2 2 

1 1  1 1  1 
F41 x 1   2   i  2   i   2  1    i  2   i  
2      

F41 x 1  1

F41 x 1  1
65

1 1 1 
F41 x  2      i 1/ 2  e i  e2 i   i  1/ 2  e3 i 
2 2 2 

1 1  1 1  1 
F41 x  2    2   i  2   1  2 1    i  2   1 
2      

1 1 1 1 1
F41 x  2    i    i  
2 2 2 2 2

F41 x  2   1

F41 x  2   1

1 1 1 
F41 x  3     i 1/ 2  e3i /2  e3i   i  1/ 2  e3i /2 
2 2 2 

1 1  1 1  1 
F41 x  3   2   1  2  i  2  1    i  2   i  
2      

1 1 1 1 1
F41 x  3   1  1 
2 2 2 2 2

F41 x  3   1

F41 x  3   1

 The 4 points inverse DFT of sequence ‘x’ is x  k    0, 1, 1,  1 .

4.7 Fast Fourier Transforms (FFT) :

The Fast Fourier Transforms (FFT) is the efficient implementation of the


Discrete Fourier Transforms (DFT).
The FFT was discovered by curvely & Tukar in 1965. The FFT is based
on the following observation.

k
 Let data  xk , yk  , xk
, k  0, 1, ....., 2n 1 be given and that p & q are
n
exponential polynomial of degree at must  n  1 which interpole part of the
data according to p  x2 j   f  x2 j  , q  x2 j   f  x2 j  1 , j  0, 1, ....., n  1 then
the exponential polynomial of degree at most 2n 1 which interpolates all the
given data is
66

P  xk   f  x k  K  0,1......2 n  1
By assumption we have
1 1  
p  x   1  einx  p  x   1  eink  q  x  
2 2  n
n
Proof : Since einx   eix  has degree n & p and q have degree atmost n  1 . It is
clear that phase degree at most 2n  1 .
We need to verify the interpolation
1 1  
p  xk  
2

1  einxk p  xk  
2

1  einxk q  xk  
 n
 
k k
Where einxk  eink / n   e    1
 P  xk   P  xk  if k is even
 q  xk   / n  if k is odd

Let k be even i.e. k = 2j then by assumption on P.


P  x2 j   P  x2 j   f  x2 j 

  2 j 1    2 j
x2 j 1      x2 j
n n n n

 To compute for curve vectors.


x   x0 , x1 , x2 , ....., xn 1  of discrete data by DFT â of a is
compute component wise as

n 1
1  ik 2 j / N
aˆk 
N
a e
j0
j k  0, 1, ....., N 1

of course. The FFT can be used to compute these co-efficient. There is an


analogs formula for the inverse DFT

n 1
a j   aˆk  eik 2 j / N J = 0, 1, ....., N-1
k 0

4.8 Review :

 Least square’s method for continuous functions.


 Approximation using orthogonal function using Gram – Schmidt
orthogonalizing process.
 Chebyshev polynomials & it’s properties.
 Discrete Fourier Transform & Fast Fourier Transform.
 Computing sequences of points by DFT & FFT.
67

4.9 Unit End Exercise :

1) Construct a least squares linear approximation to the function y  x 2 on the


interval [0, 1] with respect to the weight function w  x   1 .

2) Construct a least squares quadratic approximation to the function y  e x on


the interval [0, 1] with respect to the weight function w  x   1 .

3) Obtain the least squares polynomial approximation of degree 2 for the


function y  x on it interval [0, 2] with respect to the weight function
w x  1 .

4) Using the Gram – Schmidt orthogonalizing process compute the first three
orthogonal polynomial p0  x  , p1  x  & p0  x  , p1  x  which an orthogonal
1
an the interval  1, 1 with respect to the weight function w  x   .
1  x2

5) Use chebyshev polynomial to obtain the least square approximation of


second degree for the function. F  x   x 4 on the interval  1, 1 with
1
respect to the weight function w  x   .
1  x2

6) Use chebyshev polynomial to obtain the least squares approximation for the
1
function f  x   3 x 4  2 x3  x  2 function w  x   .
1  x2

7) Compute the 4 points DFT of sequences x  1, 2, 3, 4  .

8) Use chebyhev polynomial to obtain the least squares approximation for the
function f  x   5 x 3  6 x 2  5 x  3 on the interval  1, 1 with respect to
1
the weight function w  x   .
1  x2

9) Compute the 4 points DFT of sequence x   0, 1, 1,  1 .


68
10) Compute the 4 points inverse 0 DFT of sequence

x   5,  1  i  ,  1, i  1 .

11) Determine the normal equation if the cubie polynomial


y  a0  ax  a2 x 2  a3 x3 is fitted to the data  xi , yi  , i  0, 1, 2, ....., m .

1
12) Prove that x 2  T0  x   T2  x   .
2 

13) Prove that Tn  x  is a polynomial in x of degree A.

14) Express the following polynomial as sums of chebyshev polynomials.


a) 1  x  x 2  x3
b) 1  x 2  2 x 4

15) Determine the least square method for continuous function in  a , b  .


69
70
71

Soln :

dy
Given equation  3 x  y 2 with initial condition y  0   1 .
dx
dy 2
 0  1  1
dx
d2y dy
2
 3  2y put y  0   1
dx dx
 3  2 1 1  5

2
d3y d2y  dy 
3
 2 y 2
 2 
dx dx  dx 

2
 2 1  5   2 1  12

d4y d3y dy  d2y  dy d 2 y


4
 2 y 3
2  2  4
dx dx dx  dx  dx dx 2

 2 1 12   2 1 5   4 1  5   54

 By Talyor’s series method.

2 3 4

y  x   y0   x  x0  y I

 x  x0  y II

 x  x0  y III

 x  x0  y0IV  .....
0 0 0
2! 3! 4!

2 3 4

y  x   1   x  0 1
 x  0 5
 x  0 12 
 x  0 54  .....
2! 3! 4!

5x2 9
y  x  1  x   2 x 3  x 4  .....
2 4

For y  0.1 put x  0.1

5 2 3 9 4
y  0.1  1  0.1   0.1  2  0.1   0.1  .....
2 4

 1  0.1  0.025  0.002  0.000225

y  0.1  1.127225 .
72

5.3.1 Improving Accuracy for Taylor Series Method :

n!
The error in Taylor method is in the order of  x  x0  . The accuracy can
be improved by dividing the entire interval into subintervals
 x0 , x1   x1, x2   x2 , x3  ..... of equal length and computing y  xi  , i  1, 2, ....., n
successively using the Taylor series expansion using y  xi  as initial condition we
compute y  xi  1 it is given by,

y  xi  y II  xi  2 y m  xi  m
y  xi  1  y  xi    i1 i 
x  x   i1 i 
x  x  .....   xi1  xi 
1! 2! m!

In above expression put xi1  xi  h where i  0, 1, ....., n  1

 we get
h I h 2 II hm m
y  xi 1   y  xi   y  xi   y  xi   .....  y  xi 
1! 2! m!

Now denote y  xi 1   y  xi   yi 1 y  xi   yi , above expression


becomes
h I h 2 II hm m
yi 1  yi  yi  yi  .....  yi . This formula can be used recursively
1! 2! m!
to obtain yi values.

5.4 Picards Method :

dy
Consider the differential equation  f  x, y  ………. (I)
dx
with initial condition x  x0 , y  y0 .

Integrating the above equation in the interval  x0 , x  we get,


x x

 dy 
x0
 f  x, y  dx
x0
x
y  x   y  x0    f  x, y  dx
x0
x
y  x   y  x0    f  x, y  dx ………. (II)
x0

Since y appears under the integral. Since on the eight the integration can
not formed. Thus we shall replace the variable y by constant or a function of ‘x’.
since we know that the initial value of y at x  x0 .
73

This value we assue as first approximation to the solution.


x
y    y0 
1
 f  x, y  dx
x0
0

To obtain second approximation x  x0 put on right hand side of equation


(II) we get,
x
y  2   y0   f  x, y  dx
 1

x0

In this we get y 3 , y  4 , .....


 In general
x
y  n1  y0   f  x, y  dx
n

x0

This equation is known as Picard’s method.

Ex. :

dy
Solve the differential equation  xe y with y  0   0 by Picard method
dx
find y  0.2  . Check the error with analytically.

Soln. :

Given differential equation


dy
 xe y …. (I)
dx
with initial condition y  0   0 i.e. x0  0, y0  0
by Picard’s method
x
y II  y0   f  x, y  dx 0
x0

x
y0
 y0   xe dx
x0

x x
0 x2
 0   xe dx   xdx 
0 0
2

 f  x, y  dx
 2  1
y  y0 
x0

x 2 x
yx x2
 0   xe 2
dx   xe 2
dx
0 0
74

x2
Put  t  xdx  dt
2

x 2 x

  e dt  e   e 2   e x
x 2 x
t t
1
0
 0 2
0

x2
y  2  e 2
1

x
y  3   y0   f  x, y  dx
  2

x0
x
 0   xe
 y   dx  x x  e x 2  1 dx .
2 2

0
  0

 

Now this integration is more difficult therefore we stop at y  2 


x2
 y  x   y   e
2 2
1

 To find y  0.2  taking x  0.2 we get,


 0.2 2
y  0.2   e 2
 1  0.0202013 .

We shall solve the given equation analytically


dy
 xe y
dx
e  y dy  xdx

Integrating both side we get,


y
 e dy   x dx
x2
e y  c
2

Put x  0, y  0 we get, c   1
2
 e y  1  x
2
y   log 1  x
2

2 
Which is particular solution of d.E.
2
  0.2  
 y  0.2    log  1  
 2
 
 0.0202027
Error  0.0202027  0.0202013
 1.4  106
75

5.5 Euler’s Method :

Euler’s method is the one step method and has limited application because
dy
of it’s law accuracy. Consider the differential equation  f  x, y 
dx
………. (I) with initial value y  x0   y0 .

Let, xi  x0  ih i  1, 2, 3, .....
Integration equation (I) by the limit x0 to x1 , we get,
x1 x1

 dy 
x0
 f  x, y  dx
x0
x1

y  x1   y  x0    f  x, y  dx
x0
x1

y  x1   y  x0    f  x, y  dx
x0
x1

y1  y0   f  x, y  dx
x0

Assuming that f  x, y   f  x0 , y0  in x0  x  x1
x1

 y1  y0   f  x , y  dx
x0
0 0

y1  y0  f  x0 , x0  x1  x0 
y1  y0  h f  x0 , y0 
Again integrating equation (I) between x1 and x2 , we get,
x2 x2

 dy 
x1
 f  x, y  dx
x1
x2

y  x2   y  x1    f  x, y dx
x1
x2

 y2  y1   f  x, y  dx
x1

 y2  y1  h f  x1 , y1 

Similarly we can obtain y3 , y4 , .....


In general yn 1  yn  h f  xn , yn 
This is known as Euler’s formula.
76

Ex. : Using Euler’s method find an approximate value y corresponding to x  2


dy
given that  3 x 2  1 with y 1  2 taking interval h  0.2 also find error in it.
dx

Soln. :

Given differentiable equation is


dy
 3x 2  1
dx
 f  x, y   3 x 2  1 with initial x0  1, y0  2
By Euler’s method
yn 1  yn  h f  xn , yn  ………. (I)

Taking n  0, y1  y0  h f  x0 , y0 
Put x0  1, y0  2
2
f  x0 , y0   f 1, 2   31  1  4
 y1  y0  h f  x0 , y0 
y1  2   0.2  4   2.8
Taking n  1 in equation (1) we get x1  1  0.2  1.2

y2  y1  h f  x1 , y1 
 2.8  0.2 f 1.2, 2.8 


 2.8  0.2 3 1.2   1
2

 3.864 .

Taking n  2 in equation (1) with x2  1.2  0.2  1.4


y3  y2  h f  x2 , y2 
 3.864  0.2 f 1.4, 3.864 
y3  5.24 .

Taking n  3 in equation (1) with x3  1.4  0.2  1.6


y4  y3  h f  x3 , y3 
y4  5.24  0.2 f 1.6, 5.24 
 6.976 .

Taking n  4 in equation (1) with x5  1.6  0.2  1.8


y5  y4  h f  x4 , y4 
 6.976  0.2 f 1.8, 6.976  .
 9.12 .
77

 Thus the required approximate value of y  2   11.72 .


We shall solve the given equation analytically
dy
 3x 2  1
dx
dy  3x 2  1dx

Integrating both side


2
 dy   3x  1dx
3x 3
y xc
3
y  x3  x  c .

Taking initial value x0  1, y0  2 we get value of c


3
2  1  1  c
22c
c  0.
y  x3  x
3
y  2   2  2
82
 10

Error = Exact Value – Approximate Value


 10  9.12
 0.88 .

5.5.1 Accuracy of Euler’s Method :

Since Euler’s method use Taylor’s series iteratively, the truncation error
causes loss of accuracy. The truncation introduced by the step itself is known as
the local truncation error and the sum of the propagated error and local error is
called Global Truncation Error.
Consider Taylor’s expansion
h2 II h3 III
yn  1  yn  h ynI  yn  yn  .....
2! 3!

Since only first two terms are used in Euler’s formula the local truncation
error is given by,
h 2 II h3 III
Et , n  1  yn  yn  .....
2! 3!

The local truncation error of Euler’s method is of the order h 2 . If the final
estimation required n steps, the global truncation error at the target point b will be
78

n
2
1Etg l  c h i   c1  c2  ..... cn  h 2
i 1

 1Etg l  nch 2

cn
Where c  c1  c2  .....
n

But n 
b  x0 
h

 1Etg l   b  x0  ch .

5.6 Euler’s Modified Formula :

dy
Consider the differential equation  f  x, y  ………. (I)
dx
with initial condition y  x0   y0 .
Integrating both side between limit x0 to we get,
x1 x1

 dy 
x0
 f  x, y  dx
x0
x1

y1  y0 
x0
 f  x, y  dx
 By trapezoidal rule, we get,
h
y1  y0   f  x0 , y0   f  x1 , y1   ………. (II)
2
But f  x1 , y1  which occurs on the right hand side of equation (II), cannot
be calculate since y1 is unknown so first we calculate y1 from Euler’s formula.

 By Euler’s formula
y1  y0  hf  x0 , x0 
Put this value in equation (II) we set first approximation y11 .
h
y11  y0   f  x0 , y0   f  x1 , y0  h f  x0 , y0   
2
To obtain 2 approximation to y1 i. e. y1 2  put y1  y11 in right hand side
nd

of equation (II)
h
y12  y0   f  x0 , y0   f  x1 , y0  h f  x0 , y0   
2
th
Continuous in this process until y1 k 1  y11 the  k 1 approximation to
y1 is
h
y1k 1  y0   f  x0 , y0   f  x1 , y1k  
2 
In general
79

h
ynk11  yn   f  xn , yn   f  xn1 , yn1  
2
Where ynk1  yn  h f  xn , y n  [by Euler formula]

Ex. :

Using Euler’s modified formula. Find approximation value of y when


dy
x  0.3 given that  x  y and y  0   1 with h  0.1 .
dx

Soln. :

dy
Given differential equation is  x  y with initial value condition
dx
x0  0 and y0  1 & h0  0.1 .
 f  x, y   x  y

For 1st approximation :


f  x0 , y0   0  1  1
y1  y0  h f  x0 , y0 
 1  0.11  1.1
f  x1 , y1   f  0.1, 1.1  1.1  0.1  1.2
h
y11  y0   f  x0 , y0   f  x1 , y1  
2
 1  0.05 1  1.2 
 1.11 .

For 2 nd approximation :
f  x1 , y1   f  0.1, 1.11  1.21
y2  y1  h f  x1 , y1 
 1.11  0.11.21  1.231
f  x2 , y2   f  0.2, 1.231  0.2  1.231  1.431
h
y12  y1   f  x1 , y1   f  x2 , y2  
2 
 1.11  0.05 1.21  1.431
y12  1.242 .

For 3 rd approximation :
f  x2 , y2   f  0.2, 1.242   0.2  1.242  1.442
y3  y2  h f  x2 , y2 
 1.242  0.1 1.442 
y3  1.3862 .
80

f  x3 , y3    0.3, 1.3862 
 0.3  1.3862
 1.6862 .

y13  y2  h  f  x2 , y2   f  x3 , y3  
2
 1.242  0.05 1.442  1.6862
 1.3984 .

 The approximate value of y  0.3  1.3984 .

5.7 Runge – Kutta Method :

Runge-Kutta method is also called as RK-method it is the generalization


of the concept used in modified Euler’s method.

The Runge-Kutta method do on required the calculation of higher order


derivatives their designer to give greater accuracy.

 First order Runge-Kutta Method :

dy
Consider a differential equation  f  x, y  …. (I)
dx
with initial condition y  x0   y0
 By Euler’s formula
y1  y0  h f  x0 , y0 
y1  x1   y0  h f  x0 , y0 

Taking x1  x0  h we get,
By Taylor’s series
h 2 II
y  x1   y0  h y0I 
y0  .....
2!
 Euler’s method agrees with Taylor’s series upto the first 2 term’s.
Hence Euler’s formula is the first order Runge-Kutta method.

 Second Order Runge-Kutta Method :

dy
Consider a differential equation  f  x, y  …. (I)
dx
with initial condition y  x0   y0 .

 By Euler’s modified formula

y1  y0  h
2
h
yn 1  yn   f  xn , yn   f  xn 1 , yn 1  
2
81

h
i.e. yn 1  yn   f  xn , yn   f  xn , hn , yn  h  f n   
2 
Let k  h f  xn , yn 
k2  h f  xn  h , yn h f  xn , yn  
k2  h f  xn  h , y1  k1 

Putting the values of k1 and k2 in (II) we get,


1
yn 1  yn   k1  k2 
2
This is known as Runge-Kutta formula of order.

 3rd Order Runge-Kutta Method :

dy
Consider a differential equation  f  x, y  …. (I)
dx
with initial condition y  x0   y0 .
To determine y1 the 3rd order R-K is given by
1
y1  y0   k1  4k4  k3 
6
Where k1  h f  x0 , y0 
 h k 
k2  h f  x0  , y0  1 
 2 2
k3  h f  x0  h, y0  k2 
Where k2  h f  x0  h, y0  k1  .

th
5.6.1 4 Order Runge-Kutta Method or Runge-Kutta Method :

Consider a differentiable equation


dy
 f  x, y  with y  x0   y0 .
dx

To determine y1 the 4th order R-K formula is given by


1
y1  y0   k1  2k2  2k2  2k3  k4 
6

Where k1  h f  x0 , y0 

 k 
k2  h f  x0  h , y0  1 
 2 2

k
k3  h f  x0  h , y0  2 
 2 2

k4  h f  x0  h, y0  k3  .
82

Ex. :

Using R-K method of order 2 approximate value of y where x  1


dy
given that  3 x  y 2 with initial condition y 1  1.2 .
dx

Soln. :

dy
Given differential equation  3x  y 2 …… (I)
dx
Where f  x, y   3 x  y 2 with x0  1, y0  1.2 and h  0.1 .
2
 f  x0 , y0   f 1, 1.2   31  1.2   4.44
 k1  h f  x0 , y0   0.1  4.44  0.444
f  x0  h, y0  k1   f 1.1, 1.2  0.444 
 f 1.1, 1.644 
2
 3 1.1  1.644 
 6.
k2  h f  x0  h, y0  k1   0.1  6  0.6

 By R-K method of 2nd order


1
yn1  yn   k1  k2 
2
1
y1  1.2   0.444  0.6 
2
 1.722

Ex. 2 :

Using R-K method of order 3, approximate value of y when x  0.2 given


dy
that  x 2  y with initial condition y 1  1 and h0  0.1 .
dx

Soln. :

Given differential equation


dy
 x2  y
dx
 f  x, y   x 2  y with initial x0  1, y0  1

1 st approximation and h0  0.1


83

2
f  x0 , y0   f 1, 1  1  1  0
 k1  h f  x0 , y0   0.1  0  0
2
f  x0 h , y0k   f 1.1  1  1.1  1  0.21
k2  h f  x0  h, y0  k2   f 1.1, 1.021
2
 1.1  1.02 
 0.189 .
k3  h f  x0  h, y0  k2   0.1  0.189  0.0189
 k  2
f  x0  h , y0  1   f 1.05, 1  1.05   1  0.1.25
 2 2
 h k 
k4  h f  x0  , y0  1   0.1  0.1025  0.01025
 2 2

 R-K method of 3rd order


1
y1  y0   k1  4k4  k3 
6
1
y 0.1  1   0  4  0.01025  0.0189 
6
 1.00998 .

2 nd approximation
x1  1.1, y1  1.00998, h  0.1
2
f  x1 , y1   1.1  1.00998  0.2
k1  h f  x0 , y0   0.1  0.2  0.02
f  x1  h, y1  k1   f 1.2, 1.02998  0.41002
k2  h f  x1  h, y1  k1   0.1  0.41002  0.041
f  x1  h, y1  k2   f 1.2, 1.05098
 0.38902
k3  h f  x1  h, y1  k2   0.1  0.38902  0.0389
 h k 
f  x1  , y1  1   f 1.5, 1.01998   0.30252
 2 2
 h k 
k4  h f  x1  , y1  1   0.1  0.30252  0.030252
 2 2
1
 y  0.2   y1   k1  h k4  k3 
6
1
 1.00998   0.02  4  0.030252  0.0389
6
 1.03996
y  0.2   1.03996
84

Ex.3:

Using R-K method of 4 th order + 0 Find approximate value of y when


dy 3
x = 0.2 given that dx  x  y with initial condition
y(0) = 1 $ h = 0.1

Soln: Given differential equation


dy
 x3  y
dx
 f  x, y   x3  y with xo  0, y0  1, h0  0.1
1st approximation
3
f  x0 , y0   f  0,1   0   1  1
k1  hf  x0 , y0   0.11  0.1
 k 
k2  hf  x0  h / 2, y0  1   0.1 f  0.05  1.05 
 2
3
0.1  0.05   1.05
 
 0.105
 k 
k3  hf  x0  h / 2, y0  2   0.1 f  0.05  1.0525 
 2
3
0.1  0.05   1.0525
 
 0.10526

k4  hf  x0  h, y0  k3   0.1 f  0.1  1.0526 


3
0.1  0.1  1.10526 
 
 0.110626

According to 4th order R-K method

1
y1  y0   k1  2k2  2k3  k4 
6
1
1  0.1  2  0.105  2  0.10526  0.110626
6
 1.10591 .

2 nd approximation
x1  0.1, y1  1.105191, h  0.1
k1  h f  x1 , y1   0.1 f  0.1, 1.10591
3
 0.1  0.1  1.105191
 
 0.1106191 .

 k 
k2  h f  x1  h , y1  1   h f  0.15, 1.1605 
 2 2
85
86
87

Numerical Solution of Differential


Equation – II
Unit Structure
6.1 Objective
6.2 Introduction
6.3 Simultaneous First Order Differential Equations
Both Euler’s Method
6.4 Second Order Differential Equation
6.5 Multi-Step Methods (Prediction – Correction Method)
6.6 Adams Baeshforth Moulton Method
6.7 Accuracy of Multi-step Method
6.8 Model Differential Equation
6.9 Model Difference Problem
6.10 Stability of Euler Method
6.11 Review
6.11 Review
6.12 Unit End Exercise

6.1 Objective :
After studying this chapter you will be able to :
 Solve simultaneous first order differential equations.
 Solve higher order differential equation.
 Find solution of initial value problem of ordinary first order differential
equation by multi-step method by :
1) Milne – Simpson method
2) Adams Bashfarth maulton method
 Accuracy of multi-step method.
 Stability of numerical solution.

6.2 Introduction :
In previous chapter we have solve 1 st order differential equation by
different method. Here we are going to solve simultaneous differential equation
with some method also solve higher under different equation take
88

d2y
 f  x, y, z  with given initial condition to prove the efficiency of
dx 2
estimations in one step method we need to use multi-step method by
predication and correction formula.

6.3 Simultaneous First Order Differential Equations :


Both Euler’s Method :

Taylor’s method, Picard’s method, Euler method and Runge-Kutta


method can be used to find the approximate solution to the system of first order
differential equations.
Consider the first order differential equations.
dx
 f  t , x, y 
dt
dy
 g  t , x, y 
dt
with initial condition x  x0 , y  y0 when t  t0 or x  t0   x0 and
y  t 0   y0 .
Taking small change, assuming that t  h, x  k and y   .
The 4th order R-K method given by
k1  h f  t0 , x0 , y0 
 1  h g  t0 , x0 , y0 
 k  
k2  h f  t0  h , x0  1 , y0   1 
 2 2 2
 k  
 2  h f  t0  h , x0  1 , y0   1 
 2 2 2

 k  
k3  h f  t0  h , x0  2 , y0   2 
 2 2 2
 k  
 3  h f  t0  h , x0  2 , y0   2 
 2 2 2

k4  h f  t0  h, x0  k3 , y0    3 
 4  h f  t0  h, x0  k3 , y0    3 
1
 x1  x0   k1  2k2  2k3  k4 
6
89

1
y1  y0    1  2 2  2 3   4 
6
The extension of the R-K method to a system of n equation is quite
straight forward.
Similarly we solving 1st order differential equation by Taylor’s series
method.
st
6.3.1 Taylor’s method for simultaneous 1 order differential equation :

Consider the 1st order differential equation


dx
 f  t , x, y 
dt
dy
 g  t , x, y 
dt
with initial condition x  x0 , y  y0 and t  t0 . Let h be the small
change then by Taylor’s series expansion,
x1  x  t1   x  t0  h 
h2 II h 3 III
 x  t0   h x I  t0  
x  t0   x  t0   .....
2! 3!
h 2 II h3 III
 x0  h x0I  x0  x0  .....
2! 3!

y1  y  t1   y  t0  h 
h 2 II h 3 III
 y0  h y0I  y0  y0  .....
2! 3!

 Using Taylor series method evaluate x  0.3 and y  0.3 given that
dx dy
 y  log t and  cos t  x with initial condition x 1  2 and y 1  1 .
dt dt

Soln. :

By Taylor series method


h2 II
x1  x  t1   x0  h x0I  x0  ..... ………. (I)
2!
h 2 II
y1  y  t1   y0  h y0I  y0  ..... ………. (II)
2!
90

Given differential equation


dx dy
 y  log t ,  cos t  x
dt dt
f  t , x, y   y  log t , g  t , x, y   cos t  x
initial value x0  2, y0  1, t0  1

dx
dx
 y  log t dt  x I 1  1  log1  0
dt t  t0
x0I  1 .

dx
dy
 cos t  x dt  cos 1  2
dt t  t0
y0I  1.4597 .

d 2x
2
d x 1 dt 2
 yI   1.4597  1
dt 2
t t  t0
x0II  2.4597 .

d2y
2
d y dt 2
 -sin t  x1   sin1 1
dt 2 t  t0
y0II   1.8415 .

d3x
3
d x 1 dt 3 1
 y II  2  y0II    1.8415  1
dt 3
t t  t0 1
2

  0.8415 .

d 3x
3
d y dt 3
  cos t  x II  sin 1  2.4592
dt 3 t  t0
  3.3006 .
91

d4x
4
d x 1 4
 y III  3 dt   3.3006  1 3
dt 4
t t  t0 1
  2.3006 .

d4y
4
d y dt 4
 sin t  x IV  sin1  0.8415
dt 4 t  t0
 1.68297 .

Put all these value in equation (I) and (II)


2 3

x1  x  0.2   2   0.2  1


 0.2   0.2 
  2.4597  
2! 3!
4
 0.2 
 1.8415   2.3006 
4!
 2.2466 .

2 3

y1  y  0.2   1   0.2  1.4597 


 0.2   0.2 
  1.8415   3.3006 
2! 3!
4
 0.2 
 1.68297 
4!
 1.25082 .

 Using R-K method of 4th order find approximate value of x & y at t  0.1 the
dx dy
following system  x 2  y,  2x  y2 with initial condition
dt dt
x0  1, y0  1, t0  0 .

Soln. :

To compute x1  x  0.1 and y1  y  0.1 use R-K method of 4 th order.


1
x1  x0   k1  2k2  2k3  k4  ………. (I)
6
1
y1  y0    1  2 2  2 3   4  ………. (II)
6
Given dx dt  x 2  y, dy  x  y 2
dt
f  t0 , x0 , y0   x 2  y, y  t0 , x0 , y0   x  y 2 ,
92

with x0  1, y0  1, t0  0

2
k1  h f  t0 , x0 , y0    0.1  x02  y0   0.1 1  1  0.2
 
Im   , h 


k1  h f  t0  h , x0  k 2 , y0  1 
 2 2 2

 2

 0.1g  0.05,1.118,1.176   0.1  2 1.18  1.761   0.3619
 
 0.1 f  0.05, 1.1, 1.15
2
 0.1 1.1  1.15
 
 0.236 .

  0.1  g  0.05;1.118,1.176  0.1  2 1.118  1.1781   0.3619


 0.1 g  0.05, 1.1, 1.15
2
 0.1  2 1.1  1.15  
 
 0.35225 .

 k  
k3  h f  t0  h , x0  2 , y0  2 
 2 2 2

 2
  0.1  9  0.05;1.118,1.176  0.1  2 1.118  1.1781   0.3619
 
 0.1 f  0.05, 1.118, 1.761
2
 0.1 1.118   1.1761
 
 0.2426 .

k 
 3  h g  t0  h , x0  1 , y0  2 
 2 2 2

k4  h f  t0  h, x0  k3 , y0   3 
 0.1 f  0.1, 1.2426, 1.3619
2
 0.1 1.2426   1.3619 
 
 0.2906 .
93

 4  h g  t0  h, x0  k3 , y0   3 
 0.1g  0.1, 1.2426, 1.3619 
2
 0.1g  2  1.2426   1.3619  
 
 0.4339 .

Put all value in equation (I) and (II) we get,


1
x1  1   0.2  2  0.236   2  0.2426   0.2926 
6
 1.2416 .

1
y1  1   0.3  2  0.35225   2  0.3619   0.4339 
6
 1.3604 .
 x  0.1  1.2416, y  0.1  1.3604 .

6.4 Second Order Differential Equation :


Consider the second order differential equation
2
d y  dy 
2
 f  x, y , 
dt  dx 
 dy 
y  x0   y0 ,    y0I
 dx  x  x0
dy
Substituting  z , we get,
dx
dy
 f  x, y, z 
dx
with initial condition y  x0   y, z  x0   y0I .
These constitute system of simultaneous equations.

Ex. :

Use Runge-Kutta method to find y  0.2  for the equation


d2y dy dy
2
x  y given that y  1,  0 when x  0 with h  0.2 .
dx dx dx
94

Soln. :

Given 2 nd order differential equation


d2y dy
2
x y
dx dx
dy
Taking  z  f  x, y, z  we get,
dx
d2y
 x z  y  g  x, y, z 
dx 2
with initial condition x  0, y  1, z  0 with h  0.2 .

k1  h f  x, y, z   h z  0.2  0  0
 1  h g  x, y, z   h  x, z  y   0.2  0  0  1  0.2

k  M
k2  h f  x  h , y  1 , z  1   h  z1  1   0.2  0  0.1   0.02
 2 2 2   2
k   M 
 2  h g  x  h , y  1 , z  1   h  x  h  z  1   y  h   
 2 2 2   2  2  2 
 0.2  0  0.1  0  0.01  1  0.202

k   0.202 
k3  h f  x  h , y  2 , z  2   0.2  0    0.202
 2 2 2  2 
k 
 3  h g  x  h , y  2 , z  2   0.2  0.1  0.101, 0.99 
 2 2 2
 0.2  0.0101  0.99   0.20002

k4  h f  x0  h, y0  9, z0   3   h  z  M 3   0.2  0  0.20002   0.040004

 4  h g  x0  h, y0  k3 , z   3   0.2  0.2   0.20002   1  0.202  


 0.2  0.040004  0.9798   0.2039608
95

Put all these value in R-K method of 4th order


1
y  0.2   y0   k1  2k2  2k3  k4 
6
1
 1  0  2  0.02   2  0.0202    0.04004  
6
1
 1   0.120404 
6
 0.9799 .

1
z  0.2   z0  1  2 2  2 3   4 
6
1
 1   0.2  2  0.0202   2  0.20002   0.20396 
6
1
  1.2080008
6
  0.20133 .

6.5 Multi-Step Methods (Prediction – Correction Method):


A pair of multi-step methods are used in conjunction with each other,
are for predicting the value of yi  1 and the other for correcting the predicted
value of yi  1 such method are called prediction – correction method.
6.5.1 Milne – Simpson Method :

Consider a differential equation


dy
 f  x, y  ………. (I)
dx
with initial value y  x0   y0
Integrating equation I with the limit x0 and xn
x4 x4

 dy 
x0
 f  x, y  dy
x0
x4

yn  y 0   f  x, y  dx
x0
………. (II)

We use newton forward difference interpolation formula in the form


96

n  n  1
f  x, y   f  x0 , y 0   n  f  x0 , y0    2 f  x0 , y0 
2!
n  n  1  n  2 
  3 f  x0 , y0   .....
h
Taking f  x0 , y0   f 0 from equation (II)

x4
 n  n  1 2 n  n  1 n  2  3 
yn  y0    f 0  n  f0   f0   f 0  ..... dx
x0
2! 3! 
where x n
 x  x0  nh x0 0
dx  hdn xn n

4
 n2  n 2 n3  3n 2  3n 3 
 y 4  y0  h   f 0  n  f 0   f0   f 0  ..... dn
0 
2 6 

4
 n2 1  n3 n2  2 1  n4  
y4  y0  h  nf 0  f 0      f 0    n3  n 2   3 f 0  .....
 2 2 3 2 6 4  0
th
neglecting 4 and higher power of 
 20 2 8 
 y4  y0  h  4 f 0  8f 0   f0  3 f0 
 3 3 
Put   E  1

h  2 3
y4  y0  12 f 0  24  E  1 f0  20  E  1 f 0  8  E  1 f 0 
3  
h
y4  y0  12 f 0  24  E  1 f 0  20  E 2  2 E  1
3
f 0  8  E 3  3E 2  2 E  1 f 0 
We know that E  f  x    f  x  h 
E  f  x0    f  x1  , E  x, y   f

h
y4  y0  12 f0  2h  f1  f 0   20  f 2  2 f1  f 0   8  f 3  2 f 2  3 f1  f 0  
3 
97

h
y4  y0  8 f1  4 f2  8 f3 
3
4h
y4  y0   2 f1  f 2  2 f3 
3
4h
 y4  p  y0   2 y11  y21  2 y31 
3
In general
4h
y  n 1 p  yn  3   2 y1n  2  y1n 1  2 yn1 
3 
This is known as Milne’s predication method.

6.5.2 Simpson’s Method :

Consider a differential equation


dy
 f  x, y  ………..
dx
(I)
with initial condition y  x0   y0
Integrating equation (I) between the limit x0 to x2 we get,
x2

y2  y0   f  x, y  dx
x0

By Newton’s forward difference interpolation formula.

n  n  1 2 n  n  1  n  2  3
f  x , y   f 0  n f 0   f0   f 0  .....
2! 3!

x2
n2  n 2 1
y2  y0   f 0  f 0   f0   n3  3n 2  2n   3 f 0  ..... dx
x0
2 6
 x  x0  nh  dx  ndh limit change
x h
x0 0
x2 2

2
y2  y0  h   f 0  nf 0 
n2  n 2
 f0 
 n3  3n2  2n   3 f  ..... dn
0
0
2 6 

98

2
 n2 1  n3 n2  2 1  n4  
 y0  h  nf 0  f 0      f 0    n3  n 2   3 f 0  .....
 2 2 3 2 6 4  0
Neglecting 3rd and higher order difference
Put   E  1
 1 2 
y4  y0  h  2 f 0  2  E  1 f 0   E  1 f 0 
 3 
h 
 y0  6 f 0  6  E  1 f 0   E 2  2 E  1 f 0 
3
h
 y0   f 0  4 E1  f 2 
3
h
y2  y0   y01  4 y11  y21 
3
h
 y4   y2   y21  4 y31  y41 
3
In general
h 1
y  n 1 c  y n 1 
3
 yn 1  4 yn1  y1n 1 

This is known as Simpson’s correction formula.

Ex. :

Given differential equation


dy
 1  y2
dx
Where y  0   0 estimate y  0.8  using the Milne Simpson predication
correction method taking h  0.2 .

Soln.:

Given differential equation


dy
 1  y2
dx
f  x, y   1  y 2 h  0.2
x0  0 x1  0.2 x2  0.4 x3  0.6
th
By R-K method of 4 order
y0  0 y1  0.2027 y2  0.4228 y3  0.6841
99

2
y11  f  x1 , y1   f  0.2, 0.2027   1   0.42027 
 1.0411 .

2
y12  f  x2 , y2   f  0.4, 0.4228   1   0.4228 
 1.1787 .

2
y13  f  x3 , y3   f  0.6, 0.6841  1   0.6841
 1.4679 .

Milne predication formula is


4h
 y4   y0   2 y11  y12  2 y31 
3
4  0.2
 0  2 1.0411  1.1787  2 1.4679  
3
 1.0238 .
Using Simpson’s correction formulas is given by
h  1
 y4  C  y2   y2  4  y31   y41  ………. (II)
3
y4  f  x4 , y4   f  0.8, 1.0238 
1

2
 1  1.0238 
 2.0482 .

0.2
 y4  C  1.1787  1.787  4 1.4679   2.0482 
3 
 1.7853 .

We can again use the correction formula II to refine the estimate.


y14  f  x4 , y4   f  0.8, 1.7853 
2
 1  1.7853
 4.1873 .

0.2
 y4  C  1.787  1.1787  4 1.4679   4.1873
3 
 1.9278 .
100

Which is not same again we use


y14  f  x4 , y4   f  0.8, 1.9278 
2
 1  1.9278 
 4.7164 .

0.2
 y4  C  1.787  1.1787  4 1.4679   4.7164 
3 
 1.9631 .

Note :

Milne formula is used to predict the value of yi  1 , evaluation of fi  1 ,


correction of yi  1 , then to improved value of f i  1 .
It is also possible to use the correction formula repeatedly redefine the
estimate value of yi  1 , before moving on to the next stage.

6.6 Adams Baeshforth Moulton Method :


Consider a differential equation
dy
 f  x, y   I
dx
with initial condition y  x0   y0
Integrating equation ‘I’ between the limit x0 to x1 we get,
x1

y1  y0   f  x, y  dx
x2
……… (II)

Using Newton Backward difference interpolation formula in the term.

n  n  1 2
f  x, y   f  x0 , y0   nf  x0 , y0    f  x0 , y0   .....
2!

x1
 n2  n 2 n3  3n 2  2n 2 
y1  y0  f
x  0  n f 0   f 0   f 0  ..... dx
2
2! 6 
x h
x  x0  nh
where x0 0
dx  hdn
x1 1
101

1
 n2  n 2 
y1  y0   h  f 0  nf 0   f 0  ..... dx
 0
2 

1
 n2 1  n3 h 2  2  n4  
y1  y0  h  nf 0  f 0      f0    n 3  n 2   3 f0  .....
 2 2 3 2  4  0
th 1
Neglecting 4 and higher order and put   1  E we get,
 1 5 2 3 
y1  y0  h  f 0  1  E 1  f 0  1  E 1  f 0  1  E 1  f 0  .....
 2 12 8 

 1 5 3 3 
 y0  h  f 0  1  E 1  f 0  1  2 E 1  E 2    1  3E1  3E 20  E 3  f 
 2 12 8 8 

h
 y0   24 f 0  12  f 0  f1   10  f 0  2 f 1  f 2   9  f 0  3 f 1  3 f 2  f 3  
24 
h
y1  y0  55 f0  59 f 1  37 f 2  9 f 3 
24
h
y1  y0  55 y01  59 y11  37 y21  9 y13 
24
h
 y4  p  y3  55 y3I  59 y2II  37 y1I  9 y01 
24
In general
h
y 
n 1 p  yn 
24
55 yn1  59 yn11  37 yn12  9 yn13 
This is known as adam’s basehforths predication formula for correction
formula
Given differential equation
dy
 f  x, y 
dx
with initial condition y  x   y0 ………. (I)
Integration between limit x0  x1 we get,
x1

y1  y0   f  x, y  dx
x0
………. (II)

Using Newton Backward difference inter pollution formula


102

n  n  1 2 n  n  1  n  2  3
f  x, y   f1  nf1   f1   f1  .....
2! 3!
where n  x  x1 h

x1
 n  n 1 2 n  n  1 n  2  2 
y1  y0    f1  nf1   f1   f1  .....  dx
x0 
2! 3! 
x  x1  nh where x n
dx  hdn x0 1
x1 0

0
 1 1 
y1  y0  h   f1  nf1   n 2  n   2 f1   n 3  3n 2  2n   3 f1  ..... dn
1 
2 6 
th
Neglecting 4 and higher order, we get and put   1  E 1

 1 1 1 
y1  y0  h  f1  1  E 1  f1  1  2 E 1  E 2   1  3 E 1  3 E 2  E 3  
 2 2 24 

h
y1  y0   24 f1  12  f1  f 0   2  f1  2 f 0  f1   1 f1  3 f 0  3 f1  f 2  
24 
h
y1  y0  9 f1  19 f 0  5 f1  f 2 
24
h
y1  y0  9 y11  19 y01  5 y11  y12 
24
h
 yn C  y3  9 y41  19 y31  5 y21  y11 
24 
In general
h
y 
n 1 C  yn  9 y1n 1  19 yn1  5 yn1 1  yn1  2 
24 
This is known as Adams – Moultan correction formula.
103

Ex. :

Using Adam – Baeshforth Moultan method


dy 2 y

dx x
with initial y 1  2 estimate y  2  assuming h  0.25 .

Soln. :

Given differential equations


dy 2 y

dx x
 f  x, y   2 y
x
with initial condition y 1  2
 x0  1; y0  2
By using R-K method of 4th order we get,
x0  1, x1  1.25, x2  1.5, x3  1.75
y0  2, y1  3.13, y2  4.5, y3  6.13

22
y10  f  x0 , y0   4
1
2  3.13 
y11  f  x1 , y1   f 1.25, 3.13   5.008
1.25
2  4.5
y12  f  x2 , y2   f 1.5, 4.5   6
1.5
2  6.13
y13  f  x3 , y3   f 1.75, 6.13   7.0057
1.75
By Adams – Bushforth predication formula
h
 y4  p  y3  55 y31  59 y21  37 y11  9 y01 
24 
0.25
 y4  p  6.13  55  1.0057  59  6   37  5.008   9  4  
24 
 8.0113 .
2  8.0113
y14  f  x4 , y4   f  2, 8.0113   8.0113
2
Adoms – Bashfourth correction formula
h
 y4  C  y3  9 y41  19 y31  5 y12  y11 
24 
104

0.25
 y4  C  6.13  9  8.0113   9  7.0057   5  6    5.008  
24 
 8.0073 .
Hence, y  2   8.0073 .

6.7 Accuracy of Multi-step Method :


We know that for each differential equation there is an optimum steps
size h. if his also large, accuracy diminished and if it too small round off error
would dominate and reduce accuracy.
By computing the predicated used corrected values of yi  1 , we can
estimates the size and sign of error.
Let’s denote the predicated value  yn  1  p and corrected value  yn  1 c .
Similarly denote the truncation error in predicated value by Etp and corrected
value by Etc .
 Etp  y   yn 1 
p

Etc  y   yn 1 
c

Where y denotes the exact value of y of xn1 then differences between


the error is
Etp  Etc   yn1 c   yn1  p
A large difference indicates that step size is too large. In such cases we
must reduce the size of h.
Both the Milne and Simpson formula are of order 44 and their error
terms are of order h5 .
The truncation error in Mile’s formula is
 28 
Etp    y 5  θ1  h 5
 90 
The truncation error in Simpson’s formula’s
1 5
Etc 
10
 y   θ 2  h5
Let’s assume that
 θ1   y 5    y 5   θ2 
Etp
  28
Etc
Etp   28 Etc
105

 Etp  Etc   yn 1    yn 1  becomes


c p

 Etc  28 Etc   yn 1    yn 1 
c p

 29 Etc   yn 1    yn 1 
c p

  yn1 c   yn1  p
Etc 
29
If the answer is required to a precision of a decimal digits then
 yn1 c   yn1  p
Etc   0.5  10  d
29
  yn1  c   yn1  p  29  0.5  10 d  15  10 d
Similarly for Adams – Bashfourth method we get,
270
 yn1 c   yn1  p   0.5  10  d  7  10 d
19

6.7 Stability :
Stability of a numerical method ensures that small changes in the initial
conditions should not lead to large changes in the solution. This is particularly
important as the initial conditions. May not be given exactly. The approximate
solution computed with error in initial conditions is further used as the initial
condition for computing solution at the next grid point. This accounts for large
deviation in the solution started with small initial errors also round off error’s
in computations may also affect the accuracy of the solutions at a grid point.

Euler method is found to stable :

Stability is the necessary and sufficient condition for convergence.

6.7.1 Stability of Numerical Solutions :

Consider a differential equation


dy
 f  x, y 
dx
with initial condition y  x0   y0 .
106

The solution with nearby initial values are close 0 y x  is called the
stable. If the solution with near by initial values diverse from y  x  then the
solution is unstable.
dy
For e.g.  y  1 with initial condition y  0   1
dx
Exact solution of given DE is
dy
 y 1   dx
log  y 1  x  log c
y 1  1  ce x
By initial condition y  0   1
y  0   1  ce0
c0
 y  x  1
Which is exact solution of given differential equation if y1  0   1.0001
then find for the same y  0   1.0001 .
y  0   1  ce0
1.0001  1  e0c
c  0.0001  0
y  x   1.0001 .

The exact solution of this differential equation is y  x   1 where c  0 .


However if we use other initial values c  0 and the solution with
diverge from the y  x   1 .
It is difficult to obtain accurate numerical solution to an unstable initial
value problem. If a small numerical error occur solution diverge from the two
solution.

6.8 Model Differential Equation :

Consider the model first order differential equation


dy
 y ………. (I)
dx
107

with initial condition y  0   y0 where  is constant and it may be oral


as complex number
dy
 y
dx
dy
   dx
y
Integrating both sides
dy
   dx
y 
log y   x  log c
y  x   ce x ………. (II)
To find ‘c’ use y  0   10
 y  0   ce0
y0  c .
Put y0  c in equation (II) we get,
y  x   y0 e  x
Which is exact solution of differential equation.
 If   0 , a small change in the initial condition causes only small
change in the solution and therefore the problem is a stable problem.
 If   0 large changes in solutions will occurs and the problem is
unstable.

6.9 Model Difference Problem :


Consider the model difference problem
yn1  k yn , n  1, 2, 3, .....
Where the initial value y0 is given as 6 is complex number
 Eyn  k yn  0
 E  k  yn 0
Auxiliary equation is
Ek0
E  k
C  F  Ak n and P  F  0
The complete solution is
yn  C  F  P  F
yn  Ak n ………. (I)
108

To find A put A  0
y0  Ak 0
y0  A
Put this value in equation I
yn   n y0 .
The solution is bounded if 6  1 which is the solution of difference
equation.
The connection between the exact solution and the difference solution is
clear if we evaluate the exact solution at the points xn  nh where
n  1, 2, 3, ..... and h  0 .
y  y0 e x
y  xn   e xn y0
n
yn   e  h  y 0
yn  k n y 0
 k  e h
If exact solution is bounded then   eh  1 . this is possible if
Re   h   1h  0 .
i.e. in the 1h  2h plane the region of stability of the exact solution is
the left half plane as shown in fig.

h

h
0

Stability region of exact solution.


A single step method is called
i) Also olutely stable if k  1
109

ii) Relatively stable if k  eh


iii) Periodically stable if k  1 and  is purely imaginary.

6.10 Stability of Euler Method :


Given differential equation is
dy
 y
dx
with initial condition y  0   y0
 f  x, y    y
By Euler’s method state that
yn 1  yn  hf  xn , yn 
 yn  h yn
 yn 1  hd 
yn 1  kyn
Where k  1   h .
 The solution of this differential equation is yn  k n y0 .
Since the exact problem has an exponentially decaying solution for
  0 , a stable numerical method should exhibit the same behavior.
 In order to ensure stability of Euler’s method we need that the so called
growth factor  h  1
 yn  0 as n   if k  1   h  1
Here we discuss the following cases.

Case I :

If  is real and   0 then


  1  h  1
 1  1  h  1
  2  h  0
 n  2 .

Thus Euler’s method is only conditionally stable. i.e. the step size has to
be choosen sufficiently small to ensure stability. The set of  h function the
growth factor is less than are is called the linear stability domain D.
110

Case II :

 is purely imaginary
2
k  1   h  1  i2h  1   2h   1
Euler method’s unstable where  is ure imaginary.

Case III :

 is a complex number
Let z    c
1 x 1
 1   1  i2  h  1
 1   1h  i2 h   1
2 2
1  1h   2h   1
2 2
 1h  1   2h   1
A rather small circular subset of the left half of the complex plane.

Diagram
Im( ,h)

Rc ( h)
-2 
()

Stability region of Euler method.


where    1
1  1
 1  1  h  1
2  h  0
0  h  2
 Euler method is stable inside the circle.
111

6.11 Review
In this chapter we have learn

 Simultaneous first under differential equation solution by numerical


method.
 Solution of second order differential equations by numerical method.
 Multi-step method : (Predication – correction method)

i) Milne – Simpson Method


ii) Adam – Bashfourth Maulton Method

 Accuracy of multi-step method.


 Stability.

6.12 Unit End Exercise :

1) Using Taylor’s series method evaluate x  0.2  and y  0.2  given that
dx dy
 y  et  x  sin t with x  0   1 and y  0   0 .
dt dt

2) Using Taylor’s series method compute x  0.1 and y  0.1 correct upto
dx dy
h-decimal places given that  y  t and  x  t with x  0   1 and
dt dt
y  0  1.

3) Using R-K method of 4th order find the approximate value of x and y at
dx dy
t = 0.1 the following system  2 x  y,  x  3 y with x0  1, y 0  0 .
dt dt

d2x tdx
4) Using R-K method solve the differential equation 2
x with
dt dt
x  0   1, x1  0   0 taking h  0.1 to find x  0.2  and x1  0.2  .
112

5) Use Taylor’s series method to find x  0.2  and x1  0.2  given that
2
d 2x  dx 
2
 t    x 2 with x  0   1 and x1  0   0 with h  0.2 .
dt  dt 

6) Use Taylor series method to find the value of y at t = 0.1 correct upto
d2y dy
decimal place if y satisfies the equations 2
 ty given that  1, y  1
dt dt
when t  2 with h  0.1 .

dy
7) Given that  x 2  y 2  2 with y     1.09, y  0.1  1, y  0.2   0.89 and
dx
y  0.3  0.7605 use Milne’s Simpson’s method to determine y  0.4 
correct to 4 decimal places.

dy
8) Given  x  y2 with y  0   0 evaluate y  0.8  using Milne –
dx
Simpson’s method obtain the starting values from Euler’s method.

9) Using Adam – Bashforth method determine y  4.4  given that


5 xy1  y 2  2 with y  4   1
y  4.1  1.0049, y  4.2   1.0097, y  4.3  1.0143 .

dy
10) Given  y  x 2 with
dx
y  0   1, y  0.2   1.2186, y  0.4   1.4681, y  0.6   1.7378 compute y  0.8 
and y 1.0  by Adam – Bashforth method correction upto 4 th decimal
places.

11) Determine Milne Simpson’s method to solve ordinary differential


equation with initial condition y  x0   y0 .
113

12) Determine Adams – Moultan correction formula solve 1st order


differential equation with initial condition y  x0   y0 .

13) Determine Adams – Bashforth predication formula to solve 1st order


differential equation with initial condition y  x0   y0 .

14) Determine accuracy of multi-step method of Milne’s Simpson’s method.

______________________
114

7
Numerical Solutions of Partial
Differential Equations
Unit Structure

7.0 Objective
7.1 Introduction
7.2 Finite Difference Approximations to Derivatives
7.3 Laplace Equation of Two Dimension
7.4 Jacobi’s Iteration Formula
7.5 One Dimensional Heat Equation (Parabolic Equation)
7.6 Crank – Nicholson Difference Method
 2 U U
7.7 Given One Dimensional Heat Equation  under the conditions
x 2 t
7.8 One Dimensional Wave Equation (Hyperbolic Equation)
7.9 Review
7.10 Unit End Exercise

7.0 Objective :
After studying this chapter you will be able to :
 Solve partial differential equation by numerical method.
 Solve Laplace equation using numerical method.
 Sole heat equation of one dimension by numerical method.
 Solve wave equation of are dimension by numerical method.

7.1 Introduction :
Partial differential equations are used in a number of physical problems
such as fluid flow heat transfer, solid mechanics and biological process. There
are three types of equations. Hyperbolic equations are most commonly
associated with advection, parabolic equations are most commonly associated
with diffusion and elliptic equation are most commonly associated with steady
states of either parabolic or hyperbolic parabolic problems classification of
general linear partial differential equations.
115

General partial differential equation is of the form.


2 y 2 y 2 y y
A  x, y  2
 B  
x , y  C   2  D  x, y 
x , y
x x y y x
.… (I)
dy
 E  x, y   F  x, y  u  G  x , y   0
dx
Where U is or known function of x and y and A, B, C, D, E, F
and G are also functions.
This equations is called
1) Elliptic : If B 2  4 AC  0
2U 2U
For eg.  2  0 Laplace equations
x 2 y
2U 2U
  f  x, y  Poisson’s equations
x 2 y 2

2) Parabolic : If B 2  4 AC  0
U 2U
For eg.  C2 are dimensional heat conduction equation.
y x 2

3) Hyperbolic : If B 2  4 AC  0
2U 2
2  U
For eg.  C the wave equation.
y 2 x 2

7.2 Finite Difference Approximations to Derivatives :

Let the Parabolic : If  x, y  plane be divided into a network of


rectangles of sizes x  h and y  k by drawing the sets of lines
x  i h, i  0, 1, 2, .....
y  jk j  0, 1, 2, .....

y Grid point

x
0
116

The point of intersection of these families of lines are called mesh


points, lattice points on grid points.
Let U  x, y  Bethe function of the variable x and y
U  x  h, y   U  x, y   O  h 
Ux 
h
Expand U  x  h, y  in Taylor’s series expansion
h2
U  x  h, y   U  x , y   hU x  Uxx  .....
2!
U  x  h , y   U  x, y  h2
  Ux  Uxx  .....
h 2!
U  x  h, y   U  x, y 
 Ux   O h
h
This is forward difference approximation for Ux. Similarly we have the
approximation.
U  x, y   U  x  h , y   O  h 
Ux 
h
This is backward difference approximation for Ux.
U  x  h, y   U  x  h, y   O  h 2 
Ux 
2h
This is central difference approximation for Ux.
Let U  x, y   U  i h, ij   U  i, j 
U  i 1, j   U  i, j   O  h 
Ux  for forward
h
U  i, j   U  i 1, j   O  h 
Ux  for backward
h
U  i 1, j   U  i  1, j   O  h 2 
Ux  for central
2h
U  i 1, j   2U  i, j   U  i 1, j 
Uxx   O  h2 
h2
Similarly we have the approximation
U  i , j  1  U  i , j 
Uy   O  k  for forward
h
U  i , j   U  i , j 1
Uy   O  k  for backward
h
U  i , j  1  U  i , j 1
Uy   O  k  for central
2k
117

U  i , j 1  2U  i , j   U  i , j 1
Uyy   O k 2 
k2

7.3 Laplace Equation of Two Dimension :


Consider the Laplace equation of two diameter are given by,
Uxx  Uyy  0 ….. (I)
Consider a square region R for which U  x , y  is known at the
boundary and divide R into small squares of side h as shown in fig. where
b1 , b2 , ....., b16 are boundary values.

b13 b12 b11 b10 b9

U7 U8 U9
b14 b8

b 15 U4 U5 U6 b7
U6 U2 U3
b16 b6
b1 b2 b3 b4 b5

We know that
Ui 1, j
Uxx  Ui 1, j  2U i , j  …... (II)
h2
U i , j 1  2U i , j  U i , j 1
Uyy  …... (III)
k2
Replace (II) and (III) in equation (I) we get,
Ui 1, j   2Ui , j  U i 1, j U i , j 1  2U i , j  Ui , j 1
 0 ….. (IV)
h2 k
118

For value of h  k i.e. for square grid of the mesh size h equation
can be written as
Ui1, j  2Ui , j  U i 1, j  Ui , j 1  2U i , j  U i , j 1  0
1
 U i1, j  U i 1, j  U i , j 1  U i , j 1 
 U i, j  …... (V)
4
These shows that the values of U  x, y  is the average of its four
neighbors to the East, West, North, South is called standard five points formula
[S, F, P, F].
This formula is also known as Liebman’s averaging procedure.

Note :

The Laplace equation remains unchanged when coordinate are rotated


through 45°.
A formula similar to the (VI) is sometimes used with convenience it is
given as
1
Uij 
4
 Ui 1, j 1  Ui 1, j 1  Ui 1, j 1  Ui 1, j 1  …... (VI)
This is known as diagonal five point formula as these points Lies on the
diagonals (DFPE). But it is less accurate than standard five point’s formula.

(i+1, j+1) (i+1, j+1)

E(i,j)

(i-1, j-1) (i+1, j-1)


We use the following five point formula to set the initial value of U at
the centre.
1
U5   b1  b5  b9  b13 
4
119

Then the approximate values of U1 , U 3 , U 7 , U9 are calculated by the


diagonal five point formula.
1
U1  b1  b3  b5  b15 
4
1
U3   b3  b5  b7  U 5 
4
1
U 7   b15  U 5  b11  b13 
4
1
U9  U 5  b7  b9  b11 
4
The values of the remaining interion point i.e. U 2 , U 41 , U 6 and U8 are
obtained by the standard five point formula.
1
 b3  U 3  U 5  U1 
U2 
4
1
U 4  U1  U 5  U 7  b15 
4
1
U 6  U 3  b7  U 9  U 5 
4
1
U8  U 5  U 9  b11  U 7 
4
Thus we obtain all initial values U1 , U 2 , U 3 ..... U g once their accuracy
can be improved by the repeated application of either Jacobi iteration formula
as Gauss – Seidel iteration formula.

7.4 Jacobi’s Iteration Formula :

Let U in, j be the nth iterative value of U i, j then Jacobi’s iterative


procedure is given below.
1
Ui ,nj1   U in1, j  Uin1, j  U in, j 1  Uin, j 1 
4

 Gauss – Seidel Method :

This method utilizes the latest iterative value available and scans
the mesh points symmetrically from left to right along successive rows.
The formula is given below.
1
Uni, 1j    U in1,1 j  Uin1, j  U in, j11  U in, j 1 
4
120

Ex. :

Solve Laplace equation Uxx  Uyy  0 in the domain of the figure given
below by Gauss – Seidel method.

10 20

10 20

20 10

20 10

Soln. :

1
U1
n1
10  10  U 2n  U1  
n


4
1
U2n 1   20  20  U1 n1  U3 n  
4
1
U3  10  10  U1 n 1  U3 n 1 
4
1
U4n1   20  20  U1 n1  U 3 n1 
4
We use SFPF
1
Uij   U i1, j  U i 1, j  U i , j 1  U i , j 1 
4
and DFPF as
1
 U i1, j 1  U i 1, j 1  Ui 1, j 1  Ui 1, j 1 
Uij 
4
Now initially U1  0, U 2  0, U 3  0, U 4  0,

First Iteration :
1
U11  10  0  10  0  5
4
1
U2    20  0  20  5  11.25
2

4
1
U31  10  11.25  10  0  7.8125
4
121

1
U4  
1
 20  7.8125  20  5  13.20
4

Second Iteration :
1
U1  
2
10  10  11.25  13.20  11.1125
4
1
U22   20  20  11.1125  7.8125  14.73
4
1
U32  10  10  14.73  13.20  11.98
4
1
U42   20  20  11.1125  11.98  15.77
4

Third Iteration :
1
U1 3  10  10  14.73  15.77  12.63
4
1
U23   20  20  12.63  11.98  16.15
4
1
U3 
3
 10  10  16.15  15.77   12.98
4
1
U43   20  20  12.63  12.98  16.40
4

Fourth Iteration :
1
U1  
4
10  10  16.15  16.40  13.14
4
1
U24   20  20  13.14  12.98  16.53
4
1
U34  10  10  16.53  16.40  13.23
4
1
U44   20  20  13.14  13.23  16.59
4
122

Fifth Iteration :
1
U1 5  10  10  16.53  16.59  13.28
4
1
U25   20  20  13.28  13.23  16.63
4
1
U35  10  10  16.63  16.59  13.31
4
1
U4 
5
  20  20  13.28  13.31  16.65
4

Sixth Iteration :
1
U1 6  10  10  16.53  16.55  13.33
4
1
U2    20  20  13.32  13.31  16.66
6

4
 6 1
U3  10  10  16.67  16.65  13.33
4
1
U46    20  20  13.32  13.33  16.66
4
 U1  13.33, U 2  16.66, U 3  13.33, U 4  16.66 .
Ex. 2 :

Solve Uxx  Uyy  0 by h i.e. bman iteration process for the domain of
the figure given below :

0 50 100 50 0

U1 U2 U3 100
100
U4 U5 U6 200
200
U7 U8 U9
100 100

0 50 100 50 0
123

Soln. :

We use standard five point formula


1
Uij   Ui 1, j  Ui 1, j  U i , j 1  Ui , j 1 
4
and diagonal five point formula
1
Uij   U i1, j  U i 1, j 1  U i 1, j 1  Ui 1, j 1  U i 1, j 1 
4
Values given on the figure are symmetrical about middle line
 U1  U 2  U 3  U 7 and U 2  U8 & U 4  U 6 .
1
U5   200  100  200  100  150 [Standard formula]
4
1
U 4   0  200  150  100   112.5 [Diagonal formula]
4
 Similarly U1  U3  U 5  U 7  112.5
1
U 2  100  112.5  150  122.5
4
 118.75 .
U8  U 2  118.75
1
U 4  112.5  200  112.5  150 
4
 143.75 .
U 4  U 6  143.75
 U1  112.5, U 2  118.75, U 3  112.5, U 4  143.75, U 5  150,
U 6  143.75, U 7  112.5, U 8  118.75, U 9  112.5.

Now by Gauss – Seidel Method :


1   n 1
Uijn 1   U i 1, j  U in1, j  U i,nj11  Uin, j 1 
4
1
U1 n 1  100  U 2n   50  U 4n 
4
= U 3   U5   U 7 
n 1 n 1 n 1

1
U2
n 1
  U1n1  U3   100  U5  
n1 n1

4
= U8 
n 1
124

1
U4
n 1
200  U5n  U1   U 7  
n1 n 1
 
4

= U 6 
n 1

1
U5n 1   U 4n 1  U 6 n 1  U 2n 1  U 8 n 1 
4

First Iteration we get,


1
U11  100  118.75  50  143.75
4
= 103.125 .
1
U21  103.125  103.125  100  150
4
= 114.06 .
 U 2   U8   114.06
1 1

1
U41   200  150  103.125  103.125
4
= 139.06 .
 U 4   U6   139.06 .
1 1

1
U51  139.06  139.06  114.06  114.06
4
= 126.56 .
Similarly the Liebman’s iteration are given by,
Iteration U1  U3  U9  U 7 U 2  U8 U4  U6 U5

2nd 100.8 106.9 132.1 119.5


3rd 97.3 103.5 128.8 116.2
4th 95.6 101.9 126.9 114.4
5th 94.7 101.0 726 135.5
6th 94.2 100.5 125.5 113
7th 94 100.3 125.3 112.8
8th 93.9 100.2 125.2 112.7
9th 93.9 100.1 125.1 112.6

 U1  U3  U 7  U 9  93.9
U 2  U8  100
U 4  U 6  125.1
U 5  112.6 .
125

7.5 One Dimensional Heat Equation (Parabolic Equation) :


Consider a one dimensional heat equation
2 y U
2
 …… (I)
x t
with initial condition U  x, 0   f  x  and boundary conditions
U  0,t   T0 and U 1, t   T1 .
Divide xt – plane into small rectangles of size h and k in x and
t directions respectively
Let U  x, t   U  ih, jk  where i, j  0, t1, t 2, .....
We write partial derivative in equation (I) we get,
 2 y U i1, j  2U ij  U i1, j

x 2 h2
U U i , j 1  U ij
and 
t k
 From equation (I)
U  2U
  2
t x
 U  U ij  Ui 1, j  2Ui , j  U i 1, j
  ij 1 
 k  h2
k
U i , j 1  Uij  
 h2
 Ui1, j  2Ui, j  Ui1, j 
Put   k /  h 2 ….. (II)
We get,
Ui , j 1  Ui , j    Ui 1, j  2U i , j  Ui 1, j 
Ui , j 1   U i 1, j  1  2  Ui , j   U i 1, j ….. (III)
It gives formula for unknown temperature Ui , j1 at  i, j  1 when
reaming values are known. Hence the method is called explicit method. These
method is valid U <   1 2 choose k in such a way that co-efficient of U i, j in
equation (III) will become zero.
i.e. 1  2  0    1 2
put   1 2 in equation (III) we get,
126

1 k

2  h2
 h2
k
2
 Equation (III) reduce to the form
1
Ui , j 1  U i 1, j  Ui 1, j ……….
2
(IV)
This is called the Bendre Schmidt or Schmidt recurrence relation.
1
Ui , j 1  U i 1, j  Ui 1, j
2
Given the values of U at the interval points when the boundary
conditions are known.

7.6 Crank – Nicholson Difference Method :

2 y
Crank – Nicholson proposed a method in which is replaced
x 2
th
by the average of its finite difference approximation on the j th and  j  1
rows thus.
 2 y 1  U i 1, j  2Ui , j  U i 1, j U i 1 , U j 1  2U i , j 1  U i 1, j 1 
2
  2
 
x 2  h h2 
 heat equation
U  2 y
  2 can be written as
t x
U  U i , j  1  U i 1, j  2U i , j  Ui 1, j Ui 1, j 1 , 2Ui , j 1  U i 1, j 1 
  i , j 1    
 k  2  h2 h2 
k  U i 1, j  2Ui , j  U i 1, j U i 1, j 1 , 2U i , j 1  U i 1, j 1 
Ui , j 1  U i , j  2  2
 
2 h  h h2 
k
Put  
 h2
2  Ui , j 1  U i , j     Ui 1, j  2U i , j  U i 1, j  Ui 1, j 1 , 2U i , j 1  Ui 1, j 1 
 2 1    U i , j 1    U i 1, j 1  U i 1, j 1   2 1    Ui , j    U i 1, j  Ui 1, j 
….. (I)

This is known as “Crank – Nicolson” Difference formula.


This formula is convergent for all values of  .
127

To choose the value of k in such away that the co-efficient of U i, j in


equation (I) will become zero i.e.   1 .
k
1 
 h2
 k   h2
For k   h 2 equation (I) become reduce to
1
Ui , j 1   Ui 1, j  U i 1, j  U i 1, j 1  U i 1, j 1  .
4

Ex. :

2 2 U U
Solve one dimensional heat equation 
x 2 t
When 0  t  1.5 and 0xh with
initial condition
U  x, 0   50  h  x  0  x  h and the boundary conditions.
U  0, t   0 0  t  1.5
U  h, t   0 0  t  1.5
Using Schmidt method.

Soln. :

Given equation
2 2 U U

x 2 t
with heat equation we get,
  2, h  1, k  1
2
2

t
h 2

1  0.25
2k 2  2
The bender Schmidt equation
1
Ui , j 1   U i 1, j  U i 1, j 
2
U  x, 0   50  h  x  t  0.25, x  t  1
Where i  0, 1, 2, 3, 4 and j  0.25, 0.50, 0.75, 1.00, 1.25, 1.5 .

U  x, 0   50  h  x   U i , 0  50  h  i 
128

U  0, 0   0 U 1, 0   50  4  1  150
U  2, 0   50  4  1  100

U  3, 0   50  4  3  U  4, 0   50  4  4   0

Thus we can generate successfully U  x, t 

j 0 1 2 3 4
0.00 0 150 100 50 0
0.25 0 50 100 50 0
0.50 0 50 50 50 0
0.75 0 25 25 25 0
0.10 0 12.5 25 12.5 0
1.25 0 12.5 12.5 12.5 0
1.3 0 6.25 12.5 6.25 0

 U1, 1.5  6.25, U 2, 1.5  12.5, U 3, 1.5  6.25 .

 2 U U
7.7 Given One Dimensional Heat Equation  under
x 2 t
the conditions.

U  x, 0   20 for 0  x  3 and U  0, t   0
U  3, t   30 for t  0 taking h  1, k  1 and using Crank –
Nicolson method to compute ‘U’ for one formed step on.

Soln.:

Crank – Nicolson difference formula is given by

2 1    Ui , j 1    Ui 1, j 1  Ui 1, j 1   2 1    Ui , j    Ui 1, j  Ui 1, j 


………. (I)
Given that   1, h  1, k  1
k 1
  2
 2
1
h 1 1
Put   1 in equation (I) we get,
129

4 U i, j 1   Ui 1, j 1  Ui , j 1    U i 1, j  Ui 1, j 


1
 Ui , j 1   Ui 1, j  Ui 1, j  U i 1, j 1  Ui 1, j 1 
4
………. (II)
U  x, 0   20  U  ih, 0   20  U i ,0  20  i  0, 1, 2, 3
U 0, 0  20, U1, 0  20, U 2,0  20, U 3, 0  20
U  0, t   0  U  0, jk   0  U 0, j  0
 U 0, 1  0 .
U  3, t   30  U  3h, 3k   30
U 3, 1  30  U 3, 1  30 .

0 U1, i U2,1 30
J=1

20 20 20 20
J=0
y
i=0 1 2 3
130

The mesh point U11 and U 21 we need to find using equation (II)
1
 U1, 1   U 0, 0  U 2, 0.5  U 0, 1  U 2, 1 
4
1
U1, 1   20  20  0  U 2, 1 
4
4  U1, 1   40  U 2, 1
4  U1, 1   U 2, 1  40 ………. (III)

For U 2, 1
1
U 2, 1   U1, 0  U 3, 0  U1, 1  U 3, 1 
4
1
U 2, 1   20  20  U1, 1  30 
4
U 2, 1  70  U1, 1
U 2, 1  U1, 1  70 ………. (IV)

Solving equation (III) and (IV) we get,


U1, 1  15.33
U 2, 1  21.33 .

7.8 One Dimensional Wave Equation (Hyperbolic


Equation) :

 2 2 U  2 U
Consider a one dimensional wave equation  2 under the
x 2 t
boundary condition U  0, t   U, U 1, t   0 and initial conditions
U  x, 0   f  x  , U t  x , 0   g  x  .
Divide xt – plane with small rectangles of sides h and k in x and t
directions resp.
Let U  x, t   U  ih, ik  where i, j  0  1  2 . First we unite initial and
boundary conditions in difference notations.
U  0, t   0  U  0, jk   0  U 0, j  0
U   , t   0  U  nk , jk   0 where   nh
 U n ,i , j  0
131

 U  x, 0   f  x   U  ih,0   f  ih 
Ui , 0  f  ih 
U i1  U i1
Ut  x, 0   g  x    g  ih 
2k
 U U  U i , j 1 
  x, t  , i, j 1 
 t 2k 
Partial derivative of second order is given by
2U U
2
 Ui 1, j  2U ij  i 1, j 2
t h
2
U U
2
 U i , j 1  2U i, j  i, j 1 2
t k
2 2
U U
Put 2 and 2 in equation (I) we get,
x t
U  2U ij  U i1, j   Ui , j 1  2U ij  U i , j 1 
 2  i 1, j  
 h2   k2 
2 2
 k
  U i, j 1  2U ij  U i, j 1   2  U i 1, j  2U ij  U i 1, j 
h
k
Put  
h
 U i, j1  2 1   2  Ui , j   2  Ui 1, j  U i1, j  U i, j 1  ……….
(III)
This scheme is called the explicit scheme for one dimensional wave
equation.
Equation (III) is valid where 0    1 and invalid where   1.
In case of   1 we get equation (III)
Ui , j 1  Ui 1, j  U i 1, j  U i , j 1

Ex. :

Solve U xx  U tt with conditions


x 1  x 
U  x, 0   0, U 1, t   0, U  x, 0   and U  x, 0   0 taking h  0.1 and
2
k  0.1 for 0  t  0.2 .
132

Soln. :

Given equation U xx  U tt
2U 2U
i.e.  2
x 2 t
k 1  0.1
  2  1,   2  1
h 0.1
Where   1 solution of value equation is
 U i , j 1  U i 1, j  U i 1, j  U i , j 1 ………. (II)
U  0, t   U 1, t   0, U  o, j   0 and U  o, j   0
x 1  x 
U  x, 0  
2
i 1  i 
U  i, 0  
2
0.11  0.1
U  0.1, 0    0.045
2
0.2 1  0.2 
U  0.2, 0    0.08
2
Similarly we get
U  0.3, 0   0.105, 4  0.4, 0   0.12
U  0.5, 0   0.125, U  0.6, 0   0.12
U  0.7, 0   0.105
Now, U x  x, 0   0
Ui , j 1  Uij  0
for j  0  t  0  U i,1  U i, j
k
Putting j  0 in equation (I) we get,
Ui ,1  Ui 1,0  Ui 1, 0  Ui 1
2Ui ,1  Ui 1,0  Ui 1, 0  U i ,1  U i 1 
1
U i ,1   Ui 1,0  U i 1,0 
2
1
Now, for i  1 U1,1   U 0,0  U 2,0 
2
1
  0  0.80
2
 0.040 .
133

1
For i  2 U 2,1   U1,0  U3,0 
2
1
  0.045  0.105
2
 0.075 .

1
For i  3 U3,1   U 2,0  U 4, 0 
2
1
  0.08  0.120
2
 0.1 .

1
For i  4 U 4,1   U 3,0  U 5,0 
2
1
  0.105  0.125
2
 0.115 .

1
For i  5 U5,1   U 4,0  U 6, 0 
2
1
  0.12  0.12 
2
 0.12 .

1
For i  6 U 6,1   U5,0  U 7,0 
2
1
  0.125  0.105
2
 0.115 .

Putting j  2 in equation (II) we get,


Ui , 2  U i 1, 1  Ui 1  U i , 0
For i  1 U1, 2  U 0,1  U 2,1  U1,0
 0  0.075  0.045
 0.03 .
134

For i  2 U 2,2  U1,1  U 3,1  U 2,0


 0.040  0.100  0.08
 0.060 .

For i  3 U3, 2  U 2,1  U 4,1  U3,0


 0.075  0.115  0.105
 0.085 .

For i  4 U 4,2  U 3,1  U5,1  U 4,0


 0.1  0.12  0.12
 0.1 .

For i  5 U5,2  U 4,1  U 6,1  U5,0


 0.115  0.115  0.125
 0.105 .

 U1, 2  0.03, U 2,2  0.06, U3, 2  0.985, U 4, 2  0.1, U5,2  0.105 .

7.9 Review :
In this chapter we have learn,
 Classification of partial differential equation.
 Numerical methods of solving elliptic partial differential equation.
 Numerical methods by solving parabolic partial differential equations.
 Numerical methods of solving hyperbolic partial differential equations.

7.10 Unit End Exercise :

2 U 2U
1) Solve the Laplace equations   0 at the interior mesh
x 2 y 2
p + s of the square region with boundary p + s shown in fig.

0 10 20 30 40

U7 U8 U9
20 50
U4 U5 U6 60
30
U1 U2 U3
40 70

50 60 70 80 90
135

2) The temperature U in the steady heat below in a square plate


bounded by x  0, y  0, y  x  4 satisfies Laplace equation
2 U 2U
  0.
x 2 y 2

 2 U U
3) Given one – dimensional heat  under the condition
x 2 t
U  0, t   0  U 1, t  for t  0 take h  1 3 , k  1 36 and use
explicit method to compute U for one time step only.

4) Using Schmidt method find the values of U  x, t  satisfying the


4 2 U U
parabolic equation  subject to the conditions.
x 2 t

 2 U U
5) Given one – dimensional heat equation  under the
x 2 t
conditions U  x, 0   40 for 0 x3 and
U  0, t   0, U  3, t   60 for t  0 take h  1, k  1 and use Crank
Nicolson method to compute x for one time step only.

 2 U U
6) Solve by Crank Nicolson method   0  x  1 and t  0 
x 2 t
given that U  x, 0   100 x for 0  x  1 and U  0, t   0  U 1, t 
for t  0 take h  1 2 , k  1 4 and compute U for one time step
only.

6 2 U  2 U
7) Given one dimensional wave equation  2 under the
x 2 t
conditions U  0, t   0  U  5, t  and U  x, 0   x3  5 x 2 for
0  x  5 for t  0 and Ut  x, 0   0 for 0  x  5 .
136

2U 2U
8) Given hyperbolic equation  2 subject to the condition
x 2 t
U  0, t   0  U 1, t  for t  0 and Ut  x, 0   sin 3  x for 0  x  1
take h  0.25 for k  0.2 and use explicit method to compute U
for two time steps.
9) Derive the five point formula for Laplace’s equation.

10) What is Crank – Nicholson Method? Why is it known as implicit


method?

11) What is Bender – Schmidt recurrence equation? Derive the


formula.

12) Discuss the impact of size of the incremental width  t for the
time variable on the solution of a heat flow equation.



You might also like