M.Sc.-Mathematics-Numerical-Analysis
M.Sc.-Mathematics-Numerical-Analysis
M.Sc. Mathematics
SEMESTER - III (CBCS)
Published by : Director,
Institute of Distance and Open Learning ,
University of Mumbai,
Vidyanagari, Mumbai - 400 098.
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
1.2 INTRODUCTION
ii) Even if a closed integration formula exists it might still not be the most
efficient way of calculating the integral.
2
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.
f x dx ~ f a b a
a
y
y=f(x)
y1 y2 yi yn
x0 x0 + n x0 + ih x0 + nh x
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
x0 nh 2
n n 2n 3 2 n n 2 3
f x dx nh y0 y0 y0 y0 ....
x0 2 12 2n
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 ... yn1
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
ba
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
by trapezoidal rule
b h
a f x dx 2 y0 yn 2 y1 y2 ..... yn1
0.2
1 1.1755 2 1.0857 1.1448 1.790 1.1891
2
0.1 2.1755 2 4.5986
6
Ex.3 :
1 dx
Evaluate 1 x 2
by trapezoidal rule.
0
Soln :
Here a = 0, b = 1, n = 5
b a 1 0
h 0.2
n 5
1
f x
1 x2
by trapezoidal rule
b h
a f x dx 2 y0 yn 2 y1 y2 ..... yn1
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
y y = f (x)
y1 = f (x)
A1 A2
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
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
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 xn1
12
Choose f 111 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 :
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
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
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
ba 83
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
b h
f x dx 3 y
a
0 y1 4 y1 y3 ..... yn1 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 :
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
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
fi
fi+ 1 fi + 2
xi xi + 1 xi + 2
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
h
f x0 4 f x0 h f x0 2 h
3
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
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 An2 f xn 2
n 2 90
E E1 E2 ..... En 1
h5
f II x0 f IV x2 ..... f IV xn 2
90
Choose fIV
1
M ax f IV
x0
, f IV
x2
, ....., f x
n2
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.
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
xn3 f x dx 8 yn3 3 yn2 3 yn1 yn
[where n is divisible by 3]
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 ..... yn3 3 yn 2 3 yn1 yn
8
3h
y0 yn 3( y1 y2 y4 y5 ..... yn2 yn 1 2 y3 y6 y9 ..... yn3
8
b
Working of Simpson’s (3/8)th rule for f x dx
a
14
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
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
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 a0 b 0.6 n6
b a 0.6 0
h 0.1
n 6
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 .
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
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)
Similarly
x6 3 5 IV
f x dx A3 h f x3
x3 80
.
.
.
xn 3 5 IV
f x dx An3 h f xn 3
xn 3 80
3h5
Total error = f x0 f IV x3 ..... f IV xn3
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 ..... yn1 2 y2 y4 ..... yn 2
v0 3
ba
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
Soln :
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.
v0 nh 3h
f v dt
y0 yn 3 y1 y2 y4 y5 ..... 2 y3 y6 .....
v0 8
ba
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) :
Soln :
Distance (S) : 1 2 3 4 5 6 7 8 9
Area (A) : 472 398 302 198 116 60 34 12 04
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.
Example :
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 :
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 :
2.2 Introduction :
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
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
h I
4 I 23 I12 0.698
1 0.75 I12 4 I 2 I1 / 3 0.6944 I123
3 4 I123 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 b2 hba202
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
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
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
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.
a1 f x1 a2 f x2 ……….. (I)
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
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
Such that a m c
bmc
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, b5
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
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 t3
1
2
1
g t dt
1
1
g t
t 3
Ex. 2 :
f x, y dx dy f x, y dx dy
R c a
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
yj2
I xi 2 f x, y dx dy
yj xi
Apply trapezoidal rules inner integration.
yj2 h
I f xi , y 2 f xi 1 , y f xi2 , y dy
yj 2
32
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 h2 x : 3, 5, 7
k2 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
f i 2, j
2 f i 2, j 1 f i 2, j 2
22
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
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
i1 j 1 i1 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
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
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 :
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
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 :
3.2 Introduction :
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
E E E
0, 0, ....., 0
a0 a1 ak
, y n)
( xn
yn Pn
y0
yk(axk +b)
P3
P1 P5
P2
xk xh
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*
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
Soln :
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
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
Case i) :
The procedure of fitting a straight line by the method of least square for
odd numbers may be simplified as follows :
xM
x
h
Case ii) :
x M
x2
h
Ex :
Fit a straight line y ax b to the following data :.
Soln :
xM
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
xy 117
a 4.1786
x2 28
y 171
b 24.4286
h 7
y ax b
y 4.1786 x 24.4286
x 2013
y 4.1786 24.4286
1
y 4.1786 x 8387.0932
43
Ex. :
Soln :
2013 2014
2013.5
2
h 1year
x 2 x 2013.5 /1
y 6 x 12036.33
Where x 2020 then
y 6 2020 12036.33
y 83.67 tones.
P x ax 2 bx c …. (I)
yk ax 2 k bxk c
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 axi4 bxi3 cxi2 ………. (II)
i 1
45
E
0
b
n
2 yi axi2 bxi c xi 0
i 1
n n n n
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*
y P x a * x 2 b * x c*
Ex. :
x 3 1 0 2 4
y 8 3 3 8 11
Soln :
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
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 1xim1 ..... a1 x a0
i 1
E E E
If 0, 0, ....., 0
am am 1 a0
n
E
Now 2 yi am xim am1xim1 ..... a1x a0 1 0
a0 i 1
n n
Similarly
E
0
a1
n
.
.
.
E
0 we get
am
n
x i
m
yi a0 xim a1xim 1 ..... amxi2 m
i 1
Solve the normal equation with the help of given data and we obtain
am am* , am1 am1* , am2 am2* , ......, a1 a * , a0 a0* .
Ex. :
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
y nA bx
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
3.8 Review :
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
x 2 1 1.5 1
6 3
iv)
y 1 5 2 2
6 3
x 5 3 0 8 5
i)
y 11 8 2 0 4
x 10 20 30 40 50
y 8 10 15 21 30
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
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 :
4.2 Introduction :
b
i.e. w x 0
a
Ex. :
Soln :
b 2
E w x y p x dx
a
1 2
2
1 x a a x dx
0 1
0
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
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
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
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
nk
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 i0
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
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. :
Soln :
f 0* x 1
here f 0* x 1 P0 x
57
Where a20
1 x 2 1 dx
1
x 3 1
3
0 1 12 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
x 2 1/ 3 x 1/ 2
f 2* x x 2 x 1/ 6 P2 x
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
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.
2) Tn x 1 for x 1, 1 .
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
Ex. :
Soln :
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.
Ex. :
Soln :
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
Soln :
x 0 1 , x 1 i 1 , x 2 1 , x 3 i 1
2 2 2 2
1
F41 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
F41 x k 2 i 2 e e i e 3 k /2
2 2 2
where k = 0, 1, 2, 3
1 1 1
F41 x 0 i 1/ 2 O 0 e0 i 1/ 2 e0
2 2 2
1 1 1 1 1
F41 x 0 i i
2 2 2 2 2
F41 x 0 0
F41 x 0 0
1 1 1
F41 x 1 i 1/ 2 ei /2 ei i 1/ 2 e3 /2
2 2 2
1 1 1 1 1
F41 x 1 2 i 2 i 2 1 i 2 i
2
F41 x 1 1
F41 x 1 1
65
1 1 1
F41 x 2 i 1/ 2 e i e2 i i 1/ 2 e3 i
2 2 2
1 1 1 1 1
F41 x 2 2 i 2 1 2 1 i 2 1
2
1 1 1 1 1
F41 x 2 i i
2 2 2 2 2
F41 x 2 1
F41 x 2 1
1 1 1
F41 x 3 i 1/ 2 e3i /2 e3i i 1/ 2 e3i /2
2 2 2
1 1 1 1 1
F41 x 3 2 1 2 i 2 1 i 2 i
2
1 1 1 1 1
F41 x 3 1 1
2 2 2 2 2
F41 x 3 1
F41 x 3 1
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
2 j 1 2 j
x2 j 1 x2 j
n n n n
n 1
1 ik 2 j / N
aˆk
N
a e
j0
j k 0, 1, ....., N 1
n 1
a j aˆk eik 2 j / N J = 0, 1, ....., N-1
k 0
4.8 Review :
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
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
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
x 5, 1 i , 1, i 1 .
1
12) Prove that x 2 T0 x T2 x .
2
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
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
5 2 3 9 4
y 0.1 1 0.1 0.1 2 0.1 0.1 .....
2 4
y 0.1 1.127225 .
72
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 i1 i
x x i1 i
x x ..... xi1 xi
1! 2! m!
we get
h I h 2 II hm m
y xi 1 y xi y xi y xi ..... y xi
1! 2! m!
dy
Consider the differential equation f x, y ………. (I)
dx
with initial condition x x0 , y y0 .
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
x0
x0
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. :
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
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 106
75
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
Soln. :
Taking n 0, y1 y0 h f x0 , y0
Put x0 1, y0 2
2
f x0 , y0 f 1, 2 31 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 .
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 .
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 y11 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 y11 the k 1 approximation to
y1 is
h
y1k 1 y0 f x0 , y0 f x1 , y1k
2
In general
79
h
ynk11 yn f xn , yn f xn1 , yn1
2
Where ynk1 yn h f xn , y n [by Euler formula]
Ex. :
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 2 nd approximation :
f x1 , y1 f 0.1, 1.11 1.21
y2 y1 h f x1 , y1
1.11 0.11.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 .
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.
dy
Consider a differential equation f x, y …. (I)
dx
with initial condition y x0 y0 .
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
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 :
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. :
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 31 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
Ex. 2 :
Soln. :
2
f x0 , y0 f 1, 1 1 1 0
k1 h f x0 , y0 0.1 0 0
2
f x0 h , y0k 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
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:
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
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.
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 :
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. :
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 .
2 3
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. :
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 .
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 .
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 .
Ex. :
Soln. :
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
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 .
dy
x0
f x, y dy
x0
x4
yn y 0 f x, y dx
x0
………. (II)
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 8f 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.
y2 y0 f x, y dx
x0
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 nf 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
Ex. :
Soln.:
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 .
2
1 1.0238
2.0482 .
0.2
y4 C 1.1787 1.787 4 1.4679 2.0482
3
1.7853 .
0.2
y4 C 1.787 1.1787 4 1.4679 4.1873
3
1.9278 .
100
0.2
y4 C 1.787 1.1787 4 1.4679 4.7164
3
1.9631 .
Note :
y1 y0 f x, y dx
x2
……… (II)
n n 1 2
f x, y f x0 , y0 nf 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 nf 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 y11 37 y21 9 y13
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 yn11 37 yn12 9 yn13
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)
n n 1 2 n n 1 n 2 3
f x, y f1 nf1 f1 f1 .....
2! 3!
where n x x1 h
x1
n n 1 2 n n 1 n 2 2
y1 y0 f1 nf1 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 nf1 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 y12
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. :
Soln. :
22
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 .
Etc y yn 1
c
Etc 28 Etc yn 1 yn 1
c p
29 Etc yn 1 yn 1
c p
yn1 c yn1 p
Etc
29
If the answer is required to a precision of a decimal digits then
yn1 c yn1 p
Etc 0.5 10 d
29
yn1 c yn1 p 29 0.5 10 d 15 10 d
Similarly for Adams – Bashfourth method we get,
270
yn1 c yn1 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.
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
c0
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 .
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 eh 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
Case I :
Case II :
is purely imaginary
2
k 1 h 1 i2h 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 i2 h 1
1 1h i2 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
()
6.11 Review
In this chapter we have learn
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.
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.
______________________
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
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
y Grid point
x
0
116
U i , j 1 2U i , j U i , j 1
Uyy O k 2
k2
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,
Ui 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
Ui1, j 2Ui , j U i 1, j Ui , j 1 2U i , j U i , j 1 0
1
U i1, 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 :
E(i,j)
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
Uni, 1j U in1,1 j Uin1, j U in, j11 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
n1
10 10 U 2n U1
n
4
1
U2n 1 20 20 U1 n1 U3 n
4
1
U3 10 10 U1 n 1 U3 n 1
4
1
U4n1 20 20 U1 n1 U 3 n1
4
We use SFPF
1
Uij U i1, j U i 1, j U i , j 1 U i , j 1
4
and DFPF as
1
U i1, 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
U11 10 0 10 0 5
4
1
U2 20 0 20 5 11.25
2
4
1
U31 10 11.25 10 0 7.8125
4
121
1
U4
1
20 7.8125 20 5 13.20
4
Second Iteration :
1
U1
2
10 10 11.25 13.20 11.1125
4
1
U22 20 20 11.1125 7.8125 14.73
4
1
U32 10 10 14.73 13.20 11.98
4
1
U42 20 20 11.1125 11.98 15.77
4
Third Iteration :
1
U1 3 10 10 14.73 15.77 12.63
4
1
U23 20 20 12.63 11.98 16.15
4
1
U3
3
10 10 16.15 15.77 12.98
4
1
U43 20 20 12.63 12.98 16.40
4
Fourth Iteration :
1
U1
4
10 10 16.15 16.40 13.14
4
1
U24 20 20 13.14 12.98 16.53
4
1
U34 10 10 16.53 16.40 13.23
4
1
U44 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
U25 20 20 13.28 13.23 16.63
4
1
U35 10 10 16.63 16.59 13.31
4
1
U4
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
U2 20 20 13.32 13.31 16.66
6
4
6 1
U3 10 10 16.67 16.65 13.33
4
1
U46 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. :
1
U2
n 1
U1n1 U3 100 U5
n1 n1
4
= U8
n 1
124
1
U4
n 1
200 U5n U1 U 7
n1 n 1
4
= U 6
n 1
1
U5n 1 U 4n 1 U 6 n 1 U 2n 1 U 8 n 1
4
1
U41 200 150 103.125 103.125
4
= 139.06 .
U 4 U6 139.06 .
1 1
1
U51 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
U1 U3 U 7 U 9 93.9
U 2 U8 100
U 4 U 6 125.1
U 5 112.6 .
125
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.
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)
Ex. :
2 2 U U
Solve one dimensional heat equation
x 2 t
When 0 t 1.5 and 0xh 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
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
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.:
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)
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 i1 U i1
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 i1, 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, j1 2 1 2 Ui , j 2 Ui 1, j U i1, 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. :
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.11 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 .
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.
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 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.
2 U U
5) Given one – dimensional heat equation under the
x 2 t
conditions U x, 0 40 for 0 x3 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.
12) Discuss the impact of size of the incremental width t for the
time variable on the solution of a heat flow equation.