NM Assignment Solution

Download as pdf or txt
Download as pdf or txt
You are on page 1of 146

NUMERICAL METHOD

[MTH 317]
Civil ’A’ [IV Semester]

9/5/2021
Submitted to:
Hem Raj Pandey
POKHARA UNIVERSITY
SCHOOL OF ENGINEERING
Contents
1 Chapter-1 ........................................................................................................ 3
1.1 Solution Of Non-Linear Equation .............................................................. 3
2 Chapter-2 ...................................................................................................... 17
2.1 LaGrange’s and Newton’s Interpolation .................................................. 17
2.2 Cubic Spline Interpolation ....................................................................... 25
2.3 LEAST SQUARE CURVE FITTING: ............................................................... 30
3 Chapter-3 ...................................................................................................... 39
3.1 NUMERICAL DIFFERENTIATION AND INTEGRATION ................................. 39
3.2 Numerical differentiation and integration ............................................... 55
4 Chapter-4 ...................................................................................................... 75
SOLUTION OF SYSTEM OF LINEAR EQUATIONS: ................................................ 75
4.1 Direct method: (A) Gauss elimination method ........................................ 75
4.2 Direct Method: (B) Cholesky’s (LU Decomposition) Method:................... 79
4.3 Direct Method: (C) Gauss Jordan Method: .............................................. 83
4.4 Indirect (Iterative) Method for solving system of linear equation............ 86
4.5 MATRIX INVERSION PROBLEM ................................................................. 89
4.6 Eigen values, Eigen vectors and Power method problems ....................... 94
4.7 Matrix Problems ...................................................................................... 99
5 Chapter-5 .................................................................................................... 104
5.1 One Step Methods to solve first order initial value Problems ................ 104
5.2 Higher Order initial value Problems ....................................................... 116
5.3 Shooting Methods: boundary Value Problems ...................................... 123
6 Chapter-6 .................................................................................................... 130
6.1 SOLUTION OF PARTIAL DIFFERENTIAL EQUATION ................................. 130
1 Chapter-1
1.1 Solution Of Non-Linear Equation
1.a)

Using bisection method, Determine one root of the equation sin(x)+x-1=0 within an
accuracy of 0.001. Solve the same problem by Regula Falsi using same starting value.
Compare the number of iterations required to achieved the desired result. Plot the iteration
vs absolute error for each method.

⇒Solution
Given equation is
F(x)= sin(x)+x-1
F(0)= -1
F(1)= 0.84
F(0) *F(1)<0
Therefore, the root lies between 0 and 1
So, initial guess is
a=0 and b=1 Error= 0.001
Bisection Method
No. of iteration, n= [log(b-a)-logE]/log2 = [log(1-0)-log(0.001)]/log2=9.96~10
We have
Bisection Formula is Xn = (a+b)/2 = (0+1)/2 = 0.5
F(xn)= -0.025
Therefore, root lies between 0.5 and 1
Likewise, calculating other root by tabulation method,
Iteration a B xn F(xn)
1. 0 1 0.5 -0.0205 (-ve)
2. 0.5 1 0.75 0.4316 (+ve)
3. 0.5 0.75 0.625 0.2100 (+ve)
4. 0.5 0.625 0.5625 0.0958 (+ve)
5. 0.5 0.5625 0.5312 0.0377 (+ve)
6. 0.5 0.5312 0.5156 0.0086 (+ve)
7. 0.5 0.5156 0.5078 -0.0059 (-ve)
8. 0.5078 0.5156 0.5117 0.0013 (+ve)
9. 0.5078 0.5117 0.5097 -0.0023 (-ve)
10. 0.5097 0.5117 0.5107 0.0005 (-ve)

Hence root is 0.5107 which is correct upto two decimal place.


Measured value of root= 0.5107
Error= -0.0005
Actual Value= 0.5107+ 0.0005 = 0.5112
We know the formula,
𝐴𝑐𝑡𝑢𝑎𝑙 𝑉𝑎𝑙𝑢𝑒−𝑀𝑒𝑎𝑠𝑢𝑟𝑒𝑑 𝑉𝑎𝑙𝑢𝑒
Relative Error = | |
𝐴𝑐𝑡𝑢𝑎𝑙 𝑉𝑎𝑙𝑢𝑒
0.5107−0.5112
Absolute error =▕ ▕= 0.000979
0.5107

Regula Falsi Method


By Regula Falsi formula,
Xn= [af(b)-bf(a)]/[f(b)-f(a)]
=0.5430
Likewise calculating the other values of root in tabular form.
Iteration A B f(a) f(b) xn f(xn)
1 0 1 -1 0.8414 0.5430 0.0597
2 0 0.5430 -1 0.0597 0.5124 0.00267
3 0 0.5124 -1 0.00267 0.5110 0.0000497
4 0 0.5110 -1 0.0000497 0.5109 -0.000137

5 0.5109 0.5110 -0.000137 0.0000497 0.5109 END

Hence root of the equation is 0.5109 which is correct upto two decimal place.
Measured Value of root= 0.5109
Error= -0.000137
Actual value= 0.5109+0.000137 = 0.511037
𝐴𝑐𝑡𝑢𝑎𝑙 𝑉𝑎𝑙𝑢𝑒−𝑀𝑒𝑎𝑠𝑢𝑟𝑒𝑑 𝑉𝑎𝑙𝑢𝑒
Relative Error = | |
𝐴𝑐𝑡𝑢𝑎𝑙 𝑉𝑎𝑙𝑢𝑒
0.5109−0.511037
Relative Error=▕ ▕ = 0.000268
0.5109

Secant Method
By secant formula,
Xn= [af(b)-bf(a)]/[f(b)-f(a)]
= [0-1*(-1)]/[0.8414-(-1)]
=0.5430
Likewise calculating the other value of root using tabulation method.
Iteration a B f(a) f(b) xn f(xn)
1 0 1 -1 0.8414 0.5430 0.0597
2 1 0.5430 0.8414 0.0597 0.5080 -0.0055
3 0.5430 0.5080 0.0597 -0.0055 0.5109 -0.0001
4 0.5080 0.5109 -0.0055 -0.0001 0.5109 END
Hence Root of the equation is 0.5109 upto two decimal.

Measured Value of root= 0.5109


Error= -0.0001
Actual Value= 0.5109+0.0001 = 0.511
0.5109−0.511
Relative Error=▕ ▕
0.5109

= 0.000195

1.b)
Find the real root of an equation xlog10(x)=4.7724 by Newton-Raphson method upto six
decimal correctly. Approximate the initial guess yourself.
⇒Solution,
Here,
Given equation is
f(x): xlog10(x)-4.7724
f’(x): log10(x)+log10e
let initial guess be:
f(1)= -4.7724
f(2)= -4.1703
f(3)= -3.34
f(4)= -2.3641
f(5)= -1.277
f(6)= -0.103
f(7)= 1.1432
f(6)*f(7)<0,
So the root lies between 6 and 7.
Let us take initial guess x0 =6 And using Newton-Raphson formula
𝑓(𝑥𝑛)
𝑥𝑛+1 = 𝑥𝑛 −
𝑓′(𝑥𝑛)
The further process is as follows:
Iteration X0 𝑓𝑥
X1= x0 - 𝑓′𝑥

1. 6 −0.103
6 - 1.212 = 6.085358

2. 6.085358 6.085143
3. 6.085143 6.085143

Here x3=x4 , so the root of the given equation is 6.085143 which is correct upto six decimal.

2.a)
Using newton Raphson method , find all the root of the equation, x=e-x with six correct
decimal.
⇒Solution
Here,
Function, f(x)= x-e-x
f’(x)=1+e-x
from newton Raphson formula,
𝑓(𝑥𝑛)
xn+1 = xn-𝑓′(𝑥𝑛)

Now,
f(0)=-1
f(1) = 0.63212
f(0)*f(1)<0 so, root lies between 0 and 1.
Let initial approximation x0= 0

Using Newton Raphson formula and filling the table


Iteration xn Xn+1
1. 0 0.5
2. 0.5 0.56631
3. 0.56631 0.56714
4. 0.56714 0.56714

Since value of root on iteration 3 and 4 are same.


So root of the equation is 0.56714.

2.b)
Find one of the roots of the equation x3 - 4x – 1 = 0 by fixed point iteration and bisection
methods. Carry up to 8 iterations and discuss the relative errors associated with each
method.
Solution:
By iteration method:
f(x) = x3 - 4x – 1
f(2) = -1
f(3) = 14
Since f(2) and f(3) have opposite signs. A root lies between 2 & 3. Now, rearranging the given
equation. We get,
x3 - 4x – 1 = 0
or, x3 = 4x + 1
3
or, x = √4𝑥 + 1
3
Ø(x) = √4𝑥 + 1
For fixed point iteration
3
X1 = Ø (x0) = √4 ∗ 3 + 1 = 2.3513
3
X2 = Ø (x1) = √4 ∗ 2.35133 + 1 = 2.1831
3
X3 = Ø (x2) = √4 ∗ 2.183155 + 1 = 2.1350
3
X4 = Ø (x3) = √4 ∗ 2.13505 + 1 = 2.1208
3
X5 = Ø (x4) = √4 ∗ 2.12089 + 1 = 2.1166
3
X6 = Ø (x5) = √4 ∗ 2.11668 + 1 = 2.1154
3
X7 = Ø (x6) =√4 ∗ 2.11543 + 1 = 2.1150
3
X8 = Ø (x7) =√4 ∗ 2.11506 + 1 = 2.1149
Hence x7 = x8
So, root = 2.1149
Error:
Measured Value = x3 -4x -1
= 2.11433 – 4 * 2.1143 - 1
= -0.000071
Actual Value = 2.1149 + 0.000071 = 2.11497
𝐴𝑐𝑡𝑢𝑎𝑙 𝑉𝑎𝑙𝑢𝑒−𝑀𝑒𝑎𝑠𝑢𝑟𝑒𝑑 𝑉𝑎𝑙𝑢𝑒
Relative Error = | |
𝐴𝑐𝑡𝑢𝑎𝑙 𝑉𝑎𝑙𝑢𝑒

By Bisection Method:
Here,
f(x) = x3 – 4x – 1
f(2) = -1 < 0
f(2.5) = 4.625 > 0
so, root lies between 2 and 2.5
so, a = 2
b = 2.5
2+2.5
c= 2

= 2.25
f(c) = 1.3306
so, root lies between 2 & 2.25.
N a b c f(c)
1 2 2.5 2.25 1.390671
2 2 2.25 2.125 0.0957
3 2 2.125 2.0625 -0.9767
4 2.0625 2.125 2.09375 -0.19644
5 2.09375 2.125 2.109375 -0.05191
6 2.109375 2.125 2.1171875 0.07150
7 2.109375 2.1171875 2.11328125 -0.0157
8 2.11328125 2.1171875 2.115234 end

Hence, root = 2.1157 correct up to 3 decimal place.

4.Use Newton Raphson and Fixed Point Iteration methods to find the smallest root of the
equation e-x – sinx. Carry up to 6 iterations using the same starting value and compare the
absolute errors.
Solution:
By fixed point iteration method,
f(x) = e-x – sinx
or, e-x – sinx = 0
x = sin−1 (e–x)
By iteration formula,
Xn+1 = Ø(xn)
Let xo be the initial approximation to the root,
Then, x1 = Ø(x0)
Or, x1 = sin−1(e–0.5) = 0.6516
Now,
X2 =Ø(x1)
= sin−1 (e–0.6516) = 0.5482
X3 =Ø(x2)
= sin−1 (e–0.5482) = 0.6162
X4 =Ø(x3)
= sin−1 (e–0.6162) = 0.5703
X5 =Ø(x4)
= sin−1 (e–0.5703) = 0.600
X6 =Ø(x5)
= sin−1 (e–0.600) = 0.5804
Hence, from sixth iteration the root is 0.5804.
0.5885−0.5804
Absolute error = | | * 100%
0.5885

= 1.38%
By Newton Raphson Method
f(x) = e-x – sinx
f’(x) = -e-x – cosx
We know,
Newton Raphson Formula is,
f(xn)
Xn+1 = xn – f’ (xn)

𝑒 −𝑥𝑛 − 𝑠𝑖𝑛𝑥
= xn - −𝑒 −𝑥𝑛−𝑐𝑜𝑠𝑥𝑛
𝑛

Put n=0,
𝑒 −𝑥𝑜 − 𝑠𝑖𝑛𝑥
X1 = x0 - - −𝑒 −𝑥0−𝑐𝑜𝑠𝑥0
0

Here, initial approximation


X0 = 0.5
𝑒 −0.5 − 𝑠𝑖𝑛0.5
X1 = 0.5 - −𝑒 −0.5−𝑐𝑜𝑠0.5

=0.58564
𝑒 −0.5856 − sin (0.5856)
X2 = 0.5856 - −𝑒 −0.5856 −cos (0.5856)

=0.588529
𝑒 −0.588529 − sin (0.588529)
X3 = 0.588529 - −𝑒 −0.588529 −cos (0.588529)

=0.58853
𝑒 −0.58853 − sin (0.58853)
X4 = 0.58853 - −𝑒 −0.58853 −cos (0.58853)

=0.58853
𝑒 −0.58853 − sin (0.58853)
X5 = 0.58853 - −𝑒 −0.58853 −cos (0.58853)

= 0.58853
X5 = x4 = 0.58853
The root is 0.58853.
The absolute error of the given solution is 0%.

5. Calculate the root of √𝟏𝟑 to six decimals accuracy by Newton Rhapson method.
Solution:
Let x be the root of √13 then,
𝑥 = √13
𝑥 2 = 13
𝑥 2 − 13 = 0 --------------------------- (i)
i.e.𝑓(𝑥) = 𝑥 2 − 13
𝑓′(𝑥) = 2𝑥
Using Newton Rhapson formula,
𝑓(𝑥)
𝑥𝑛+1 = 𝑥𝑛 − 𝑓′(𝑥) ------------------------ (ii)

Now,
𝑓(3) = −4 < 0 , 𝑓(4) = 3 > 0
So the root lies between 3 and 4.
From equation (ii) Put
𝑥𝑛 2 − 13
𝑥𝑛+1 = 𝑥𝑛 −
2𝑥𝑛
Put n=0
𝑥0 2 − 13
𝑥1 = 𝑥0 −
2𝑥0
Let the initial approximation 𝑥0 be 3,
i.e. 𝑥0 = 3
32 − 13
𝑥1 = 3 − = 𝑥1 = 3.67
2∗3
(3.67)2 − 13
𝑥2 = 3.67 − = 𝑥2 = 3.606
2 ∗ 3.67
(3.606)2 − 13
𝑥3 = 3.606 − = 𝑥3 = 3.60555
2 ∗ 3.606
(3.60555)2 − 13
𝑥4 = 3.60555 − = 𝑥4 = 3.605551
2 ∗ 3.60555
Hence, the root of the given equation is 3.605551, which is correct for six decimal places.

6. Find all the possible roots of the equation 𝒙𝟑 − 𝟑𝒙𝟐 + 𝟕𝒙 − 𝟖 = 𝟎to three decimal places
by Regula Falsi and Bisection Method.
Solution:
Given function,
𝑓(𝑥) = 𝑥 3 − 3𝑥 2 + 7𝑥 − 8
Here,
𝑓(1) = −3 < 0
𝑓(2) = 2 > 0
Hence, the root of the given function lies between 1 and 2.
‫؞‬a=1, b=2
We have,
Bisection formula
𝑎+𝑏 1+2
𝑥𝑛= = = 1.5
2 2

Calculation of roots by tabulation method:


Iteration(n) a b 𝑥𝑛 𝑓(𝑥𝑛 )
1 1 2 1.5 −0.875
2 1.5 2 1.75 0.425
3 1.5 1.75 1.625 −0.255
4 1.625 1.75 1.6875 0.07
5 1.625 1.6875 1.65625 −0.092
6 1.65625 1.6875 1.671875 −9.2 ∗ 10−3
7 1.671875 1.6875 1.6796875 0.0327
8 1.671875 1.6796875 1.67578125 0.011
9 1.671875 1.67578125 1.673828125 1.2602
10 1.671875 1.673828125 1.673851563 END

Hence, the root is 1.673 which is correct for three decimal places.
Regula-Falsi method
𝑓(𝑥) = 𝑥 3 − 3𝑥 2 + 7𝑥 − 8
𝑓(1) = −3 < 0 ,
𝑓(2) = 2 > 0
‫؞‬a=1, b=2

Hence, the root lies between 1 and 2.

By Regula false formula,


𝑎𝑓(𝑏) − 𝑏𝑓(𝑎)
𝑥𝑛 =
𝑓(𝑏) − 𝑓(𝑎)
1 ∗ 2 − 2 ∗ (−3)
𝑥𝑛 = = 1.6
2 − (−3)

Likewise, calculating the other values of root in tabular form,


Iteration(n) a b 𝑓(𝑎) 𝑓(𝑏) 𝑥𝑛 𝑓(𝑥𝑛 )
1 1 2 −3 2 1.6 −0.384
2 1.6 2 −0.384 2 1.6644 −0.0489
3 1.6644 2 −0.0489 2 1.67241 −6.2919 ∗ 10−3

4 1.67291 2 −6.291 ∗ 10−3 2 1.67343 −8.346 ∗ 10−4

5 1.67343 2 −8.346 ∗ 10−4 2 1.67356 END

Hence, the root of the given function is 1.673 which is correct for three decimal places.

7. Find where the graphs of 𝒚 = 𝒙 − 𝟑 and 𝒚 = 𝒍𝒏𝒙 intersect with bisection


method. Get the intersection value correct to four decimal places.
Solution:
Given equation,
𝑦 = 𝑥 − 3 -------------------------------- (i)
𝑦 = 𝑙𝑛𝑥 -------------------------------- (ii)
From (i) and (ii)
𝑙𝑛𝑥 = 𝑥 − 3 , 𝑙𝑛𝑥 − 𝑥 + 3 = 0
𝑓(𝑥) = 𝑙𝑛𝑥 − 𝑥 + 3 ------------------- (iii)
This is the function to the given line, then,
𝑓(4) = ln(4) − 4 + 3
= 0.3862 > 0
𝑓(5) = ln(5) − 5 + 3
= −0.39056 < 0
Hence, the root of the given function lies between 4 and 5.
We have,
Bisection formula
𝑎+𝑏 5+4
𝑥𝑛 = = = 4.5
2 2
Calculation of values of root in tabular form
Iteration(n) a b 𝑥𝑛 𝑓(𝑥𝑛 )
1 5 4 4.5 4.077∗ 10−7
2 5 4.5 4.75 −0.1918
3 4.75 4.5 4.625 −0.043
4 4.625 4.5 4.5625 −0.0446
5 4.5625 4.5 4.53125 −0.0202
6 4.53125 4.5 4.515625 −8.081 ∗ 10−7
7 4.515625 4.5 4.5078125 −2 ∗ 10−3
8 4.5078125 4.5 4.50390625 1.038 ∗ 10−3
9 4.5078125 4.50390625 4.505859375 −4.807 ∗ 10−4
10 4.505859375 4.50390625 4.504882813 2.79 ∗ 10−4
11 4.505859375 4.504882813 4.505371094 −1 ∗ 10−4
12 4.505371094 4.504882813 4.505126954 8.911 ∗ 10−5
13 4.505371094 4.505126954 4.505249024 −5.85 ∗ 10−6
14 4.505249024 4.505126954 4.505187989 4.163 ∗ 10−5
15 4.505249024 4.505187989 4.505218507 1.788 ∗ 10−5
16 4.505249024 4.505218507 4.505233766 END

Hence, the required root of the given function is 𝑥 = 4.5052.


Also,
𝑦 = ln(4.5052) = 1.5052
Hence, the graphs of equation (i) and (ii) intersect at the point,
(𝑥, 𝑦) = (4.5052, 1.5052)
2 Chapter-2
2.1 LaGrange’s and Newton’s Interpolation

1. Use Lagrange’s method to find the form of f(x) from the following data .Use the f(x)
so generated to convert the table into equi-spaced data table with constant spacing
of 1.

x 1 2 4
F(x) 1 27 64
Solution:
Here,
x0 = 1 y0=1
x1 = 2 y1=27
x2 = 4 y2=64

(𝑥−𝑥1 )(𝑥−𝑥2 ) (𝑥−𝑥0 )(𝑥−𝑥2 ) (𝑥−𝑥0 )(𝑥−𝑥1 )


f(x) = 𝑦
(𝑥𝑜 −𝑥1 )(𝑥0 −𝑥2 ) 0
+ 𝑦
(𝑥1 −𝑥0 )(𝑥1 −𝑥2 ) 1
+ 𝑦
(𝑥2 −𝑥0 )(𝑥2 −𝑥1 ) 2

(𝑥−2)(𝑥−4) (𝑥−1)(𝑥−4) (𝑥−1)(𝑥−2)


= 1+ 27 + 64
(1−2)(1−4) (2−1)(2−4) (4−1)(4−2)

1 27 32
= [𝑥 2 − 4𝑥 − 2𝑥 + 8] − [𝑥 2 − 𝑥 − 4𝑥 + 4] + [𝑥 2 − 2𝑥 + 2]
3 2 3

2(𝑥 2 −6𝑥+8)−81(𝑥 2 −5𝑥+4)+64(𝑥 2 −3𝑥+2)


= 6

2𝑥 2 −12𝑥+16−81𝑥 2 +405𝑥−324+64𝑥 2 −192𝑥+128


= 6
1
= 6 (−15𝑥 2 + 201𝑥 − 180)

= −2.5𝑥 2 + 33.5𝑥 − 30

For, x=3
f (3) = -2.5× 32 +33.5× 3 − 30
= 48
Equi-spaced data table
x 1 2 3 4
F(x) 1 27 48 64

2. Given f (0) =1, f (1) =12, f (2) =15, f (4) =6, f (5) =7, f (6) =19, find the interpolating
polynomial that passes through all the given points using Lagrange's method.

Solution
Given,
f(0)=1,
f(1)=12,
f(2)=15,
f(4)=6,
f(5)=7,
f(6)=19.
Now,
Using Lagrange's method;
(x−1)(x−2)(x−4)(x−5)(x−6 (x−0)(x−2)(x−4)(x−5)(x−6)
F(x)=(0−1)(0−2)(0−4)(0−5)(0−6) 1 + (1−0)(1−2)(1−4)(1−5)(1−6) 12 +

(x−1)(x−0)(x−4)(x−5)(x−6) (x−1)(x−2)(x−0)(x−5)(x−6)
15 + (4−1)(4−2)(4−0)(4−5)(4−6) 6 +
(2−1)(2−0)(2−4)(2−5)(2−6)

(x−1)(x−2)(x−4)(x−0)(x−6) (x−1)(x−2)(x−4)(x−5)(x−0)
7 + (6−1)(6−2)(6−4)(6−5)(6−0) 19
5−1)(5−2)(5−4)(5−0)(5−6)

7 59 521 13 269
=− × 𝑥5 + × 𝑥5 − × 𝑥3 − × 𝑥2 + ×𝑥+1
240 120 240 15 20

…..
[NOT COMPLETE]……
3. Using Lagrange’s formula find 𝒙(𝟒𝟓) from the data given below:

X 10 15 25 35

Y 43 29 32 78

Let,
x0=10 x1=15 x2=25 x3=35
y0=10 y1=29 y2=25 y3=35

Using Lagrange’s formula,


( 𝑦−𝑦1 )(𝑦−𝑦2 )(𝑦−𝑦3 ) ( 𝑦−𝑦 )(𝑦−𝑦 )(𝑦−𝑦 )
X=f(y) = f (45) = (𝑦0 −𝑦1 )(𝑦0 −𝑦2 )(𝑦0 −𝑦3 )
× 𝑥0 + (𝑦 −𝑦 0)(𝑦 −𝑦2 )(𝑦 −𝑦3 ) × 𝑥1 +
1 0 1 2 1 3
( 𝑦−𝑦0 )(𝑦−𝑦1 )(𝑦−𝑦3 ) ( 𝑦−𝑦0 )(𝑦−𝑦1 )(𝑦−𝑦3 )
(𝑦2 −𝑦0 )(𝑦2 −𝑦1 )(𝑦2 −𝑦3 )
× 𝑥2 + (𝑦 −𝑦 )(𝑦 −𝑦 )(𝑦 −𝑦 ) × 𝑥3
3 0 3 1 3 3

(45−29)(45−32)(45−78) (45−43)(45−32)(45−78) (45−43)(45−29)(45−78)


=(43−29)(43−32)(43−78) × 1 (29−43)(29−32)(29−78) × 15 + (32−43)(32−29)(32−78) ×
(45−43)(45−29)(45−32)
25 × 35 +
(78−43)(78−29)(78−32)

(2)(13)(−33) (16)(13)(−33) (2)16)(−33) (3)(16)(13)


= × 10 + × 15 × 25 + × 35
(−14)(−3)(−49) (14)(11)(−35) (−11)(3)(−46) (35)(49)(46)

= 4.1691 + 19.1020 -17.391 + 0.1846


= 5.8956

4. Determine the distance travelled by a particle and its acceleration at the end of 𝟒𝒕𝒉
second if the time versus velocity data is gven below.

T 0 1 3 4
V 21 15 12 10
Solution

Since values are not equi-spaced, we use LaGrange’s formula..

Here,
t0=0 v0=21
t1=1 v1=15
t2=3 v2=12
t3=4 v3=10
We know,
(𝑡−𝑡1 )(𝑡−𝑡2 )(𝑡−𝑡3 ) (𝑡−𝑡𝑜 )(𝑡−𝑡2 )(𝑡−𝑡3 )
V= 𝑣
(𝑡𝑜 −𝑡)(𝑡0 −𝑡2 )(𝑡0 −𝑡3 ) 0
+ 𝑣
(𝑡1 −𝑡0 )(𝑡1 −𝑡2 )(𝑡0 −𝑡3 ) 1
+

(𝑡−𝑡0 )(𝑡−𝑡1 )(𝑡−𝑡3 ) (𝑡−𝑡0 )(𝑡−𝑡1 )(𝑡−𝑡2 )


𝑣
(𝑡2 −𝑡0 )(𝑡2 −𝑡1 )(𝑡0 −𝑡3 ) 2
+ 𝑣
(𝑡2 −𝑡0 )(𝑡2 −𝑡1 )(𝑡0 −𝑡2 ) 3

(𝑡−1)(𝑡−3(𝑡−1) (𝑡−1)(𝑡−1)(𝑡−1) (𝑡−1)(𝑡−3(𝑡−1) (𝑡−1)(𝑡−3(𝑡−1)


= (−1)(−3)(−4)
21 + (−1)(−2)(−3)
15 + (3)(2)(1)
12 + (4)(3)(1)
10

(𝑡 3 −8𝑡 2 +19𝑡−12) (𝑡 3 −7𝑡 2 +12𝑡) (𝑡 3 −5𝑡 2 +4𝑡) (𝑡 3 −4𝑡 2 +3𝑡)


= 21 + 15 + 12 + 10
−12 −12 −12 12
1
= 12 (−5𝑡 3 + 8𝑡 2 − 105𝑡 + 252)

Now
𝑑𝑣 1 𝑑
Acceleration = 𝑑𝑡 = 12 (−5𝑡 3 + 8𝑡 2 − 105𝑡 + 252)
𝑑𝑡
1
= 12 (−15𝑡 2 + 76𝑡 − 105)

At t=4
1
Acceleration = 12 (−15 × 42 + 76 × 4 − 105)

= -3.4
And
4
Distance = ∫0 𝑣𝑑𝑡
1 4
= 12 ∫0 (−5𝑡 3 + 8𝑡 2 − 105𝑡 + 252)𝑑𝑡

1 5𝑡 4 38𝑡 3 105𝑡 2
=12 (− + − + 252𝑡) 40
4 3 2

1 2432
=12 (−320 + − 840 + 1008)
3

= 54.9
5. Following table gives the chemical dissolved in water.

Temperature 10o 15o 20o 25o 30o 35o

Solubility 19.9 21.5 22.4 23.5 24.6 25.8

Compute the amount dissolved at11o and 34o using newton’s method.
Solution:
x Y(x) Δ yo Δ 2yo Δ 3yo Δ 4yo Δ 5yo

10 19.9

1.6

15 21.5 -0.7

0.9 0.9

20 22.4 0.2 -1.1

1.1 -0.2 1.4

25 23.5 0 0.3

1.1 0.1

30 24.6 0.1

1.2

35 25.8

For x=11,
xo =10, yo =19.9, h=5

X=xo +ph

(x − 10)
𝑝=
5
When x=11, p=0.2
Newton’s forward interpolation formula is
p(p−1) p(p−1)(p−2) p(p−1)(p−2)(p−3)
F(x)= yo + pΔ yo + × ∆2 𝑦0 + × ∆3 𝑦0 + × ∆4 𝑦0 +
2! 3! 4!
p(p−1)(p−2)(p−3)(p−4) 5
× ∆ 𝑦0
5!

0.2(0.2 − 1) 0.2(0.2 − 1)(0.2 − 2)


= 19.9 + 0.2 × 1.6 + × (−0.7) + × (0.9)
2! 3!
0.2(0.2 − 1)(0.2 − 2)(0.2 − 3)
+ × (−1.1)
4!
0.2(0.2 − 1)(0.2 − 2)(0.2 − 3)(0.2 − 4)
+ × (1.4)
5!
=19.9 + 0.32 + 0.056 + 0.0423 + 0.03696 + 0.0357
= 20.3920
At 34° ( Newton’s backward interpolation)
𝑥𝑝 = 34

It lies between 30 and 35


𝑥𝑛 = 35 𝑦𝑛 = 0.3
𝑥𝑛 −𝑦𝑛 34−35
h = 5, 𝑝 = = = −0.2
𝑛 5

Using Newton’s backward interpolation formula,


p(p+1) p(p+1)(p+2) p(p+1)(p+2)(p+3)
F(x) = yo + pΔ yo + × ∆2 𝑦0 + × ∆3 𝑦0 + × ∆4 𝑦0 +
2! 3! 4!
p(p+1)(p+2)(p+3)(p+4) 5
× ∆ 𝑦0
5!
(−0.2)(−0.2+1) (−0.2)(−0.2+1)(−0.2+2)
= 25.8 + (−0.2 × 1.2) + × 0.1 + × 0.1 +
2! 3!
(−0.2)(−0.2+1)(−0.2+2)(−0.2+3) (−0.2)(−0.2+1)(−0.2+2)(−0.2+3)(−0.2+4)
× 0.3 + × 1.4
4! 5!

=25.8 - 0.24 - 0.008 - 0.0048 - 0.010 - 0.035


=25.502
6. Find the lowest degree polynomial which takes the following value:

X 0 1 2 3 4 5

Y 0 3 8 15 24 35

Solution:
X y Δy Δ 2y Δ 3y Δ 4y Δ 5y

0 0

1 3 2

5 0

2 8 2 0

7 0 0

3 15 2 0

9 0

4 24 2

11

5 35

Using Newton’s forward interpolation formula,


X0 = 0
Y0 = 0
h = 1-0 = 1'
x−x0 x−0
P= = =x
ℎ 1

We get,
p(p−1) p(p−1)(p−2) p(p−1)(p−2)(p−3)
F(x)=yo + pΔ y + × ∆2 y + × ∆3 y + × ∆4 y +
2! 3! 4!
p(p−1)(p−2)(p−3)(p−4)
× ∆5
5!
𝑥(𝑥−1)(2)
=0+𝑥×3+ 2!
+0+0+0

= 3𝑥 + 𝑥 2 − 𝑥
=𝑥 2 + 2𝑥
=𝑥(𝑥 + 2)

Equation satisfies the table.

7. Generate a Lagrange interpolating polynomial for function y=sinπx taking pivotal


points 0, 1/6 and 1/2.

Solution
Given function is
f(x)=sinπx
Taking pivotal points we get,
x 0 1/6 1/2
F(x) 0 0.5 1

Here,
x0 = 0 y0=0

x1 = 1/6 y1=0.5

x2 = 1/2 y2=1

Now
(𝑥−𝑥1 )(𝑥−𝑥2 ) (𝑥−𝑥0 )(𝑥−𝑥2 ) (𝑥−𝑥0 )(𝑥−𝑥1 )
f(x) = 𝑦
(𝑥𝑜 −𝑥1 )(𝑥0 −𝑥2 ) 0
+ 𝑦
(𝑥1 −𝑥0 )(𝑥1 −𝑥2 ) 1
+ 𝑦
(𝑥2 −𝑥0 )(𝑥2 −𝑥1 ) 2

1 1 1 1
(𝑥− )(𝑥− ) (𝑥−0)(𝑥− ) (𝑥−0)(𝑥− )
6 2 2 6
= 0+ 1 1 1 0.5 + 1 1 1 1
(1−2)(1−4) ( −0)( − ) ( −0)( − )
6 6 2 2 2 6

x x
(𝑥 2 − ) (𝑥 2 − )
2 6
=0+ 1 0.5 + 1 1

18 6

9
= -9𝑥 2 + 2 𝑥 + 6𝑥 2 − 𝑥
7
=2 𝑥 − 3𝑥 2
2.2 Cubic Spline Interpolation
1. Find cubic splines for the following values and evaluate y(1.75).

X 0.5 1.0 1.5 2.00


Y 2.0000 4.4366 6.7134 13.9130
Solution:
We know that the cubic spline interpolation formula is;
𝑎𝑖−1 𝑎𝑖 1
𝑦(𝑥) = (ℎ𝑖2 𝑢𝑖 − 𝑢𝑖3 ) + 3
(𝑢𝑖−1 − ℎ𝑖2 𝑢𝑖−1 ) + (𝑓𝑖 𝑢𝑖−1 − 𝑓𝑖−1 𝑢𝑖 )
6ℎ𝑖 6ℎ𝑖 ℎ𝑖

To determine the coefficient ai, we use,


𝑓𝑖+1 −𝑓𝑖 𝑓𝑖 −𝑓𝑖−1
ℎ𝑖 𝑎𝑖−1 + 2(ℎ𝑖 + ℎ𝑖+1 )𝑎𝑖 + ℎ𝑖+1 𝑎𝑖+1 = 6 [ − ]
ℎ𝑖+1 ℎ𝑖

Also, a0=an=0 i.e. a0=a3=0


For i=1
𝑓2 −𝑓1 𝑓1− 𝑓0
ℎ1 𝑎0 + 2(ℎ1 + ℎ2 )𝑎1 + ℎ2 𝑎2 = 6 [ − ]
ℎ2 ℎ1

h1=x1-x0=0.5, h2=0.5, h3=0.5


6.7134−4.4366 4.4366−2.0000
or, 0 + 2(0.5 + 0.5)𝑎1 + 0.5𝑎2 = 6 [ − ]
0.5 0.5

or, 2a1+0.5a2= -1.9176 ----------- (1)


For i=2
𝑓3 −𝑓2 𝑓2 −𝑓1
ℎ2 𝑎1 + 2(ℎ2 + ℎ3 )𝑎2 + ℎ3 𝑎3 = 6 [ − ]
ℎ3 ℎ2

13.9130−6.7134 6.7134−4.4366
or, 0.5a1+2(1)a2+0=6 [ − ]
0.5 0.5

or, 0.5a1+2a2=59.0736 ------------(2)


Solving eq(1) and eq(2) , we get,
a1=-8.8992, a2=31.7616
Since the interpolation value lies on 1.5 and 2.00,
So i=2.
Then ;
𝑎 𝑎 1
𝑦(1.75) = 6ℎ1 (ℎ22 𝑢2 − 𝑢23 ) + 6ℎ2 (𝑢13 − ℎ22 𝑢1 ) + ℎ (𝑓2 𝑢1 − 𝑓1 𝑢2 )
2 2 2
Where , u1=x-x2=1.75-1.5=0.25
u2=x-x3=1.75-2.00=-0.25
−8.8992 31.7616
𝑦(1.75) = (0.52 ∗ (−0.25) − (−0.25)3 ) + (0.253 − 0.52 ∗ 0.25)
6 ∗ 0.5 6 ∗ 0.5
1
+ (13.9130 ∗ 0.25 − 6.7134 ∗ (−0.25))
0.5
=0.13905 + (-0.49627) + 10.3132
=9.9559
Hence, y(1.75)=9.9559 is the required answer.

2. Find the natural cubic spline corresponding to the interval [2,3] from the following
table and compute y(2.5) and y’(3).

X 1 2 3 4 5
Y 30 17 31 18 25

Solution:
In this question there are 5 points :
a0, a1, a2, a3, a4
a0=a4=0
We have four interval and four cubic and therefore only a1,a2,a3 are to be determined.
We use,
𝑓𝑖+1 − 𝑓𝑖 𝑓𝑖 − 𝑓𝑖−1
ℎ𝑖 𝑎𝑖−1 + 2(ℎ𝑖 + ℎ𝑖+1 )𝑎𝑖 + ℎ𝑖+1 𝑎𝑖+1 = 6 [ − ]
ℎ𝑖+1 ℎ𝑖
For i=1
𝑓2 −𝑓1 𝑓1− 𝑓0
ℎ1 𝑎0 + 2(ℎ1 + ℎ2 )𝑎1 + ℎ2 𝑎2 = 6 [ − ]
ℎ2 ℎ1

h1=1 , h2=1 , h3=1 , h4=1


31−17 17−30
0+2(1+1)a1 + 1*a2 =6 [ − ]
1 1

or, 4a1+a2=162 -----------(1)


For i=2
𝑓3 −𝑓2 𝑓2 −𝑓1
ℎ2 𝑎1 + 2(ℎ2 + ℎ3 )𝑎2 + ℎ3 𝑎3 = 6 [ − ]
ℎ3 ℎ2

18−31 31−17
1*a1+2(1+1)a2 +1*a3 = 6 [ − ]
1 1

a1+4a2+a3 = -156 ------------(2)


For i=3
𝑓4 −𝑓3 𝑓3 −𝑓2
ℎ3 𝑎2 + 2(ℎ3 + ℎ4 )𝑎3 + ℎ4 𝑎4 = 6 [ − ]
ℎ4 ℎ3

25−18 18−31
1*a2+2(1+1)a3 +0 = 6 [ − ]
1 1

or, a2+4a3 = 120 -----------(3)


On solving (1),(2),(3), we get,
1587
a1 = 28
−453
a2 = 7
1293
a3 = 28

Since the interpolating values lies on the interval [2,3], we have cubic spline interpolation
formula:
𝑎𝑖−1 𝑎𝑖 1
𝑦(𝑥) = (ℎ𝑖2 𝑢𝑖 − 𝑢𝑖3 ) + 3
(𝑢𝑖−1 − ℎ𝑖2 𝑢𝑖−1 ) + (𝑓𝑖 𝑢𝑖−1 − 𝑓𝑖−1 𝑢𝑖 )
6ℎ𝑖 6ℎ𝑖 ℎ𝑖

Here , i=3
For i=2.5
u3 =x-x3 =2.5-4 =-1.5
u2=x-x2 =2.5-3 =-0.5
𝑎2 𝑎3 1
𝑦(2.5) = (ℎ32 𝑢3 − 𝑢33 ) + (𝑢23 − ℎ32 𝑢2 ) + (𝑓3 𝑢2 − 𝑓2 𝑢3 )
6ℎ3 6ℎ3 ℎ3

−453 1293 1
=7∗6∗1 (12 ∗ (−1.5) − (−1.5)3 ) + 28∗6∗1 ((−1.5)3 − 12 ∗ (−0.5)) + 1 (18 ∗ (−0.5) −
31 ∗ (−1.5))
= -20.2232 + 2.88861 + 37.5
=20.163
Hence, y(2.5)=20.163 is the required answer.
3. Fit the following four points by cubic splines.

i 0 1 2 3
t 1 2 3 4
y 1 5 8 11

Use the end conditions y0” = y3” = 0. Hence compute y (1.5).

Solution:
We know that the cubic spline interpolation formula is;
𝑎𝑖−1 𝑎𝑖 1
𝑦(𝑥) = (ℎ𝑖2 𝑢𝑖 − 𝑢𝑖3 ) + 3
(𝑢𝑖−1 − ℎ𝑖2 𝑢𝑖−1 ) + (𝑓𝑖 𝑢𝑖−1 − 𝑓𝑖−1 𝑢𝑖 )
6ℎ𝑖 6ℎ𝑖 ℎ𝑖

To determine the coefficient ai , we use,


𝑓𝑖+1 −𝑓𝑖 𝑓𝑖 −𝑓𝑖−1
ℎ𝑖 𝑎𝑖−1 + 2(ℎ𝑖 + ℎ𝑖+1 )𝑎𝑖 + ℎ𝑖+1 𝑎𝑖+1 = 6 [ − ]
ℎ𝑖+1 ℎ𝑖

We have, a0=a3=0
h1=1, h2=1, h3=1.
For i=1
𝑓2 −𝑓1 𝑓1− 𝑓0
ℎ1 𝑎0 + 2(ℎ1 + ℎ2 )𝑎1 + ℎ2 𝑎2 = 6 [ − ]
ℎ2 ℎ1

8−5 5−1
0+2(1+1)a1 +a2 =6 [ − ]
1 1

4a1 + a2 =-6 -----------(1)


For i=2
𝑓3 −𝑓2 𝑓2 −𝑓1
ℎ2 𝑎1 + 2(ℎ2 + ℎ3 )𝑎2 + ℎ3 𝑎3 = 6 [ − ]
ℎ3 ℎ2

11−8 8−5
a1+2(1+1)a2 +0 = 6 [ − ]
1 1

a1 + 4a2 = 0 -----------(2)
Solving eq(1) and eq(2), we get;
−8 2
a1 = , a2 = 5
5

Since, the interpolating value lies on 1 and 2, we have the cubic spline interpolation formula as:
𝑎 𝑎 1
𝑦(1.5) = 6ℎ1 (ℎ22 𝑢2 − 𝑢23 ) + 6ℎ2 (𝑢13 − ℎ22 𝑢1 ) + ℎ (𝑓2 𝑢1 − 𝑓1 𝑢2 )
2 2 2

Where, u1=x-x2=1.5-2 = -0.5


u2=x-x3=1.5-3 = -1.5
−8 2 1
𝑦(1.5) = (12 ∗ (−1.5) − (−1.5)3 ) + ((−0.5)3 − 12 ∗ (−0.5)) + (8
5∗6∗1 5∗6∗1 1
∗ (−0.5) − 5 ∗ (−1.5))
= -0.5 + 0.025 + 3.5
= 3.025
Hence, y(1.5) = 3.025 is the required answer.
2.3 LEAST SQUARE CURVE FITTING:

1. Using least squares method, find the straight line that best fits the given data.

x 1 2 a=3 4 5
y 15 27 b=41 55 69

Solution,
From given, the no. of values of x is odd (i.e., n=5)
So, the middlemost value of x is chosen as ‘a’ and the common difference of the A.P. is
chosen as ‘c’.
i.e., a=3 and common diff. (c)=2-1=1
also, we can choose a value near the average of the extreme values of y as ‘b’ so;
𝑥−3
put, 𝑢 = 𝑐

and,𝑣 = 𝑦 − 41
Since, the required relation between x and y is linear, the relation between ‘u’ and ‘v’ will
also be linear.
⸫v=au+b (1)
Applying ∑ on both sides of equation (1);
∑v=∑au+∑b [ ∑b=nb ]
⸫ a∑u+nb=∑v (2)
Again, multiplying equation (1) by ‘u’ and then attaching ∑ to each of the terms,
∑uv=∑au2+∑bu
a∑u2+b∑u=∑uv (3)
The required values of ∑u, ∑v, ∑u2 ∑uv are computed in the table below;
𝑥−3
𝑢=
𝑐 u2
x y 𝑣 = 𝑦 − 41 uv

1 15 -2 -26 4 52
2 27 -1 -14 1 14
3 41 0 0 0 0
4 55 1 14 1 14
5 69 2 28 4 56
∑u=0 ∑v=2 ∑u2=10 ∑uv=136
n=5
Using these values in equations (1) and (2) we get,
a*0+7b=2
or, b=2/7=0.2858
10a+b*0=136
Or, a=13.6
Using these values of ‘a’ and ‘b’ in equation (1) we get,
v=13.6u+0.2858
or, y-41=13.56{(x-3)/1}+0.2858
or, y-41=13.56x-40.68+0.2858
or, y=13.56x+0.6058
The required equation of best fitting straight line is y=13.56x+0.6058
.
2. A simply supported beam carries a concentrated load P at midpoint. Corresponding
to various values of P, the maximum deflection Y (mm) is measured (as given below).
Find a law of form Y=a+bP.

P 100 120 140 160 180 200


Y 46 54 61 72 82 85
Solution,
The given curve; Y= a+bP (i)
The normal eqn of (i) are
ΣY=na +bΣP (ii)
ΣPY= aΣP+ bΣP² (iii)
Now
P Y P² PY

100 46 10000 4600

120 54 14400 6480

140 61 19600 8540

160 72 25600 11520

180 82 32400 14760

200 85 40000 17000

ΣP=900 ΣY=400 ΣP²=142000 ΣPY=62900

Putting these values in (i) and (ii),we get


400=6a+ 900b (iv)
62900=900a+142000b (v)
On solving (iv) and (v)
29
𝑏=
70
95
𝑎=
21
95 29
Hence, the required equation of curve is,𝑌 = 21 + 70 𝑃
3. The following is the results of the measurements of train resistance, V is the velocity
is the resistance. If R is related to V by the relation;
R=a +bV+cV², find a, b, c.
V 20 40 60 80 100 120
R 5.6 9.2 14.9 22.6 33.5 46.2

Solution,
The quadratic equation is R=a+bV+cV², then the normal equation is,
na+bΣV+cΣV²=ΣR (i)
aΣV+bΣV²+cΣV³=ΣVR (ii)
aΣV²+bΣV³+cΣV^4=ΣV²R (iii)
V R V² V³ V^4 VR V²R

20 5.6 400 8000 160000 112 2240


40 9.2 1600 64000 2560000 368 14720

60 14.9 3600 216000 12960000 894 53640


80 22.6 6400 512000 40960000 1808 144640

100 33.5 10000 1000000 100000000 3350 335000


120 46.2 14400 1728000 207360000 5544 665280

ΣV=420 ΣR=132 ΣV²=36400 ΣV³=3528000 ΣV^4=364000000 ΣVR=12076 ΣV²R=


1215520

From eqn (i),(ii),(iii) we get,


60+420b+36400c=132 (iv)
420a+36400b+3528000c=12076 (v)
37400a+3528000b+364000000c=1215520 (vi)
Solving (iv) (v) (vi),we get
a=4.69, b=-0.00923, c=0.00295
Hence the required values of a, b and c are 4.69, -0.00923 and 0.00295 respectively.
i.e., R=4.69-0.00923V+0.00295V²
4. Fit a quadratic curve y=ax2+bx+C using the data using least square approximation.
x 1 2 3 5
y -1 2 9 54
Solution,
From the given we have to fit a quadratic curve for the following set of order:
x 1 2 3 5
y -1 2 9 54
Here, to fit a quadratic curve at first, we have to find values of a, b and c.
Let, y=ax2+bx+C (1)
Introducing ∑ on both sies of equation (1), we get;
∑y=∑ax2+∑bx+∑C
or, ∑y=a∑x2+b∑x+nC [ ⸪∑C=nC] (2)
Again, multiplying equation (1) by x and introducing ∑ to both sides we get;
∑xy=∑ax3+∑bx2+∑Cx
or, ∑xy=a∑x3+b∑x2+C∑x (3)
Again, multiplying equation (1) by x and introducing ∑ on both sides we get;
∑x2y=∑ax4+∑bx3+∑Cx2
or, ∑x2y=a∑x4+b∑x3+C∑x2 (4)
Now finding the value of ∑x, ∑x2, ∑x4, ∑xy, ∑x2y

x y x2 x3 x4 xy x2y

1 -1 1 1 1 -1 -1
2 2 4 16 64 4 8
3 9 9 27 81 27 81
5 54 25 125 625 270 1350
∑x=11 ∑y=65 ∑x2=39 ∑x3=161 ∑x4=723 ∑xy=300 ∑x2y=1438
Here, n=4
Now putting these values in equation (2), (3) and (4), we get;
65=39a+11b+4C (5)
300=161a+39b+11C (6)
1438=723a+161b+39C (7)
Again, sloving equations (5), (6) and (7) we get;
a= 4.72
b= -15.18
C= 11.9
Hence, the require quadratic curve of the best fitting line is;
y=4.72x2-15.18x+11.9

5. Fit a power function model of the form y= axb to the given table.
x 1 2 3 4 5
y 0.5 2 4.5 8.5 12.5
Solution,
y=axb (1)
which is not linear.
Now, converting relation (1) into linear form by taking logarithms (base 10);
Log10 𝑦 = log10 (𝑎𝑥 𝑏 ) = log10 𝑎 + log10 𝑥 𝑏
or, log10 𝑦 = log10 𝑎 + 𝑏 log10 𝑥
Now putting log10 𝑦 = 𝑌 and log10 𝑎 = 𝐴 then, above equation becomes;
Y=A+bX (2)
Now, introducing ∑ to each of the term in equation (2);
∑A+∑bX=∑Y
or, nA+b∑X=∑Y [⸪∑A=nA] (3)
Again, multiplying equation (2) by X and then attaching ∑ to each term;
∑XY=∑AX+∑bX2
∑XY=A∑X+b∑X2 (4)
The required values of ∑X, ∑Y, ∑X2 and ∑XY are computed in the table below;

x y 𝑿 = 𝐥𝐨𝐠 𝟏𝟎 𝒙 𝒀 = 𝐥𝐨𝐠 𝟏𝟎 𝒚 X2 XY

1 0.5 0 -0.301 0 0

2 2 0.301 0.301 0.091 0.091

3 4.5 0.477 0.653 0.228 0.311


4 8.5 0.602 0.929 0.326 0.560
5 12.5 0.699 1.097 0.489 0.767
∑X=2.079 ∑Y=2.679 ∑X2=1.134 ∑XY=1.729

Also, n=5
Now, using these relevant values in (3) and (4), we get;
5A+2.079b=2.679 (5)
2.079A+1.134b=1.729 (6)
Solving equation (5) and (6), we get;
A=-0.4130
b=2.281
we have,
log10 𝑎 = 𝐴
or, a=10-0.4130
or, a=0.3863
Using these values of ‘a’ and ‘b’ in equation (1), the required relation for the best fit is;
y=0.3863x2.281
6. The temperature of a metal strip was measured at various time intervals during
heating and the values are given below. If the relationship between temperature T and
t/4
time t is of the form T=be +a, estimate the temperature at t= 6 minutes.
Time, t(min) 1 2 3 4
Temp, T(◦c) 70 83 100 124
Solution,
The given relation is;
T=bet/4+a (1)
We can write the above equation in the fotm of;
y=bf(x)+a
This is similar to the linear equation except that the variable x is replaced by f(x).
Therefore, we can solve the parameter a and b by replacing xi by f(xi);
∑xi=∑f(xi)
∑xi2=∑f(xi)2
Thus,
𝑛[∑𝑓(𝑥𝑖 )∑(𝑦𝑖 )] − ∑𝑓(𝑥𝑖 )∑𝑦𝑖
𝑏=
𝑛[∑(𝑓(𝑥𝑖 )2 ) − [∑𝑓(𝑥𝑖 )]2
∑𝑦𝑖 − 𝑏∑𝑓(𝑥)
𝑎=
𝑛
We can set the following table to obtain the unknown values;
We have, f(x)=et/4
Time,t Temp,T
(x) (y) f(x) yf(x) [f(x)]2
1 70 1.28 89.6 1.64
2 83 1.65 136.95 2.73
3 100 2.12 212 4.49
4 124 2.72 337.28 7.40
∑X=10 ∑y=377 ∑f(x)=7.77 ∑yf(x)=775.83 ∑[f(x)]2 =16.26
Also, n=4
4∗7.775.83−7.77∗377
⸫𝑏 = 4∗16.26−7.772

=37.29
377 − (37.29 ∗ 7.77)
𝑎=
4
=21.82
The required equation becomes: T=37.29e0.25t+21.82
Again,
The temperature at time t=6 min is;
T=37.29e0.25*6+21.82
=188.94oC
3 Chapter-3
3.1 NUMERICAL DIFFERENTIATION AND INTEGRATION
𝑑𝑦
1. Find 𝑑𝑥 at x = 0.7 and 1.3 from the following table:

x 0.7 0.8 0.9 1.0 1.1 1.2 1.3


y 0.644218 0.717356 0.783327 0.841471 0.891207 0.932039 0.963558
Solution:
The difference table is:
x y Δy Δ2 𝑦 Δ3 𝑦 Δ4 𝑦 Δ5 𝑦 Δ6 𝑦
0.7 0.644218
0.073138
0.8 0.717356 -
0.007167
0.065971 -0.00066
0.9 0.783327 - 0.000079
0.007827
0.058144 - 0.000006
0.000581
1.0 0.841471 - 0.000085 -
0.008408 0.000004
0.049736 - 0.000002
0.000496
1.1 0.891207 - 0.000087
0.008904
0.040832 -
0.000409
1.2 0.932039 -
0.009313
0.031519
1.3 0.963558
As the derivative is required at x = 0.7 , Newton’s forward difference interpolation is used as:
𝑑𝑦 1 1 1
( ) = [Δ𝑦0 − Δ2 𝑦0 + Δ3 𝑦0 −. . . … … … … … ] … … … … … . (1)
𝑑𝑥 𝑥=𝑥0 ℎ 2 3

Here,
ℎ = 0.1 𝑥0 = 0.7 𝑦0 = 0.644218 Δ𝑦0
= 0.073138 Δ 𝑦0 = −0.007167 Δ 𝑦0 = −0.00066 Δ4 𝑦0
2 3

= 0.000079 Δ5 𝑦0 = 0.000006 Δ6 𝑦0 = −0.000004


From (1),
𝑑𝑦 1 1 1 1
( ) = [0.073138 − (−0.007167) + (−0.00066) − (0.000079)
𝑑𝑥 𝑥=0.7 0.1 2 3 4
1 1
+ (0.000006) − (−0.000004)]
5 6
=𝟎. 𝟕𝟔𝟒𝟖𝟑𝟔𝟏𝟔𝟔𝟕 Ans
Again,
As the derivative is required at x=1.3 , Newton’s backward difference interpolation is used as:
𝑑𝑦 1 1 1 1
( ) = [Δ𝑦𝑛 + Δ2 𝑦𝑛 + Δ3 𝑦𝑛 + Δ4 𝑦𝑛 +. . . … … … … … ] … … … … … . (2)
𝑑𝑥 𝑥=𝑥𝑛 ℎ 2 3 4

Here,
ℎ = 0.1 𝑥𝑛 = 1.3 𝑦𝑛 = 0.963558 Δ𝑦𝑛
2 3
= 0.031519 Δ 𝑦𝑛 = −0.009313 Δ 𝑦𝑛 = −0.000409 Δ4 𝑦𝑛
5 6
= 0.000087 Δ 𝑦𝑛 = 0.000002 Δ 𝑦𝑛 = −0.000004
From (2),
𝑑𝑦 1 1 1 1
( ) = [0.031519 + (−0.009313) + (−0.000409) + (0.000087)
𝑑𝑥 𝑥=1.3 0.1 2 3 4
1 1
+ (0.000002) + (−0.000004)]
5 6
=𝟎. 𝟐𝟔𝟕𝟒𝟕𝟔𝟓 Ans
𝑑𝑦 ⅆ𝟐 𝒚 𝟏⁄
2. Find and of 𝒚 = 𝒙 𝟑 from the following data at x = 51. Compare the results
𝑑𝑥 ⅆ𝒙𝟐
with the exact values.

x 50 51 52 53 54 55 56
y 3.684 3.7084 3.7325 3.7563 3.7798 3.8030 3.8259

Solution:
The difference table is:
x y Δy Δ2 𝑦 Δ3 𝑦 Δ4 𝑦 Δ5 𝑦 Δ6 𝑦
50 3.684
0.0244
51 3.7084 -0.0003
0.0241 0
52 3.7325 -0.0003 0
0.0238 0 0
53 3.7563 -0.0003 0 0
0.0235 0 0
54 3.7798 -0.0003 0
0.0232 0
55 3.8030 -0.0003
0.0229
56 3.8259
As the derivatives are required near the initial values , Newton’s forward difference
interpolation is used as:
𝑑𝑦 1 1 1
( ) = [Δ𝑦0 − Δ2 𝑦0 + Δ3 𝑦0 −. . . … … … … … ] … … … … … . (1)
𝑑𝑥 𝑥=𝑥0 ℎ 2 3

And,
𝑑2𝑦 1 11
( 2) = 2 [Δ2 𝑦0 − Δ3 𝑦0 + Δ4 𝑦0 −. . . … … … … … ] … … … … … . (2)
𝑑𝑥 𝑥=𝑥 ℎ 12
0

Here,
ℎ=1 𝑥0 = 51 𝑦0 = 3.7084 Δ𝑦0 = 0.0241 Δ2 𝑦0 = −0.0003 Δ3 𝑦0
=0 Δ4 𝑦0 = 0 Δ5 𝑦0 = 0 Δ6 𝑦0 = 0
From (1),
𝑑𝑦 1 1
(𝑑𝑥 ) = 1 [0.0241 − 2 (−0.0003) + 0]= 𝟎. 𝟎𝟐𝟒𝟐𝟓𝟎Ans
𝑥=51

From (2),
𝑑2𝑦 1
(𝑑𝑥 2 ) = 12 [−0.0003 + 0]= -0.000300Ans
𝑥=51
𝟏⁄
Again, we have ,𝒚 = 𝒙 𝟑

𝑑𝑦 1
So,𝑑𝑥 = 2
3𝑥 ⁄3

𝑑2 𝑦 2
Also, 𝑑𝑥 2 = − 5
9𝑥 ⁄3

Therefore,
𝑑𝑦
Exact value of (𝑑𝑥 ) = 𝟎. 𝟎𝟐𝟒𝟐𝟑𝟖 Ans
𝑥=51

𝑑2𝑦
Exact value of (𝑑𝑥 2 ) = −𝟎. 𝟎𝟎𝟎𝟑𝟏𝟕 Ans
𝑥=51

We have ,
Error=Approximate value-Actual value
𝑑𝑦 𝑑2𝑦
Thus , the approximate values of and are almost similar with exact values with errors
𝑑𝑥 𝑑𝑥 2
0.000012 and 0.000017 i.e. 0.05% and 5.31% respectively.
3. Given the following pairs of values of x and y.

x 1 2 4 8 10
y 0 1 5 21 25
Determine numerically the first and second derivative at X = 4.
Solution:
x y = f(x) Δf(x) Δ2f(x) Δ3f(x) Δ4f(x)
1 0
1
2 1 1/3
2 0
4 5 1/3 -1/108
4 -1/12
8 21 -1/3
2
10 25

∴ y = f(x) = f(x0) + (x- x0) f(x0, x1) + (x- x0) (x- x1) f(x0, x1, x2)……………
= 0 + (x-1) × 1 + (x-1) (x-2) × 1/3 + (x-1) (x-2) (x-4) (x-8) × -1/108
−3𝑥+2 𝑥 4 −15 𝑥3 +70𝑥 2 −120𝑥+64
= (x-1) + -
3 108

108𝑥−108+36𝑥 2 −108𝑥+72−𝑥 4 +15𝑥 3 −70𝑥 2 +120𝑥−64


= 108

−𝑥 4 +15𝑥 3 −34𝑥 2 +120𝑥−100


= 108

−4𝑥 3 +45𝑥 2 −68𝑥+120


∴ f′(x) = 108
26
At x = 4, f′(x) = 9
−12𝑥 2 +90𝑥−68
∴ f′′(x) = 108

∴ f′′(x) at x = 4 is;
25
∴ f′′ (4) = 27

4. Calculate the area bounded by the curve y=x2+4 and the lines y= -1, x=1 and x=4 by
trapezoidal rule taking number of subintervals as 6.

Solution;
For the curve,
x 1 1.5 2 2.5 3 3.5 4
y 5 6.15 8 10.25 13 16.25 20

For area 1, by trapezoidal rule.


𝑏−𝑎 1 1
A1 = [2 𝑦0 + 𝑦1 + 𝑦2 + 𝑦3 + 𝑦4 + 𝑦5 + 2 𝑦6 ]

4−1 1 1
= [2 × 5 + 6.25 + 8 + 10 + 10.25 + 13 + 16.25 + 2 × 20]
6

= 33.125

For area 2,
A2 = 1 ×(4-1)
=3
∴ Total area (A) = 33.125 + 3
= 36.125 units

5. Calculate the area bounded by the curves𝒚 = 𝒙𝟐 + 𝟒,and 𝒚 = 𝒙𝟐 − 𝟒, and the lines
𝒚 = −𝟏, 𝒙 = 𝟏 and 𝒙 = 𝟒 by Newton Cotes 2 ordinate formula, using more than 4
sub intervals.

Solution:
For,𝑦 = 𝑥 2 + 4
x 1 1.5 2 2.5 3 3.5 4
y 5 6.25 8 10.25 13 16.25 20
𝑦0 𝑦1 𝑦2 𝑦3 𝑦4 𝑦5 𝑦6
For,𝑦 = 𝑥 2 − 4
x 1 1.5 2 2.5 3 3.5 4
y -3 -1.75 0 2.25 5 8.25 12
𝑦0 𝑦1 𝑦2 𝑦3 𝑦4 𝑦5 𝑦6

Given that, using more than 4-subinterval, take n=6,


By Weddle’s rule
4
To evaluate ∫1 (𝑥 2 + 4)
3ℎ
𝐴1 =10 [𝑦0 + 5𝑦1 + 𝑦2 + 6𝑦3 + 𝑦4 + 5𝑦5 + 𝑦6 ]
3×0.5
= [5 + 5 × 6.25 + 8 + 6 × 10.25 + 13 + 5 × 16.25 + 20]
10

=33
4
To evaluate ∫1 (𝑥 2 − 4)
3×0.5
𝐴2 = [5 + 5 × 6.25 + 8 + 6 × 10.25 + 13 + 5 × 16.25 + 20]
10

=9
Total area=33-9
=24-unit Ans

𝟕 𝟏
6. Evaluate I = ∫𝟑 (𝒙𝟐 𝒍𝒐𝒈𝒙) ⅆ𝒙 using Simpsons𝟑 rule and initial interval of 1. Go on
halving the interval and find the integral with relative error less than 0.01.

Solution
1
ℎ = 1 − 2 = 0.5

𝑎 = 3, 𝑏 = 7
We know,
𝑛ℎ = 𝑏 − 𝑎
𝑏−𝑎 7−3
𝑛= = 0.5 = 8

Let us define function,


𝑓(𝑥) = 𝑥 2 𝑙𝑜𝑔𝑥
Table
𝑥𝑖 3 3.5 4 4.5 5 5.5 6 6.5 7
𝑦𝑖 13.22 34.35 41.41
4.29 6.66 9.63 17.47 22.39 28.01
𝑦0 𝑦1 𝑦2 𝑦3 𝑦4 𝑦5 𝑦6 𝑦7 𝑦8

By using Simpson’s 1/3 rule;



I= 3 [𝑦0 + 𝑦8 + 2(𝑦2 + 𝑦4 + 𝑦6 ) + 4(𝑦1 + 𝑦3 + 𝑦5 + 𝑦7 )]
0.5
= 3 [4.29 + 41.41 + 2(9.63 + 17.47 + 28.01) + 4(6.66 + 13.22 + 22.39 + 34.35)]

= 77.07
𝟕
∫𝟑 (𝒙𝟐 𝒍𝒐𝒈𝒙) ⅆ𝒙 =77.07 ans

𝟏 𝟏
7. Evaluate I= ∫𝟎 ⅆ𝒙 correct up to 3- decimal places with h=1/6 and 1/12 by
𝟏+𝒙𝟐
Simpson’s 1/3 and 3/8 rule. Discuss the results.

Solution;
When, ℎ = 1/6,
1
ℎ=
6
𝑎 = 0, 𝑏 = 1
We know, 𝑛ℎ = 𝑏 − 𝑎
𝑏−𝑎 1−0
𝑛= = 1 =6

6

Let us define function,


1
𝑓(𝑥) =
1 + 𝑥2

Table
𝑥𝑖 0 1 2 3 4 5 1
6 6 6 6 6
𝑦𝑖 1 0.9 0.8 0.692 0.59 0.5
0.973
𝑦0 𝑦1 𝑦2 𝑦3 𝑦4 𝑦5 𝑦6

By using Simpson’s 1/3 rule;



I= 3 [𝑦0 + 𝑦6 + 2(𝑦2 + 𝑦4 ) + 4(𝑦1 + 𝑦3 + 𝑦5 )]
1
=3×6 [1 + 0.5 + 2(0.9 + 0.692) + 4(0.973 + 0.8 + 0.59)]

=𝟎. 𝟕𝟖𝟓𝟑ans
By using Simpson’s 3/8 rule;
3h
I= [y0 + y6 + 2(y3 ) + 3(y1 + y2 + y4 + y5 )]
8
3
=6×8 [1 + 0.5 + 2(0.8) + 3(0.973 + 0.9 + 0.692 + 0.59)]

=0.7853
𝟏 𝟏
∫𝟎 𝐝𝐱 = 𝟎. 𝟕𝟖𝟓𝟑ans
𝟏+𝐱 𝟐

When,𝐡 = 𝟏/𝟏𝟐,
1
ℎ=
12
𝑎 = 0, 𝑏 = 1
We know, 𝑛ℎ = 𝑏 − 𝑎
𝑏−𝑎 1−0
𝑛= = = 12
ℎ 1
12
Let us define function,
1
𝑓(𝑥) =
1 + 𝑥2
Table
𝑥𝑖 1 2 3 4 5 6 7 8 9 10 11 1
0 12 12 12 12 12 12 12 12 12 12 12
𝑦𝑖 0.94 0.90 0.85 0.80 0.746 0.692 0.64 0.59 0.54 0.5
1 0.99 0.97
𝑦0 𝑦1 𝑦2 𝑦3 𝑦4 𝑦5 𝑦6 𝑦7 𝑦8 𝑦9 𝑦10 𝑦11 𝑦12
By using Simpson’s 1/3 rule;

I= 3 [𝑦0 + 𝑦12 + 2(𝑦2 + 𝑦4 + 𝑦6 + 𝑦8 + 𝑦10 ) + 4(𝑦1 + 𝑦3 + 𝑦5 + 𝑦7 + 𝑦9 + 𝑦11 )]
1
=3×12 [1 + 0.5 + 2(0.97 + 0.9 + 0.80 + 0.692 + 0.59) + 4(0.99 + 0.94 + 0.85 + 0.746 +
0.64 + 0.54)]
=𝟎. 𝟕𝟖𝟒𝟏𝟏ans
By using Simpson’s 3/8 rule;
3ℎ
I= [𝑦0 + 𝑦6 + 2(𝑦3 + 𝑦6 + 𝑦9 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 + 𝑦7 + 𝑦8 + 𝑦10 + 𝑦11 ]
8
3
=12×8 [1 + 0.5 + 2(0.94 + 0.80 + 0.63) + 3(0.99 + 0.97 + 0.90 + 0.85 + 0.746 + 0.692 +
0.54)]
=0.7841
1 1
∫0 𝑑𝑥 = 0.7841ans
1+𝑥 2

𝟏
8. Evaluate ∫𝟎.𝟐(𝒙 + 𝒔𝒊𝒏𝟐𝒙)dx using Simpson's 1/3rd rule with h=0.2

Solution:
ℎ = 0.2
𝑎 = 0.2, 𝑏 = 1
We know, 𝑛ℎ = 𝑏 − 𝑎
𝑏 − 𝑎 1 − 0.2
𝑛= = =4
ℎ 0.2
let us define function,
𝑓(𝑥) = 𝑦𝑖 = 𝑥 + sin 2𝑥

xi 0.2 0.4 0.6 0.8 1


yi 0.206 0.412 0.618 0.825 1.031
y y y y y
0 1 2 3 4

Now, using Simpson's ⅓ rule:


h
I= 3[(y0+y4)+2y2+4(y1+y3)]
0.2
= [(0.206+1.031)+2×0.618+4(0.412+0.825)]
3
0.2
= [1.237+1.236+4.948]
3

=0.49473
Therefore,
𝟏
∫𝟎.𝟐(𝐱 + 𝐬𝐢𝐧𝟐𝐱)𝐝𝐱 = 0.49473 ans

𝟏
9. Calculate by Simpson's 1/3th rule the value of ∫−𝟏 𝒙4dx with at least 5 sub intervals.

Solution:-
ℎ=5
𝑎 = −1, 𝑏 = 1
We know, 𝑛ℎ = 𝑏 − 𝑎
𝑏 − 𝑎 1 − (−1) 2
𝑛= = =
ℎ 5 5
let us define function,
𝑓(𝑥) = 𝑦𝑖 = 𝑥 4

xi -1 -3/5 -1/5 1/5 3/5 1


yi 1 0.1296 0.0016 0.0016 0.1296 1
Y0 Y1 Y2 Y3 Y4 Y5

Using Simpson's ⅓ rule:



= 3[(y0+y5)+2(y2+y4)+4(y1+y3)]
2
=15[(1+1)+2(0.0016+0.1296)+4(0.1296+0.0016)
2
=15(2+0.2624+0.5248)

=0.37162
Therefore,
𝟏
∫−𝟏 𝒙4dx = 0.4

𝟔
10. Using Romberg's method to compute ∫𝟎 𝟏/(1+x2) dx correct to 4 decimal places.

Solution: -
𝑏−𝑎
We have, ℎ = , taking n=2
𝑛
6−0
ℎ= =3
2

Taking h=3, 1.5. 0.75 respectively,


Let us calculate the given interval using trapezoidal rule
1
𝑓(𝑥) = 𝑦𝑖 =
1 + 𝑥2
a) When h=3
xi 0 3 6

yi 1 0.1 0.027

I1=2[(y0+y2)+2y1]
3
=2[1+0.027+2×0.1]
=1.8405
b) when h=1.5
xi 0 1.5 3 4.5 6

yi 1 0.108 0.1 0.047 0.027



I2=2[(y0 + y4)+2(y1 + y2+ y3)]
1.5
= 2 [(1 + 0.027) +2(0.308 + 0.1+ 0.047)]
1.5
= 2 [1.027+0.91]
=1.4927

c) when h=0.75
xi 0 0.75 1.5 2.25 3 3.75 4.5 5.25 6

yi 1 0.64 0.308 0.165 0.1 0.066 0.047 0.035 0.027


I3=2[(y0 + y8) +2(y1 + y2 + y3 + y4 + y5 + y6 + y7)]
0.75
= [1.027+2(0.64 + 0.308 + 0.165 + 0.1 + 0.066 + 0.047 + 0.035)]
2
0.75
= [1.027 + 2.722]
2
=1.4058

Now, apply Romberg's integration formula


I −I1
I4=I2+ 2 3
1.4527−1.8405
=1.4527+ 3
=1.3234
Similarly,
I −I2
I5 = I3+ 3 3
1.4058−1.4527
= 1.4058+ 3
= 1.39016 Ans

𝟏 𝟑
11. Use the Gauss Legendre three ordinate quadrature formula, evaluate ∫−𝟏 √𝒙 ⅆ𝒙

Solution
Gauss Legendre three point formula is:
1
∫−1 𝑓(𝑥)𝑑𝑥=𝑤1 × 𝑓(𝑥1) +𝑤2 × 𝑓(𝑥2 ) +𝑤3 × 𝑓(𝑥3 ) ………….(1)
5 8 5
Where, 𝑤1 = 9 𝑤2 = 9 𝑤3 = 9

3 3
𝑥1 =-√5 𝑥2 =0 𝑥3 =√5

let us define function,


3
𝑓(𝑥) = √𝑥
From equation (1),

1 8 5 3 3
∫−1 𝑓(𝑥)𝑑𝑥=9 𝑓(0)+9 [ 𝑓 (−√5) + 𝑓 (√5)]

3
𝑓(0) = 0, 𝑓 (−√5)=(−0.843432),

3
𝑓 (√5)=(0.843432),

1 8 5
∫−1 f(x)dx=9 × 0 + 9 [−0.843432 + 0.843432]=0
𝟏 𝟑
∫−𝟏 √𝐱 𝐝𝐱 = 𝟎 ans

𝟏 𝐜𝐨𝐬 𝟐𝒙
12. Find the value of the integral I=∫𝟎 ⅆ𝒙 using Gauss Legendre two point and
𝟏+𝐬𝐢𝐧 𝒙
three-point integration rules. The nodes and weights are:

n nodes weights
1 ± 0.5773502692 1.0000000000
2 0.0000000000 0.8888888889
3 ± 0.7745966692 0.5555555556
Solution
First Change limit (0, 1) to [-1, 1] by transformation,
1 1 1 1
𝑥 = 2 (𝑏 − 𝑎)𝑢 + 2 (𝑏 + 𝑎)=2 (1 − 0)𝑢 + 2 (1 + 0)
𝑢 1 𝑢+1
=2 + =
2 2

𝑑𝑢
𝑑𝑥 =
2
Now,
𝑢+1
1 cos 2( 2 ) 1
I=∫−1 𝑢+1 𝑑𝑢
1+sin( )2
2

1 cos(𝑢+1) 1
=∫−1 𝑢+1 𝑑𝑢
1+sin( )2
2

let us define function,


cos(𝑢 + 1) 1
𝑓(𝑥) =
𝑢+1
1 + sin ( 2 ) 2

Using Gauss Legendre two point (n=2) formula:


1
∫−1 𝑓(𝑢)𝑑𝑢=𝑤1 × 𝑓(𝑢1) +𝑤2 × 𝑓(𝑢2 )

Where, 𝑤1 = 1𝑤2 = 1
𝑢1 = −0.5773502692 𝑢2 = +0.5773502692
𝑓(𝑢1 ) = 0.3769378601
𝑓(𝑢2 ) =- 0.001916993748
1
∫−1 𝑓(𝑢)𝑑𝑢=1 × (0.3769378601)+ 1 × (− 0.001916993748)

= 0.3750208864 Ans
Using Gauss Legendre three point (n=3) formula:
1
∫−1 𝑓(𝑢)𝑑𝑢=𝑤1 × 𝑓(𝑢1 ) +𝑤2 × 𝑓(𝑢2) +𝑤3 × 𝑓(𝑢3 ) ……………….. (1)
5 8 5
Where, 𝑤1 = 9 𝑤2 = 9 𝑤3 = 9

3 3
𝑢1 =-√5 𝑢2 =0 𝑢3 =√5

From equation (1),

1 8 5 3 3
∫−1 𝑓(𝑥)𝑑𝑥=9 𝑓(0)+9 [ 𝑓 (−√5) + 𝑓 (√5)]

3
𝑓(0) = 0.182605441, 𝑓 (−√5)=0.4380837104,

3
𝑓 (√5)=-0.0570013297,

Now,
1 8 5
∫−1 𝑓(𝑥)𝑑𝑥=9 × 0.182605441 + 9 [0.4380837104 − 0.0570013297]

=0.3740283814 ans
𝟏 𝐜𝐨𝐬 𝟐𝒙
∫𝟎 ⅆ𝒙 = 𝟎. 𝟑𝟕𝟒𝟎𝟐𝟖𝟑𝟖𝟏𝟒ans
𝟏+𝐬𝐢𝐧 𝒙

13. The values of stress corresponding to different values of strain, as obtained in a


plane strain compression test, given below;

Strain(𝒆) 0.25 0.30 0.35 0.40 0.45


Stress(𝝈) 24.1 25.5 26.6 27.3 27.9

Find the strain energy, which is the area under the stress-strain curve.
Solution
Here, h=0.05,
𝑦0 =24.1,
𝑦1 =25.5
𝑦2 =26.6,
𝑦3 =27.3,
𝑦4 =27.9

Required strain energy, which is the area under the stress - strain curve is;
0.45 ℎ
∫0.25 𝜎 𝑑𝑒 = 2[𝑦0 + 𝑦4 + 4(𝑦1 + 𝑦3 ) +2𝑦2 ] ………………… [using Simpson’s Rule]
0.05
= [ 24.1 + 27.9 + 4(25.5 + 27.3) +2×26.6]
2

= 7.91

𝟎.𝟒𝟓
∫𝟎.𝟐𝟓 𝝈 ⅆ𝒆 = 𝟕. 𝟗𝟏 ans
3.2 Numerical differentiation and integration

1. Find dy/dx and d2y/dx2 at (a)x=1.0 and (b)x=1.5 given that:


x 1.0 1.1 1.2 1.3 1.4 1.5 1.6

y 7.989 8.403 8.781 9.129 9.451 9.750 10.031

Solution:
The difference table is:

x y Δy Δ2y Δ3y Δ4y Δ5y Δ6y

1.0 7.989

0.414

1.1 8.403 -0.036

0.378 0.006

1.2 8.781 -0.03 -0.002

0.348 0.004 0.001

1.3 9.129 -0.026 -0.001 0.002

0.322 0.003 0.003

1.4 9.451 -0.023 0.002

0.299 0.005

1.5 9.750 -0.018

0.281

1.6 10.031

h=0.1
1 1 1 1 1 1
(𝑑𝑦
𝑑𝑥
) = ℎ [y0-2Δ2y0+3Δ3y0- 4Δ4y0+ 5Δ5y0- 6Δ6y0]
𝑑𝑦 1 1 1 1 1
(𝑑𝑥 )x=1.0 = 0.1[0.414+ 2× (0.036) +3× 0.006+4× 0.002+5×0.001-
1
×0.002]
6

=4.34367
𝑑𝑦 1 1 1 1 1
( )x=1.5= [0.299+ × (0.023) + × 0.003+ × 0.001+ ×0.001]
𝑑𝑥 0.1 2 3 4 5

=3.1195
Now,
𝑑^2𝑦 1 11 5 137
(𝑑𝑥^2) = ℎ^2[Δ2y0-Δ3y0+ 12Δ4y0- 6Δ5y0+ 180Δ6y0]
𝑑^2𝑦 1 11 5 137
(𝑑𝑥^2)x=1.0= 0.1^2[-0.036-0.006+ 12(-0.002) -6 (0.001) + 180(0.002)]

= -4.3144
𝑑^2𝑦 1 11 5
(𝑑𝑥^2)x=1.5= 0.1^2[-0.023-0.003+ 12(-0.001) -6 (0.001)]

= -2.775
𝑑𝑦 𝑑𝑦
Hence, (𝑑𝑥 )x=1.0 = 4.34367, (𝑑𝑥 )x=1.5= 3.1195
𝑑^2𝑦 𝑑^2𝑦
(𝑑𝑥^2)x=1.0= -4.3144, (𝑑𝑥^2)x=1.5 = -2.775

2. A slider in a machine moves along a fixed straight rod. Its distance x cm along the rod
is given below for various values of the time ‘t’ seconds. Find the velocity of the slider
and its acceleration when t=0.1 second.
t 0 0.1 0.2 0.3 0.4 0.5 0.6

x 30.13 31.62 32.87 33.64 33.95 33.81 33.24


Solution:

The difference table is:


t X Δ Δ2 Δ3 Δ4 Δ5 Δ6

0 30.13

1.49

0.1 31.62 -0.24

1.25 0.24

0.2 32.87 -0.48 0.26

0.77 0.02 -o.27

0.3 33.64 -0.46 -0.01 0.29

0.31 0.01 0.02

0.4 33.95 -0.45 0.01

-0.14 0.02

0.5 33.81 -0.43

-0.57

0.6 33.24

The velocity of a slider when t=0.1 sec.


𝑑𝑦 1 1 1 1 1
(𝑑𝑥 )x=0.1 = ℎ[Δ- 2Δ2+3Δ3-4Δ4+5Δ5]
1 1 1 1 1
= 0.1[1.25- 2(-0.48)+3(0.02)-4(-0.01)+5(0.02)]

= 15.03 m/s
The acceleration of the slider when t=0.1 sec,
𝑑^2𝑦 1 11 5
( 𝑑𝑡^2 )x=0.1= ℎ^2[Δ2- Δ3+12Δ4-6Δ5]
1 11 5
= 0.1^2[-0.48- 0.02 +12(-0.01)-6(0.02)]

= -52.58 m/s2
3. Find f (20) from the following data:

x 3 5 11 27 34
f(x) -13 23 899 17315 35606

Solution:
The divided difference table is given as:
x f(x) 1st order 2nd order 3rd order 4th order

13

23 + 13
= 18
5−3 146−18
23 = 16
11−3
40−16
=1
899 − 23 27−3

11 − 5
= 146

899 1−1
1026−146 =0
= 40 34−3
27−5
17315 − 899
27 − 11
69−40
= 1026 =1
34−5

17315

2613−1026
=
34−11
35606 − 17315 69
34 − 27
35606 = 2613
By using the Newton’s divided difference formula,
F(x) = 𝑦0 + (x-𝑥0 ) y[𝑥0 , 𝑥1 ] + (x-𝑥0 ) (x-𝑥1 ) y[𝑥0 , 𝑥1 , 𝑥2 ]
+ (x-𝑥0 ) (x-𝑥1 ) (x-𝑥2 ) y[𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 ]
+ (x-𝑥0 ) (x-𝑥1 ) (x-𝑥2 ) (x-𝑥3 ) y[𝑥0 , 𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 ]
In the question, x = 20, so
F (20) = -13 + (20-3) *18+ (20-3) (20-5) * 16
+ (20-3) (20-5) (20-11) * 1
+ (20-3) (20-5) (20-11) (20-27) * 0
= -13 + 306 + 4080 + 2295 + 0
= 6668
Hence, the value of f(20) for given data is equal to 6668.

4. Given the value of Sin(x):

X 𝟎° 𝟏𝟎° 𝟐𝟎° 𝟑𝟎° 𝟒𝟎°

Y=sinx 0.000 0.1736 0.3420 0.5000 0.6428

(a) Find the value of sin 𝟑𝟐° .


(b) Find the numerical value of dy/dx at x = 12 for y = sinx.
(c) Find the numerical value of ⅆ𝟐 y/d𝒙𝟐 at x = 30 for y = sinx.

Solution:
Here, the difference table is given as:

X Y ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦
0 0.000
0.1736
10 0.1736 -0.0052
0.1684 -0.0052
20 0.3420 -0.0104 0.0004
0.1580 -0.0048
30 0.5000 -0.0152
0.1428
40 0.6428

(a)

Since, x=32 which lies between 30 and 40, we use Newton’s backward
difference formula.
We have,
x=32
𝑥𝑛 = 40
h= 10
𝑥−𝑥𝑛 32−40
P= = = -0.8
ℎ 10

Now,
According to Newton’s backward difference formula,

𝐏(𝐏+𝟏) 𝐏(𝐏+𝟏)(𝐏+𝟐) 𝟑
y = 𝒚𝒏 + P𝛁𝒚𝒏 + 𝛁 𝟐 𝒚𝒏 + 𝛁 𝒚𝒏
𝟐! 𝟑!
𝐏(𝐏+𝟏)(𝑷+𝟐)(𝐏+𝟑) 𝟒
+ 𝛁 𝒚𝒏
𝟒!

(−0.8) (1−0.8)
= 0.6428 + (-0.8) * 0.1428 + *(-0.0152)
2!
(−0.8) (1−0.8)(2−0.8)
+ *(-0.0048)
2!
(−0.8) (1−0.8)(2−0.8)(3−0.8)
+ * 0.0004
2!

= 0.6428 – 0.11424 + 0.001216 + 0.0001536 – 0.00000704

= 0.5299

(b)
Here, Since, x=12 which lies between 10 and 20, we use Newton’s forward
difference formula.
We have,
x = 12
𝑥0 = 0
h = 10
𝑥−𝑥0 12−0
P= = = 1.2
ℎ 10

Now,
According to Newton’s forward difference formula,

ⅆ𝒚 𝟏 𝟐𝐏−𝟏 𝟑𝐏 𝟐 −𝟔𝐏+𝟐 𝟒𝐏 𝟑 −𝟏𝟖𝐏 𝟐 +𝟐𝟐𝐏−𝟔


= 𝒉 [∆𝒚𝟎 + ∆ 𝟐 𝒚𝟎 + ∆ 𝟑 𝒚𝟎 + ∆ 𝟒 𝒚𝟎 ]
ⅆ𝒙 𝟐! 𝟑! 𝟒!

1 2∗1.2−1 3∗1.22 −6∗1.2+2


= [0.1736 + ∗ (−0.0052) + ∗ (−0.0052) ]
10 2! 3!

1
= [ 0.1736 – 0.00364 – 0.00076266 ]
10

= 0.0169

(c)
Since, x=30 , we use Newton’s backward difference formula.
We have,
x=30
𝑥𝑛 = 40
h= 10
𝑥−𝑥𝑛 30−40
P= = = -1
ℎ 10

Now,
According to Newton’s backward difference formula,

ⅆ𝟐 𝒚 𝟏 𝟔𝐏+𝟔 𝟏𝟐𝐏 𝟐 +𝟑𝟔𝐏+𝟐𝟐


= 𝒉𝟐 [𝛁 𝟐 𝒚𝒏 + 𝛁 𝟑 𝒚𝒏 + 𝛁 𝟒 𝒚𝒏 ]
ⅆ𝒙𝟐 𝟑! 𝟒!

1 6∗(−1)+6
= [ -0.0152 + + 0]
102 3!

= -0.000152

𝟔
𝟏
7. Evaluate ∫ 𝐝𝒙 by using,
𝟏+𝒙𝟐
𝟎

i) Trapezoidal
ii) Simpson 1/3 rule
iii) 3/8 rule and compare the result with actual value.
Solution:

i) Trapezoidal
Here, a=0 , b=6
When, n=6 and h=1
x 0 1 2 3 4 5 6

y 1 0.5 0.2 0.1 0.0588 0.0384 0.0270

From Trapezoidal Rule,



I= [ y0+y6+2(y1+y2+y3+y4+y5)]
2
1
I= 2 [1+ 0.0270 +2 (0.2+0.1+0.0588+0.0384+0.5)]
I= 1.4107

ii) Simpson 1/3 rule



I= [y0+y6+2(y2+y4)+4(y1+y3+y5)]
3
1
I= [1+0.0270 +2 (0.2+0.0588)+4 (0.5+0.1+0.0384)]
3
I= 1.3660

iii) Simpson 3/8 rule


3ℎ
I= [ y0+y6+2y3+3(y1+y3+y4+y5)]
8
3
I= [1+ 0.0270 +2(0.1)+3(0.5+0.2+0.0588+0.0384)]
8
I= 1.3569

iv) Exact Value


6
1
∫ d𝑥
1 + 𝑥2
0
= 1.4056

8. The velocity of E-Tempo which starts from rest is given at fixed interval of time (t),
as follows. Estimate approximate the distance covered in 17 min.
t 2 4 6 8 10 12 14 16 18 20

v 10 18 25 29 32 20 11 5 2 0

Solution:
𝑑𝑠
If s(km) be the distance covered in t (min), then =ʋ
𝑑𝑡
Therefore,
20
| 𝑠|20
𝑡=0 = ∫0 ʋdt

= [X + 4.0+ 2.E]
3
By Simpson Rule,
Here, h=2, ʋ0 = 0, ʋ1 = 10, ʋ2 = 18, ʋ3 = 25 etc.
Therefore,
X= ʋ0 + ʋ10 = 0 + 0 = 0

O= ʋ1 + ʋ3 + ʋ5 + ʋ7 + ʋ9
= 10 + 25 + 32 + 11 + 2
= 80

E = ʋ2 + ʋ4 + ʋ6 + ʋ8
= 18 + 29 + 20 + 5
= 72

Hence,
The required distance = |𝑠|20
𝑡=0
2
= (0 + 4*80 + 2*72)
3
= 309.33

9. Solid of revolution is formed by rotating about the x-axis, the area between the x-
axis, the lines x=0, x=1, and a curve through the points with the following co-
ordinates.

x 0 0.25 0.5 0.75 1.00


y 1.0 0.9896 0.9589 0.9089 0.8415
Find the volume of solid formed by using Simpson rule.

Solution:
Here,
h= 0.25-0
=0.25
Y0=1.00,
Yf = 0.8415
From Simpson Rule,

Volume (v)=3 [yo+ yf +4 (y1+y2+y3)]

0.25
= [1.0 +0.8451+ 4(0.9896+ 0.9589+0.9089)]
3

= 1.105925
10. Integrate Numerically
𝝅
I=∫𝟎 √𝒄𝒐𝒔Ɵ dƟ
𝟐

Solution:
Given,

y=√𝑐𝑜𝑠Ɵ
𝜋 𝜋
a= 0, b= , h=
2 8

Ɵ 0 𝝅 𝝅 𝟑𝝅 𝝅
𝟖 𝟒 𝟖 𝟐
y 1 0.9612 0.8409 0.6186 0

From Simpson 1/3 rule



I= [yo+y4+2y2+4(y1+y3)]
3
π
I= [1+0+2*0.8409+4(0.9612+0.6186)]
8∗3
I= 1.18

11. A curve is drawn to pass through the points given by the following table.

x 1 1.5 2 2.5 3 3.5 4


y 2 2.4 2.7 2.8 3 2.6 2.1
Estimate the area bounded by the curve, and the lines y = 1, x = 1, x = 4.

Solution:
From the given table; we have,
x 1 1.5 2 2.5 3 3.5 4
y 2 2.4 2.7 2.8 3 2.6 2.1
Interval of x = 1.5-1 = 0.5
Now, By Simpson’s one-third rule; we have,
𝑥=4
𝐴 =∫ 𝑦𝑑𝑥
𝑥=1

𝐼𝑛𝑡𝑒𝑟𝑣𝑎𝑙 𝑜𝑓 𝑥
𝐴 = [(𝑦0 + 𝑦6 + 4(𝑦1 + 𝑦3 + 𝑦5 ) + 2(𝑦2 + 𝑦4 )]
3
0.5
𝐴 = [2 + 2.1 + 4(2.4 + 2.8 + 2.6) + 2(2.7 + 3)]
3
𝐴 = 7.78
Hence the required area is 7.78.

12. A river is 80 ft. wide. The depth d in ft. at a distance x ft. from one bank is given by
the following table.

X 0 10 20 30 40 50 60 70 80
Y 0 4 7 9 12 15 14 8 3
Find approximately the area of the cross-section and the mean depth of the river.
Solution:
From the given table; we have,
X(ft.) 0 10 20 30 40 50 60 70 80
Y(ft.) 0 4 7 9 12 15 14 8 3

Interval of the width (x) = 10 – 0 = 10


Now, By Simpson’s one-third rule; we have,
𝑥=80
𝐴 =∫ 𝑦𝑑𝑥
𝑥=0

𝐼𝑛𝑡𝑒𝑟𝑣𝑎𝑙 𝑜𝑓 𝑥
𝐴 = [(𝑦0 + 𝑦8 ) + 2(𝑦2 + 𝑦4 + 𝑦6 ) + 4(𝑦1 + 𝑦3 + 𝑦5 + 𝑦7 )]
3
10
𝐴 = [(0 + 3) + 2(7 + 12 + 14) + 4(4 + 9 + 15 + 8)]
3
𝐴 = 710 sq. ft.
Hence, the approximate area of the cross section of the river is 710 sq. ft.
Again,
For the mean depth of the river,
0 + 4 + 7 + 9 + 12 + 15 + 14 + 8 + 3
𝑦=
9
𝑦 = 8ft.
Hence the mean depth of the river is 8ft.

𝝅/𝟐
13. Evaluate integral I =∫𝟎 𝟏 − (𝟎. 𝟐𝟓 𝐬𝐢𝐧𝟐 𝒙)𝟏/𝟐 dx Gaussian quadrature formula.
Assume n=3

Solution:
By changing the limit (0, π/2) to (-1,1) by transformation
X=1/2(b-a) U +1/2(b+a)
=1/2(π/2-0) U-1/2(π/2+0)
= π/4(U+1)
Hence, dx= π/4du
Now
𝜋/2
I =∫0 1 − (0.25 sin2 𝑥)1/2 dx
1
=∫−1 1 − (0.25 sin2 (𝜋/4(𝑈 + 1))1/2dx

F(u)= 1 − (0.25 sin2 (𝜋/4(𝑈 + 1))1/2


Guass Legendre three-point (n=3) formula is
1
∫−1 𝑓(𝑢)𝑑𝑢 =w1*f(u1) +w2*f(u2) + w3*f(u3)

Where w1=0.555
W2=0.889
W3=0.555
U1=0.77460
U2=0
U3=0.77460
𝜋/2
Hence ∫0 1 − (0.25 sin2 𝑥)1/2dx

= w1*f(u1) +w2*f(u2) + w3*f(u3)


= (0.555*0.78234) +(0.889*0.73467) +(0.555*0.63368)
=1.46

14. Estimate the length of the area of the curve 3y=x3 from (0,0) to (1,3) using Simpsons
𝟏
rule taking 8 sub-intervals.
𝟖

Solution:
F(x)=x3/3
N=8
a=0
b=1
We have,
h=1/8

X 0 1/8 2/8 3/8 4/8 5/8 6/8 7/8 1


y 0 0.00065 0.00520 0.01757 0.04167 0.08138 0.14062 0.22330 0.33333

By Simpsons 1/3 rule:


I=h/3[y0+y8+2(y2+y4+y6)+4(y3+y5+y7)]
=1/24[0+0.3333+2(0.00520+0.04167+0.14062)+4(0.01757+0.08138+0.22330)]
=1/24[0+0.33333+0.37498+1.289]
=0.08322
Hence, the length of the curve is 0.08322m.
15. A body is in the form of a solid of evolution. The diameter D in cm’s of its sections at
distance X cm. From one end are given below. Estimate the volume of the solid.

X 0 2.5 5 7.5 10 12.5 15


D 5 5.5 6 6.75 6.25 5.5 4

Solution:
We have,
1
Using Simpson’s 3 rule,
ℎ 𝐷0 + 𝐷6
Volume of the solid (V) = 3 ( + 4(𝐷1 + 𝐷3 + 𝐷5 ) + 2(𝐷2 + 𝐷4 )
2
2.5 0+15
= ( + 4(5.5 + 6.75 + 5.5) + 2(6 + 4)
3 2

= 82.083𝑐𝑚3

16. The following table gives the velocity “v” of a particle at time t. Find the
acceleration at t=12.

t 0 2 4 6 8 10 12
v 4 6 16 34 60 94 136

Solution:

From the given table:


Now,
t v ∇ ∇2 V ∇3 V ∇4 V

0 4↘
2↘
2 6↘ 8↘

10↘ 0↘
4 8↘ 0
16↘
18↘ 0↘
6 0
34↘ 8↘

26↘ 0↘
8 0
60↘ 8↘

34↘ 0
10
94↘ 8

42
12
136

Using Newton’s backward difference formula,


We get,
𝐷𝑣 1 1 1
= [ ∇v + ∇2 𝑣 + ∇3 𝑣]
𝐷𝑡 ℎ 2 3
1 8
= 7 [42 + 2]

= 23 m/𝑠 2

17. A rocket is launched from the ground its acceleration f(cm/s 2) is registered during the
𝟏
first 80s and is given in the table below. Use Simpson’s 𝟑 rule. Find the velocity of rocket at
t=80 seconds.
t 0 10 20 30 40 50 60 70 80

f 30 31.63 33.34 35.47 37.75 40.33 43.25 46.69 50.67


Solution:
We know,
𝑑𝑣
0r, =𝑎
𝑑𝑡

Or, 𝑑𝑣 = 𝑎 ∗ 𝑑𝑡
Integrating both sides we get,
𝑏
0r, V=∫𝑎 𝑎 ∗ 𝑑𝑡

Where, yo=30, y1+y3+y5+y7=154.12, y2+y4+y6=114.34, yn=50.67


1
Now, Integrating by Simpson’s 3 rule:

V=3 [(yo+yn+2(y2+y4+y6)+ 4(y1+y3+y5+y7)]

Where, h=10
10
= 3 (30 + 50.67 + 2 ∗ 114.34 + 4 ∗ 154.12]

= 3086.1 cm/s2
=30.86 m/s2
Therefore, velocity of the rocket at t=80s is 30.86 m/s2.

18. A reservoir discharging the water through the sluices at a depth of ‘h’ below the water
surface has a surface area ‘A’ for various values of the ‘h’ as given below:
h (ft): 10 11 12 13 14
A (sq.ft.): 950 1070 1200 1350 1530
ⅆ𝒉 𝟒𝟖√𝒉
If t denotes the times in min the rate of fall of the surface is given by ⅆ𝒕 = − .
𝑨

Estimate the time taken for water to fall from 10 to 14 ft. above the sluices gate.
Solution:
Given,
𝑑ℎ −48√ℎ
Or, =
𝑑𝑡 𝐴
−𝐴
Or, 𝑑𝑡 = 48√ℎ 𝑑ℎ

Integrating on both sides,


14 −𝐴
0r, 𝑡 = ∫0 𝑑ℎ
48√ℎ

After putting the values of A and h from the given table we get values of f(x) or y1…n.
−𝐴 −950
Then, 𝑦0 = 48√ℎ ≡ 48√10 = −6.258

−𝐴 −1070
𝑦1 = ≡ = −6.72
48√ℎ 48√11
−𝐴 −1200
𝑦2 = ≡ = −7.2168
48√ℎ 48√12
−𝐴 −1350
𝑦3 = ≡ = −7.80
48√ℎ 48√13
−𝐴 −1530
𝑦4 = ≡ = −8.51
48√ℎ 48√14
1
Now, Integrating by Simpson’s 3 rule:

t=3 [(yo+yn+2(y2)+ 4(y1+y3)]

where, h=11-10=1
1
=3 [−6.258 − 8.51 + 2(−7.2168) + 4(−6.72 − 7.50)

=29.09 minutes.
The required time to fall water level from 10 to 14 is 29 minutes.

𝟐.𝟔 𝟒.𝟒 ⅆ𝒙ⅆ𝒚


21. Using Simpson rule evaluate the integral ∫𝟐 ∫𝟒
𝒙𝒚

Solution:
a = 4, b=4.4, c=2, d=2.6
h = (b-a)/2 = (4.4-4)/4 =0.4/2 = 0.2
k = (d-c)/2 = (2.6-2)/2 =0.6/2 = 0.3
x0 x1 x2
4 4.2 4.4

y0 y1 y2
2 2.3 2.6
ℎ𝑘
𝑖= (𝑓(4,2) + 𝑓(4,2.6) + 4𝑓(4,2.3) + 𝑓(4.4,2) + 𝑓(4.4,2.6) + 𝑓(4.4,2.3)) + 4(𝑓(4.2,2)
9
+ 𝑓(4.2,2.6) + 𝑓(4.2,2.3))
0.3
= 0.2 ∗ (((0.125 + 0.096 + 4(0.108)) + (0.114 + 0.087 + 4(0.0991)) + 4((0.119
9
+ 0.092 + 4(0.1041))
=0.06/9 (0.649+0.597+4(0.627))
=0.025

22. Evaluate the following integrals using


i) 4-ordinate Gauss-legend quadrature.
𝟔
a) I= ∫𝟑 (𝟑𝒙𝟐 + 𝟓)𝟑 ⅆ𝒙

By changing the limit (3,6) to 9-1,1) by transformation.


X=1/2(b - a) U + 1/2(b + a)
=1/2(6 - 3) U + 1/2(6 + 3)
=3/2U + 9/2
dx= 3/2 du
Now,
6
I= ∫3 (3𝑥 2 + 5)3 𝑑𝑥
3
1 3 9 2 3
= ∫−1 (3 (2 𝑈 + 2) + 5) 2
𝑑𝑢

3
1 3 9 2
= 3/2 ∫−1 (3 (2 𝑈 + 2) + 5) 𝑑𝑢

Ø(u1)=(3 (3/2u1 +9/2 )2 +5)3


f(u1)=(3 (3/2*(-0.36144)+9/2 )2 +5)3
=46155.13289
f(u2)=(3 (3/2*(-0.33990)+9/2 )2 +5)3
=146872.1676
f(u3)=(3 (3/2*(0.33990)+9/2 )2 +5)3
=517769.9858
f(u4)=(3 (3/2*(0.36144)+9/2 )2 +5)3
=1179168.457
Now,
3
I= *[0.34785*(46155.13289) + 0.65214*(146872.1676) +0.65214* (517769.9858) + 0.34785 *
2
(1179168.457)]

=1289502.817
4 Chapter-4
SOLUTION OF SYSTEM OF LINEAR EQUATIONS:
4.1 Direct method: (A) Gauss elimination method
1. Solve the following set of linear simultaneous equations by Gauss
Elimination.
x1+x2+4x3 = 43, 2x1+10x2+x3 = 63, 25x1+2x2+x3 = 69
Solution;
Here, the given linear equations are
x1+x2+4x3 = 43
2x1+10x2+x3 = 63
25x1+2x2+x3 = 69
The given system of linear equation can be arrange as
x1+x2+4x3 = 43 (1)

2x1+10x2+x3 = 63 (2)

25x1+2x2+x3 = 69 (3)

1 1 4 ∶ 43
[𝐴: 𝐵] = [2 10 1 ∶ 63]
25 2 1 ∶ 69
~ 𝑅2 : 𝑅2 − 𝑅3 , 𝑅1 = 𝑅1 − 4𝑅3
−99 − 7 0 ∶ −233
[𝐴: 𝐵] = [ −23 8 0 ∶ −6 ]
25 2 1 ∶ 69
~ 𝑅1 : 8𝑅1 + 7𝑅2
− 953 0 0 ∶ −1906
=[ −23 8 0 ∶ −6 ]
25 2 1 ∶ 69
Using forward substitution elimination method;
From 𝑅1 ;
−953x1 = −1906

x1 = 2
From 𝑅2 ;
−23x1 + 8x2 = −6

x2 = 5
From 𝑅3 ;
25x1 + 2x2 + x3 = 69

x3 = 9

∴ x1 = 2, x2 = 5, x3 = 9

2. Solve the following system of linear equation by Gauss Elimination


method.
4y+3z=4; 4x+2z=2; 5x+5y+10z=-3
Solution:
The given equation can be arranged as
5x+5y+10z=-3 (2)
4y+3z=4 (2)
4x+2z=2 (3)
The augmented matrix is given by
5 5 10 ∶ −3
[𝐴: 𝐵] = [4 0 2 ∶ 2 ]
0 4 3 ∶ 4
~ 𝑅2 : 5𝑅2 − 4𝑅1
5 5 10 ∶ −3
= [0 − 20 − 30 ∶ 22 ]
0 4 3 ∶ 4
~𝑅3 = 5𝑅3 − 𝑅2
5 5 10 ∶ −3
= [0 − 20 − 30 ∶ 22 ]
0 0 − 15 ∶ 42
From the above matrix; we get,
From 𝑅3 ;
14
−15𝑧 = 42, z = −
5

From 𝑅2 ;
31
−20𝑦 − 30𝑧 = 22, y =
10

From 𝑅1 ;
19
5𝑥 + 5𝑦 + 10𝑧 = −3, x =
10
19 31 14
∴x= , y = 10, z = −
10 5

Which are required solution of the system.

3. Solve the following system of linear equation by Gauss Elimination


method.
3w-2x+y=7, -2w+5x-y+z=-11, x-2y+2z=-29, -x+11y-2z=28
Solution:
The above linear equation can be written as;
-2w+5x-y+z=-11
3w-2x+y+0.z=7
0.w+x-2y+2z=-29
0.w-x+11y-2z=28
The augmented matrix can be written as
−2 5 − 1 1 ∶ −11
[𝐴: 𝐵] = [ 3 − 2 1 0∶ 7
]
0 1 −2 2 ∶ −29
0 −1 1 1 − 2 ∶ 28
~ 𝑅2 : 2𝑅2 + 3𝑅1
−2 5 − 1 1 ∶ −11
0 11 − 1 3 ∶ −19
=[ ]
0 1 −2 2 ∶ −29
0 −1 1 1 − 2 ∶ 28
~ 𝑅3 : 11𝑅3 − 𝑅2 , 𝑅4 : 11𝑅4 + 𝑅2
−2 5 −1 1 ∶ −11
0 11 − 1 3 ∶ −19
~[ ]
0 0 − 21 19 ∶ −300
0 0 1 20 − 19 ∶ 289
𝑅4 : 21𝑅4 + 120𝑅3
−2 5 −1 1 ∶ −11
0 11 − 1 3 ∶ −19
~[ ]
0 0 − 21 19 ∶ −300
0 0 0 1881: − 29931
Solving the matrix; we get,
From 𝑅4 ;
1881𝑧 = −29931

z = −15.9123
From 𝑅3 ;
−21𝑦 + 19𝑧 = −300

y = −0.1111
From 𝑅2 ;
11𝑥 − 𝑦 + 3𝑧 = −19

x = 2.6023
From 𝑅1 ;
−2𝑤 + 5𝑥 − 𝑦 + 𝑧 = −11

w = 4.1052

∴ w = 4.1052, x = 2.6023, y = −0.1111, z = −15.9123


4.2 Direct Method: (B) Cholesky’s (LU Decomposition) Method:
4. Solve the following set of equations by Cholesky’s and Do-little’s method.
3x1 – 4x2 + 7x3 = 6; -4x1 +x2 -x3 = -4; 7x1 -x2 -3x3 = 3;
Solution;
By Do-little’s Method:
We have the set of equations are:
3x1 – 4x2 + 7x3 = 6;
-4x1 +x2 -x3 = -4;
7x1 -x2 -3x3 = 3;
The given system of linear equation can be written in matrix form as:
3 −4 7 𝑥1 6
[−4 1 −1] ∗ [𝑥2 ] = [−4]
7 −1 −3 𝑥3 3
AX=B ------- (i)
3 −4 7 𝑥1 6
𝑥
where A = [−4 1 −1] , X = [ 2 ] and B = [−4]
7 −1 −3 𝑥3 3
Let A = LU
1 0 0 𝑢11 𝑢12 𝑢13
𝑙
where L = [ 21 1 0] and U = [ 0 𝑢22 𝑢23 ]
𝑙31 𝑙32 1 0 0 𝑢33

3 −4 7 1 0 0 𝑢11 𝑢12 𝑢13


i.e. [−4 1 −1]= [𝑙21 1 0] [ 0 𝑢22 𝑢23 ]
7 −1 −3 𝑙31 𝑙32 1 0 0 𝑢33
3 −4 7 𝑢11 𝑢12 𝑢13
[−4 1 −1] = [𝑙21 𝑢11 𝑙21 𝑢12 + 𝑢22 𝑙21 𝑢13 + 𝑢23 ]
7 −1 −3 𝑙31 𝑢11 𝑙31 𝑢12 + 𝑙32 𝑢22 𝑙31 𝑢13 + 𝑙32 𝑢23 + 𝑢33
Equating corresponding elements on both sides we get,
𝑢11 = 3𝑢12 = −4𝑢13 = 7
And, 𝑙21 𝑢11 = −4𝑙21 𝑢12 + 𝑢22 = 1𝑙21 𝑢13 + 𝑢23 = −1
4 13 25
∴ 𝑙21 = − ∴ 𝑢22 = − ∴ 𝑢23 =
3 3 3
Also, 𝑙31 𝑢11 = 7𝑙31 𝑢12 + 𝑙32 𝑢22 = −1𝑙31 𝑢13 + 𝑙32 𝑢23 + 𝑢33 = −3
7 −25 43
∴ 𝑙31 = ∴ 𝑙32 = ∴ 𝑢33 = −
3 13 13
1 0 0 3 −4 7
−4 −13 25
Hence, L = [ 3 1 0] and U = [0
3 3 ]
7 −25 −43
1 0 0
3 13 13

We know that,
LY = B
1 0 0 𝑦
−4 1 6
i.e. [ 3 1 0] [𝑦 ] = [ ]
2 −4
1 𝑦3
7 −25
3
3 13

Using forward substitution, we have,


𝑦1 = 6
4
𝑦2 = −4 + ∗ 6 = 4
3
7 25 −43
𝑦3 = 3 − ∗ 6 + ∗4=
3 13 13
6
4]
So, Y = [−43
13

Again; we have,
UX = Y
3 −4 7 𝑥1 6
−13 25
[0 3 𝑥
3 ] [ 2] 4 ]
= [−43
−43 𝑥
0 0 13
3 13

Using backward substitution, we get,


−43 13
𝑥3 = ∗ =1
13 −43
25 3
𝑥2 = (4 − ∗ 1) ∗ =1
3 13
6−7∗1+4∗1
𝑥1 = =1
3
Thus the required value of (x1 , x2 , x3) are (1 , 1 , 1) respectively.

5. Solve the set of equations by Cholesky’s or Croat’s Method.


a + b + c + d = 5; 4a + 3b - c + 5d = 2; 2a + 5b - 7c - 9d = 0;
a + 2b + 3c + 4d = 10;
Solution:
By Croat’s Method:
We have the set of equations are:
a + b + c + d = 5;
4a + 3b - c + 5d = 2;
2a + 5b - 7c - 9d = 0;
a + 2b + 3c + 4d = 10;
The given system of linear equation can be written in matrix form as:
1 1 1 1 𝑎 5
4 3 −1 5 𝑏 2
[ ]∗[ ]=[ ]
2 5 −7 −9 𝑐 0
1 2 3 4 𝑑 10
AX=B ------- (i)
1 1 1 1 𝑎 5
4 3 −1 5 𝑏 2
where A = [ ] , X = [ ] and B = [ ]
2 5 −7 −9 𝑐 0
1 2 3 4 𝑑 10
Let A = LU
𝑙11 0 0 0 1 𝑢12 𝑢13 𝑢14
𝑙 𝑙22 0 0 0 1 𝑢23 𝑢24
where L = [ 21 ] and U = [ ]
𝑙31 𝑙32 𝑙33 0 0 0 1 𝑢34
𝑙41 𝑙42 𝑙43 𝑙44 0 0 0 1
1 1 1 1 𝑙11 0 0 0 1 𝑢12 𝑢13 𝑢14
4 3 −1 5 𝑙 𝑙22 0 0 0 1 𝑢23 𝑢24
i.e. [ ]= [ 21 ][ ]
2 5 −7 −9 𝑙31 𝑙32 𝑙33 0 0 0 1 𝑢34
1 2 3 4 𝑙41 𝑙42 𝑙43 𝑙44 0 0 0 1
1 1 1 1 𝑙11 𝑙11 𝑢12 𝑙11 𝑢13 𝑙11 𝑢14
4 3 −1 5 𝑙 𝑙 𝑢 + 𝑙 𝑙 𝑢 + 𝑙 𝑢 𝑙21 14 + 𝑙22 𝑢24
𝑢
[ ] = [ 21 21 12 22 21 13 22 23
]
2 5 −7 −9 𝑙31 𝑙31 𝑢12 + 𝑙32 𝑙31 𝑢13 + 𝑙32 𝑢23 + 𝑙33 𝑙31 𝑢14 + 𝑙32 𝑢24 + 𝑙33 𝑢34
1 2 3 4 𝑙41 𝑙41 𝑢12 + 𝑙42 𝑙41 𝑢13 + 𝑙42 𝑢23 + 𝑙43 𝑙41 𝑢14 + 𝑙42 𝑢24 + 𝑙43 𝑢34 + 𝑙44

Equating corresponding elements on both sides we get,


𝑙11 = 1𝑙11 𝑢12 = 1𝑙11 𝑢13 = 1𝑙11 𝑢14 = 1
∴ 𝑢12 = 1 ∴ 𝑢13 = 1 ∴ 𝑢14 = 1
And, 𝑙21 = 4𝑙21 𝑢12 + 𝑙22 = 3𝑙21 𝑢13 + 𝑙22 𝑢23 = −1𝑙21 𝑢14 + 𝑙22 𝑢24 = 5

∴ 𝑙22 = −1 ∴ 𝑢23 = 5 ∴ 𝑢24 = −1


Also, 𝑙31 = 2𝑙31 𝑢12 + 𝑙32 = 5𝑙31 𝑢13 + 𝑙32 𝑢23 + 𝑙33 = −7𝑙31 𝑢14 + 𝑙32 𝑢24 + 𝑙33 𝑢34 = −9
1
∴ 𝑙32 = 3 ∴ 𝑙33 = −24 ∴ 𝑢34 =
3
lly, 𝑙41 = 1𝑙41 𝑢12 + 𝑙42 = 2𝑙41 𝑢13 + 𝑙42 𝑢23 + 𝑙43 = 3𝑙41 𝑢14 + 𝑙42 𝑢24 + 𝑙43 𝑢34 + 𝑙44 = 4
∴ 𝑙42 = 1 ∴ 𝑙43 = −3 ∴ 𝑙44 = 5

1 0 0 0 1 1 1 1
4 −1 0 0 0 1 5 −1
Hence, L = [ ] and U = 1
2 3 −24 0 0 0 1 3
1 1 −3 5 [0 0 0 1]
We know that,
LY = B
1 0 0 0 𝑦1 5
4 −1 0 0 𝑦2 2
i.e[ ][ ] = [ ]
2 3 −24 0 𝑦3 0
1 1 −3 5 𝑦4 10
Using forward substitution, we have,
𝑦1 = 5
𝑦2 = −(2 − 4 ∗ 5) = 18
2 ∗ 5 + 3 ∗ 18 8
𝑦3 = =
24 3
10 − 5 − 18 + 3 ∗ 8⁄3
𝑦4 = = −1
5
5
18
So, Y = 8
3
[−1]
Again; we have,
UX = Y
1 1 1 1 𝑎 5
0 1 5 −1 𝑏 18
1 [ ]= 8
0 0 1 3 𝑐
3
[0 0 0 1] 𝑑 [−1]
Using backward substitution, we get,
𝑑 = −1
8 1
𝑐= − ∗ (−1) = 3
3 3
𝑏 = 18 − 5 ∗ 3 − 1 = 2
𝑎 = 5−2−3+1 =1
Thus, from above calculation, the required value of (a, b, c , d) are (1 , 2 , 3 , -1) respectively by
using Croat’s method.

4.3 Direct Method: (C) Gauss Jordan Method:


6. Solve the following set of linear simultaneous equations by Gauss Jordan
Method.
x1 + x2 + x3 = 9; 2x1 – 3x2 + 4x3 =13; 3x1 + 4x2 + 5x3 = 40;
Solution:
The augmented matrix of the given system is:
1 1 1 : 9
[𝐴: 𝐵] = [2 −3 4 : 13]
3 4 5 : 40
~ R2→ R2 – 2R1, R3 → R3 – 3R1
1 1 1 : 9
[𝐴: 𝐵] = [0 −5 2 : −5]
0 1 2 : 13
~ R3→ 5R3 + R2
1 1 1 : 9
[𝐴: 𝐵] = [0 −5 2 : −5]
0 0 12 : 60
Now, from R3, we get,
12𝑥3 = 60
∴ 𝑥3 = 5
From R2 we get,
−5𝑥2 + 2𝑥3 = −5
−5 − 2 ∗ 5
∴ 𝑥2 = =3
−5
Similarly, from R1 we get,
𝑥1 + 𝑥2 + 𝑥3 = 9
∴ 𝑥1 = 9 − 3 − 5 = 1
Hence, from above calculation, we calculated the value of (𝑥1 , 𝑥2 , 𝑥3 ) to be (1,3,5) respectively
using Gauss Jordan Method.

7. Solve the following set of linear simultaneous equations by Gauss Jorden


method.
8x1 + 4x2+ 2x3 = 24; 4x1 + 10x2+ 5x3 +4x4 = 32;
2x1 + 5x2+ 6.5x3 +4x4 =26; 4x2+ 4x3 +9x4 = 21;
Solution:
The augmented matrix of the given system is,
8 4 2 0 : 24
4 10 5 4 : 32
[ ]
2 5 6.5 4 : 26
0 4 4 9 : 21
~ Applying R2 → 2 R2- R1 & R3 → 4 R3- R1
8 4 2 0 : 24
0 16 8 8 : 40
[ ]
0 16 24 24 : 80
0 4 4 9 : 21
~ Applying R1 → 4 R1- R2 , R3 → R3- R2 & R4 → 4R4- R2
32 0 0 −8 : 56
0 16 8 8 : 40
[ ]
0 0 16 8 : 40
0 0 8 28 : 44
~ Applying R2 → 2R2- R3 & R4 → 2R4- R3
32 0 0 −8 : 56
0 32 0 8 : 40
[ ]
0 0 16 8 : 40
0 0 0 48 : 48
~ Applying R1 → 6 R1+R4 , R2 → 6R2- R4 & R3 → 6R3- R4
192 0 0 0 : 384
0 192 0 0 : 192
[ ]
0 0 96 0 : 192
0 0 0 48 : 48
From R1 ; 192x1 = 384 ⸫ x1= 2
From R2 ; 192x2 = 192 ⸫ x2= 1
From R3 ; 96x3 = 192 ⸫ x3= 2
From R4 ; 192x1 = 384 ⸫ x4= 1
Hence, x1= 2, x2= 1, x3 = 2, x4 = 1, which is required set of solution.

8. Solve the following set by Gauss Jorden method.


3x1 + x2+ 2x3 = 3; 2x1 - 3x2- x3 = -3; x1 + 2x2+ x3 =4;
The augmented matrix of the given system is,
3 1 2 : 3
[2 −3 −1 : −3]
1 2 1 : 4
~ Applying R2 → 3R2- R1 & R3 → 3R3- R1
3 1 2 : 3
[0 −11 −7 : −15]
0 5 1 : 9
~ Applying R3 → 5R2+ 11R3
3 1 2 : 3
[0 −11 −7 : −15]
0 0 24 : 24
1
~ Applying R3 → 3R3 * - 24

3 1 2 : 3
[0 −11 −7 : −15]
0 0 1 : −1
~ Applying R1 → R1- 2R3 & R2 → R2+7 R3
3 1 0 : 5
[0 −11 0 : −22]
0 0 1 : −1
1
~ Applying R2 → R2 * - 11

3 1 0 : 5
[0 1 0 : 2]
0 0 1 : −1
~ Applying R1 → R1- R2
3 0 0 : 3
[0 1 0 : 2]
0 0 1 : −1
1
~ Applying R1 → R1 * 3

1 0 0 : 1
[0 1 0 : 2]
0 0 1 : −1
Hence,
x1= 1, x2= 2, x3= -1 which is required set of solution.

4.4 Indirect (Iterative) Method for solving system of linear


equation
9. Solve the following set of linear simultaneous equation by Gauss Jacobi Iteration
method.
3x1-20x2-x3=-18; 2x1-3x2+20x3=25; 20x1-20x2-x3=17

Solution:-
Arranging the given system in large in order
20x1-20x2-x3=17
3x1-20x2-x3=-18
2x1-3x2+20x3=25
Now, the given system can be written as
X1=[17+20x2+x3]1/20
X2=-[-18-3x1+x3]1/20
X3=[25-2x1+3x2]1/20
Let initial approximation be
X1=0, x2=0, x3=0
Then, successive iteration is given as;
No. of iteration X Y Z
0 0 0
1 o.85 0.9 1.25
2 1.8125 0.965 1.3
3 1.88 1.106875 1.2135
4 2.01755 1.121325 1.2280
5 2.03273 1.14124 1.2165
6 2.0520 1.1440 1.2179
7 2.0549 1.1469 1.2164
8 2.0577 1.1474 1.2165
9 2.0582 1.1478 1.2163
The iteration 8th and 9th are similar up to 3 decimal points
i.e, x1=2.058 , x2=1.147 , x3=1.216

10. Solve the following set of linear simultaneous equation by Gauss Seidel iteration
method.
3x1-20x2-x3=-18; 2x1-3x2+20x3=25; 20x1+x2-2x3=17

Solution: -
Here, we make diagonally dominant form of system of linear equation.
20x1+x2-2x3=17
3x1-20x2-x3=-18
2x1-3x2+20x3=25
And,
X1=[17-x2+2x3]1/20
X2=-[-18-3x1+x3]1/20
X3=[25-2x1+3x2]1/20
Let initial guess be x=y=z=0
Iteration 1
X1=[25-2*0+3*0]1/20 =0.85
X2=-[-18-3*0.85+0]1/20 =1.0275
X3=[25-2*0.85+3*1.0275]1/20 =1.3192
Iteration 2
X1=[17-1.0275+2*1.31927]1/20 =0.9305
X2=-[-18-3*0.9305+1.3192]1/20 =0.9306
X3=[25-2*0.9305+3*0.9306]1/20 =1.3029
Iteration 3
X1=[17-0.9306+2*1.3029]1/20 =0.9316
X2=-[-18-3*0.9316+1.3029]1/20 =0.9746
X3=[25-2*0.9316+3*0.9746]1/20 =1.3030
Iteration 4
X1=[17-0.9746+2*1.3030]1/20 =0.9316
X2=-[-18-3*0.9316+1.3030]1/20 =0.9746
X3=[25-2*0.9316+3*0.9746]1/20 =1.3030
The value of 3rd and 4th iteration is said to be same and equal value so, the operation stop.
X1=0.9316, X2=0.9746, X3=1.3030

11. Solve The Following Set Of Linear Simultaneous Equation By Gauss Seidel Iteration
Method.
10x-2y-z-w=3 ; -2x+10y-z-w=15; -x-y+10z-2w=27; -x-y-2z+10w=-9;

Solution: -

Here, The Given system is Diagonally Dominant. It can be written as;

10x-2y-z-w=3, -2x+10y-z-w=15, -x-y+10z-2w=27, -x-y-2w+10w=-9

And

X=1(3+2y+z+w)/10

Y=1(15+2x+z+w)/10

Z=1(27+x+y+2 w)/10

W=1(-9+x+y+2z)/10
Let initial value x=y=z=w=0

Now, tabulating the successive iterations; we have,

No of iteration X Y Z W

1 0.3 1.56 1.5 -0.9

2 0.672 1.62 1.536 -0.414

3 0.7362 1.7466 1.7136 -0.3636

4 0.7843 1.7823 1.7492 -0.309

5 0.8005 1.8009 1.773 3 -0.2935

6 0.8082 1.8080 1.7815 -0.2852

7 0.8113 1.8113 1.7854 -0.2820

8 0.8126 1.8126 1.7869 -0.2806

9 0.8131 1.8131 1.7876 -0.2801

The iteration at 8th and 9th position is similar (or exact)

Hence, X=0.81

Y=1.81

Z=1.78

W=-0.280

4.5 MATRIX INVERSION PROBLEM


12. Find the inverse of the matrix by the Gauss Elimination Method.
1 2 1

2 3 -1

2 -1 3

Solution: -

Let, X = x11 x12 x13

X21 x22 x23

X31 x32 x33

Then, AX = I

The Augmented matrix is;

1 2 1 : 1 0 0

2 3 -1 : 0 1 0

2 -1 3 : 0 0 1

~R3:R3-2R1 ; R2:R2-2R1

1 2 1 : 1 0 0

0 -1 -3 : -2 1 0

0 -5 1 : -2 0 1

~R3:R3-5R2

1 2 1 : 1 0 0

0 -1 -3 : -2 1 0

0 0 16 : 8 -5 1

This is equivalent to three systems;

1 2 1 x11 1

0 -1 -3 x21 = -2
0 0 16 x31 8

By using backward substitution; we get,

From R1;

X31 = 8/16 = ½

From R2;

X21 = ½

From R3;

x11 = -1/2

Second system

1 2 1 x12 0

0 -1 -3 x22 = 2

0 0 16 x32 -5

X32 = -5/16

X22 = -17/16

X12 = 39/16

Third system;

1 2 1 x13 0

0 -1 -3 x23 = 0

0 0 16 x33 1

X33=1/16

X23 =-3/16

X13 = 5/16
Hence,

-1/2 39/16 5/16

A-1 = 1/2 -17/16 -3/16

1/2 -5/16 1/16

13. Find the inverse of the matrix by the Gauss- Elimination method.

3 −1 10 2
5 1 2 3
A=[ ]
9 7 39 4
1 −2 2 1
Solution :
𝑥11 𝑥12 𝑥13 𝑥14
𝑥21 𝑥22 𝑥23 𝑥24
Let X = [ ] be the inverse of A.
𝑥31 𝑥32 𝑥33 𝑥34
𝑥41 𝑥42 𝑥43 𝑥44
i.e. AX=I
The augmented matrix is;
3 −1 10 2 : 1 0 0 0
5 1 2 3 : 0 1 0 0
[ ]
9 7 39 4 : 0 0 1 0
1 −2 2 1 : 0 0 0 1
Applying R2 → 3R2 – 5R1, R3 → R3 – 3R1, R4 → 3R4 – R1
3 −1 10 2 : 1 0 0 0
0 8 −44 −1 : −5 3 0 0
[ ]
0 10 9 −2 : −3 0 1 0
0 −5 −4 1 : −1 0 0 3
Applying R3 → 4R3 – 5R2, R4 → 8R4 + 5R2
3 −1 10 2 : 1 0 0 0
0 8 −44 −1 : −5 3 0 0
[ ]
0 0 256 −3 : 13 −15 4 0
0 0 252 3 : −33 15 0 24
Applying R4 → 64R4 - 63R3
3 −1 10 2 : 1 0 0 0
0 8 −44 −1 : −5 3 0 0
[ ]
0 0 256 −3 : 13 −15 4 0
0 0 0 381 : −2931 1905 −252 1536
This is equivalent to four systems.
First system
3 −1 10 2 𝑥11 1
0 8 −44 −1 𝑥21 −5
[ ][ ]=[ ]
0 0 256 −3 𝑥31 13
0 0 0 381 𝑥41 −2931
From R4; x41 = -977/127
From R3; 256x31 – 3X41 = 13  x31 = -5/127
From R2; 8x21 – 44x31 – x41 = -5  x21 = -229/127

From R1; 3x11 – x21 + 10x31 + 2x41 = 1  x11 = 634/127

Second system

3 −1 10 2 𝑥12 0
0 8 −44 −1 𝑥22 3
[ ][ ]= [ ]
0 0 256 −3 𝑥32 −15
0 0 0 381 𝑥42 1905

From R4; 381x42 = 1905  x42 =5

From R3; 256x32 – 3x42 = -15  x32 = 0

From R2; 8x22 – 44x32 – x42 = 3 x22 = 1

From R1; 3x12 – x22 + 10x32 + 2x42 = 0  x12 = -3

Third system

3 −1 10 2 𝑥13 0
0 8 −44 −1 𝑥23 0
[ ][ ]=[ ]
0 0 256 −3 𝑥33 4
0 0 0 381 𝑥43 −252
From R4;  x43 = -84/187

From R3; 256x33 – 3x43 = 4  x33 = 1/127

From R2; 8x23 – 44x33 – x43 = 0  x23 = -5/127

From R1; 3x13 – x23 + 10x33 + 2X43 = 0  X13 = 51/127

Fourth system

3 −1 10 2 𝑥14 0
0 8 −44 −1 𝑥24 0
[ ][ ]=[ ]
0 0 256 −3 𝑥34 0
0 0 0 381 𝑥44 1536

From R4;  x44 = 512/127

From R3; 256x34 – 3x44 = 0 x34 = 6/127

From R2; 8x24 – 44x34 – x44 = 0  x24 = 97/127

From R1; 3x14 – x24 + 10x34 + 2x44 = 0 x14 = -329/127

Hence,

634/127 −3 51/127 −329/127


−229/127 1 −5/127 97/127
A-1 = [ ]
−5/127 0 1/127 6/127
−977/127 5 −84/127 512/127

4.6 Eigen values, Eigen vectors and Power method problems


𝟒 𝟏
14. Find the all the eigen values of the matrix | | using the Power method.
𝟐 𝟔
Solution:

Here, all row contains non-zero elements.

1
 Initial eigen vector, X (0) = ( )
1

4 1 1 5
AX(0) = ( )( )=( )
2 6 1 8

0.625
= 8( ) = (1) X (1)
1

Second relation,

4 1 0.625 3.5
AX (1) = ( )( )=( )
2 6 1 7.25

0.48276
= 7.25 ( ) = (2)X(2)
1

Third Iteration,

4 1 0.48276 2.93104
AX (2) =( )( )=( )
2 6 1 6.96552

0.421
= 6.97( ) = (3)X(3)
1

Fourth Iteration,

4 1 0.421 2.684
AX (3) =( )( )=( )
2 6 1 6.842

0.392
= 6.842( ) = (4)X(4)
1

Fifth Iteration,
4 1 0.392 2.568
AX (4) =( )( )=( )
2 6 1 6.784

0.379
= 6.784( ) = (5)X(5)
1

Sixth Iteration,

4 1 0.379 2.516
AX (5) =( )( )=( )
2 6 1 6.758

0.372
= 6.758( ) = (6)X(6)
1

Seventh Iteration,

4 1 0.372 2.488
AX (6) =( )( )=( )
2 6 1 6.744

0.369
= 6.744( ) = (7)X(7)
1

Eighth Iteration,

4 1 0.369 2.476
AX (7) =( )( )=( )
2 6 1 6.738

0.367
= 6.738( ) = (8)X(8)
1

Ninth Iteration,

4 1 0.367 2.468
AX (8) =( )( )=( )
2 6 1 6.734

0.367
= 6.734( ) = (9)X(9)
1

 Eigen values of the matrix are;


6.97, 6.842, 6.784, 6.758, 6.744, 6.738, 6.734

𝟔 −𝟒 𝟑
15. Find the largest eigenpair of [𝟐 𝟑 𝟐] using the Power method.
𝟏 𝟐 𝟒

Solution:

Here, all row contains non-zero elements.

1
 Initial eigen pair vector, X(0) = [1]
1

6 −4 3 1 5
(0)
AX = [2 3 2] [1] = [7]
1 2 4 1 7

0.7143
= 7 [ 1 ] = (1) X (1)
1

Second relation,

6 −4 3 0.7143 3.2858
(1)
AX = [2 3 2] [ 1 ] = [6.4286]
1 2 4 1 6.7143

0.489
= 6.7143 [0.957] = (2)X(2)
1

Third Iteration,

6 −4 3 0.489 2.106
(2)
AX =[2 3 2] [0.957] = [5.849]
1 2 4 1 6.403
0.329
= 6.403 [0.913] = (3)X(3)
1

Fourth Iteration,

6 −4 3 0.329 1.322
AX (3) =[2 3 2] [0.913] = [5.397]
1 2 4 1 6.155

0.215
= 6.155 [0.877] = (4)X(4)
1

Fifth Iteration,

6 −4 3 0.215 0.782
AX (4) =[2 3 2] [0.877] = [5.061]
1 2 4 1 5.97

0.131
= 5.97 [0.847] = (5)X(5)
1

Sixth Iteration,

6 −4 3 0.131 0.398
AX (5) =[2 3 2] [0.847] = [4.803]
1 2 4 1 5.825

0.068
= 5.825 [0.825] = (6)X(6)
1

Seventh Iteration,

6 −4 3 0.068 0.108
AX(6) =[2 3 2] [0.825] = [4.611]
1 2 4 1 5.718
0.019
= 5.718 [0.806] = (7)X(7)
1

Eighth Iteration,

6 −4 3 0.019 −0.11
AX(7) =[2 3 2] [0.806] = [ 3.65 ]
1 2 4 1 5.631

−0.019
= 5.631 [ 0.648 ] = (8)X(8)
1

0.019
Hence, the largest eigen pair is [0.806].
1

4.7 Matrix Problems


16. Find the inverse of the matrix by the Gauss – Jordan method.

𝟏 𝟐 𝟏
[𝟐 𝟑 −𝟏]
𝟐 −𝟏 𝟑
𝑥11 𝑥12 𝑥13
Let X = [𝑥21 𝑥22 𝑥23] be the inverse of A.
𝑥31 𝑥32 𝑥33

Then, AX = I

The augmented matrix is,

1 2 1 : 1 0 0
[2 3 −1 : 0 1 0]
2 −1 3 : 0 0 1

Applying R2 → R2 – 2R1, R3 → R3 – 2R1

1 2 1 : 1 0 0
[0 −1 −3 : −2 1 0]
0 −5 1 : −2 0 1

Applying R1 → R1 + 2R2, R3 → R3 – 5R2

1 0 −5 : −3 2 0
[0 −1 −3 : −2 1 0]
0 0 16 : 8 −5 1

Applying R1 → 16R1 + 5R3, R2 → 16R2 + 3R3

16 0 0 : −8 7 5
[0 −16 0 : −8 1 3]
0 0 16 : 8 −5 1

This is equivalent to three systems.

First system,

16 0 0 𝑥11 −8
[0 −16 0 ] [𝑥21] = [−8]
0 0 16 𝑥31 8
 16x11 = -8  x11 = -0.5

-16x21 = -8  x21 = 0.5

16x31 = 8 x31 = 0.5

Second system,

16 0 0 𝑥12 7
[0 −16 0 ] [𝑥22] = [ 1 ]
0 0 16 𝑥32 −5

 X12 = 0.4375, x22 = -0.0625, x32 = -0.3125

Third system,

16 0 0 𝑥13 5
[0 −16 0 ] [𝑥23] = [3]
0 0 16 𝑥33 1

 x13 = 0.3125, x23 = -0.1875, x33 = 0.0625

−0.5 0.4375 0.3125


Hence, A-1 = [ 0.5 −0.0625 −0.1875] .
0.5 −0.3125 0.0625

𝟐 −𝟏 𝟐
17. Find the inverse of matrix by Cholesky method.[−𝟏 𝟏 −𝟏]
𝟐 −𝟏 𝟑
Solution:
2 −1 2 𝑙11 0 0 𝑙11 𝑙21 𝑙31
Let A=[−1 1 −1]=[𝑙21 𝑙22 0 ] = [ 0 𝑙22 𝑙32 ]
2 −1 3 𝑙31 𝑙32 𝑙33 0 0 𝑙33
2 −1 2 𝑙112 𝑙11 . 𝑙21 𝑙11 𝑙33
2 2
[−1 1 −1]=[𝑙21 𝑙11 𝑙21 + 𝑙22 𝑙21 𝑙31 + 𝑙21 𝑙32 ]
2
3 −1 3 𝑙31 𝑙11 𝑙31 𝑙21 + 𝑙22 𝑙32 𝑙31 𝑙32 + 𝑙33 2
2

By comparing;
𝑙11 2=2, 𝑙11=√2 𝑙22 = 1

𝑙21=−1 𝑙32=0
√2

𝑙31= 2 𝑙33 = 1
√2

Now,
𝐴−1 =(𝐿−1 )𝑇 (𝐿−1 )
𝐿11 ∗ 0 0
Let 𝐿−1=𝐿∗ [𝐿21 ∗ 𝐿22 ∗
0 ]
𝐿31 ∗ 𝐿32 ∗ 𝐿33 ∗
Now,

√2 0 0 𝐿11 ∗ 0 0 1 0 0
−1 −1
L*L=1 [ 2 0] [𝐿21 ∗ 𝐿22 ∗
0 ] =[0 1 0]
2

√2 0 1 𝐿31 𝐿32 ∗ 𝐿33 ∗ 0 0 1
1
√2𝐿11 ∗ =1 , 𝐿11 ∗ = √2
−1 1 −1
*𝐿11 ∗ -𝐿21 ∗ √2 = 0 , 𝐿21 ∗ =
√2 √2
_1
∗ 𝐿22 ∗ = 1, 𝐿22 ∗ =√2
√2

√2𝐿11 ∗ +𝐿31 ∗ = 0 , 𝐿31 ∗ = −1 , 𝐿32 ∗ = −1 , 𝐿33 ∗ = 1

By comparing; we get,
1
0 0
√2
𝐿∗ =𝐿−1 =[ 1 √2 0]
√2
−1 0 1
So,
2 1 −2
𝐴−1 = [ 1 2 0 ].
−1 0 1

18. Find the inverse of the coefficient matrix of the following linear equation and solve
the system of equation as X=A-1b where b is right hand side.

x1 + x2 + x3 = 2
2x1 + 3x2 - 20x3= 1
4x1 - x2 + 3x3= 10
Solution :
System of equation can be written as form as :
1 1 1 𝑥 2
𝑦
[2 3 −20] [ ] = [ 1 ]
4 −2 3 𝑧 10
For A-1
1 1 1
IAI = |2 3 −20|
4 −1 3
= (9-20)-1(6+80)+1(-2-12)
= -11-86-14
= -111
Here,
cofactor of a11 = -11 cofactor of a31= -23
cofactor of a12= -86 cofactor of a32= 22
cofactor of a21= -14 cofactor of a33= 1
cofactor of a22= -1 cofactor of a23= 5

−11 −86 −14


Adj (A) =[ −4 −1 5 ]
−23 22 1
−11 −4 −23
= [−86 −1 22 ]
−14 5 1
−11 −4 −23
1 1
A-1= |𝐴|
x Adj (A) = 111 [−86 −1 22 ]
−14 5 1
11 4 23
1
=111 [86 1 −22]
14 −5 −1
11 4 23 2
1
And, X = 111 [ 6 1 −22] [ 1 ]
14 −5 −1 10
𝑥 22 + 4 + 230
1
𝑦
[ ] = 111 [172 + 1 − 220]
𝑧 28 − 5 − 10
256
x= 111
47
y= 111
13
z= 111

5 Chapter-5
Solution of Ordinary Differential Equations

5.1 One Step Methods to solve first order initial value Problems
1. Use the Taylor method to solve the equation 𝒚′ = 𝒙𝟐 + 𝒚𝟐 for 𝒙 = 𝟎. 𝟐𝟓 and 𝒙 = 𝟎. 𝟓
given 𝒚(𝟎) = 𝟏.

Solution:
Given,
𝑑𝑦
= 𝑥 2 + 𝑦 2 , 𝑥0 = 0 , 𝑦(𝑥0 ) = 𝑦0 = 1
𝑑𝑥

To find y(0.25) and y(0.5)


By Taylor’s method:

(𝑥 − 𝑥0 )2 (𝑥 − 𝑥0 )3 (𝑥 − 𝑥0 )4
y(𝑥) = 𝑦0 + (𝑥 − 𝑥0 )(𝑦0 ) + (𝑦2 )0 + (𝑦3 )0 + (𝑦4 )0
2! 3! 4!
+ … … … … … … ….

Since,
𝑦 ′ = 𝑦1 = 𝑥 2 + 𝑦 2
⟹ (𝑦1 )0 = 𝑥02 + y 2
=0+1
=1

Then,
d𝑦1
𝑦2 = = 2 𝑥 + 2𝑦𝑦′
dx
⟹ (𝑦2 )0 = 2 × 0 + 2 × 1 × 1
=2

d𝑦2
𝑦3 = = 2 + 2(y ′′ y + y ′ y ′ )
dx
⟹ (𝑦3 )0 = 2 + 2(2 × 1 + 1 × 1)
=8

d𝑦3
𝑦4 = = 2(yy ′′′ + y ′′ y ′ + y ′ y ′′ + y ′ y ′′ )
dx

⟹ (𝑦4 )0 = 2(1 × 8 + 2 × 1 + 1 × 2 + 1 × 2) = 28
Putting these values in equation (1);
We get,
(𝑥 − 0)2 (𝑥 − 0)3 (𝑥 − 0)4
(𝑥
y(𝑥) = 1 + − 0) × 1 + ×2+ ×8+ × 28 + … … … ..
2! 3! 4!
4 7
y(𝑥) = 1 + 𝑥 + 𝑥 2 + 𝑥 3 + 𝑥 4 + … … … ….
3 6
Finally,
For
4 7
y(0.25) = 1 + 0.25 + (0.25)2 + 3 × (0.25)3 + 6 × (0.25)4 + … … … ….
= 1.3378 (approx)
4 7
y(0.5) = 1 + 0.5 + (0.5)2 + × (0.5)3 + × (0.5)4 + … … … ….
3 6
= 1.9895 (approx)

2. Find 𝒚(𝟎. 𝟏) and 𝒚(𝟎. 𝟐) using Taylor method to solve the equation 𝒚′ = 𝒙𝟐 𝒚 −
𝟏, 𝒚(𝟎) = 𝟏.

Solution:
Given,
𝑑𝑦
𝑦′ = = 𝑥2𝑦 − 1
𝑑𝑥
𝑥0 = 0 , y(𝑥0 ) = 𝑦0 = 1

To find y(0.1) and y(0.2) :


By Taylor’s method:

(𝑥 − 𝑥0 )2 (𝑥 − 𝑥0 )3 (𝑥 − 𝑥0 )4
y(𝑥) = 𝑦0 + (𝑥 − 𝑥0 )(𝑦0 ) + (𝑦2 )0 + (𝑦3 )0 + (𝑦4 )0
2! 3! 4!
+ … … … … … … ….

Since,
𝑦1 = 𝑥 2 𝑦 − 1
⟹(𝑦1 )0 = 𝑥02 𝑦0 − 1
= 0×1−1
= −1
Again,
d𝑦1
𝑦2 = = 𝑥 2 𝑦1 + 2𝑥𝑦 − 0
dx
⟹(𝑦2 )0 = 𝑥02 (𝑦1 )0 + 2𝑥0 𝑦0
=0+2×1×0
=0

d𝑦2
𝑦3 = = 𝑥 2 𝑦2 + 2𝑥𝑦1 + 2𝑥𝑦1 + 2𝑦
dx
⟹(𝑦3 )0 = 𝑥02 (𝑦2 )0 + 2𝑥0 (𝑦1 )0 + 2𝑥0 (𝑦1 )0+2𝑦0
=0+0+2
=2
d𝑦3 2
𝑦4 = = 𝑥 𝑦3 + 2𝑥𝑦2 + 2𝑥𝑦2 + 2𝑦1 + 2𝑥𝑦2 + 2𝑦1 +2𝑦1
dx

⟹(𝑦4 )0=0+0+0+2× −1 + 0 +2× −1+2× −1


=-6
Putting these values in equation of Taylor’s method,
(𝑥 − 0)2 (𝑥 − 0)3 (𝑥 − 0)4
y(𝑥) = 1 + (𝑥 − 0) × (−1) + ×0+ ×2+ × −6 + … … … … … …
2! 3! 4!
𝑥3 × 2 6 × 𝑥4
𝑦(𝑥) = 1 − 𝑥 + − + … … … … … ..
3! 4!
𝑥3 𝑥4
𝑦(𝑥) = 1 − 𝑥 + − + … … … … …
3 4
Now,
For 𝑥 = 0.1,
(0.1)3 (0.1)4
𝑦(0.1) = 1 − 0.1 + − + …….………
3 4
Therefore, we get,
𝑦(0.1) ≈ 0.9003(𝑎𝑝𝑝𝑟𝑜𝑥)
(0.2)3 (0.2)4
𝑦(0.2) = 1 − 0.2 + − + …….………
3 4
𝑦(0.2) ≈ 0.8022(𝑎𝑝𝑝𝑟𝑜𝑥)
3. Use Picard’s method to solve the following equations and find 𝒚(𝟎. 𝟏), 𝒚(𝟎. 𝟐)
and 𝒚(𝟏).
a. 𝒚′ (𝒙) = 𝒙𝟐 + 𝒚𝟐 , 𝒚(𝟎) = 𝟎
b. 𝒚′ (𝒙) = 𝒙𝟐 𝒆𝒚 , 𝒚(𝟎) = 𝟎

𝒂. 𝒚′ (𝒙) = 𝒙𝟐 + 𝒚𝟐 , 𝒚(𝟎) = 𝟎
Solution
Given,
𝑥0 = 0,
𝑦0 = y(𝑥0 ) = 0,
f(𝑥, 𝑦) = 𝑥 2 + 𝑦 2 ,
Using Picard’s method,
x
𝑦n+1 = 𝑦0 + ∫ f(𝑥, 𝑦n )d 𝑥
𝑥0

n = 0, (1st approx)
x
𝑦1 = 𝑦0 + ∫ f(𝑥, 𝑦0 )d 𝑥
𝑥0
x
=0 + ∫0 f(𝑥 2 +𝑦02 )d 𝑥
𝑥3
=3

n = 1, (2nd approx)
x
𝑦1 = 𝑦0 + ∫ f(𝑥, 𝑦1 )d 𝑥
𝑥0
x
=0 + ∫0 f(𝑥 2 + 𝑦12 )d 𝑥
x 𝑥 3×2
= ∫0 f (𝑥 2 + 32 ) d 𝑥
𝑥3 𝑥7
= +
3 9×7
𝑥3 𝑥7
= 3 + 63

n = 2, (3rd approx)
x
𝑦3 = 𝑦0 + ∫ f(𝑥, 𝑦2 )d 𝑥
𝑥0
x
=0 + ∫0 f(𝑥 2 + 𝑦22 )d 𝑥
2
x 2 𝑥3 𝑥7
=∫0 [𝑥 + ( 3 + 63) ] d 𝑥
x 𝑥6 𝑥 14 𝑥3 𝑥7
=∫0 ( 𝑥 2 + + 632 + 2 × + 63 )d𝑥
9 3
𝑥3 𝑥7 𝑥 15 𝑥 11
= 3 + 9×7 + 59535 + 2 × 189×11
Since, the next integration is difficult, so considering 𝑦3 as approx. solution for given ODE,
𝑥3 𝑥7 𝑥15 𝑥11
y(𝑥) = + + +2×
3 9 × 7 59535 189 × 11
Therefore,
𝑦(0.1) = 3.333 × 10^ − 4
𝑦(0.2) = 2.667 × 10^ − 3
𝑦(1) = 0.35

b. 𝒚′ (𝒙) = 𝒙𝒆𝒚 , 𝒚(𝟎) = 𝟎


Solution :
Given,
𝑥0 = 0, 𝑦0 = 𝑦(𝑥0 ) = 0, f(𝑥, 𝑦) = 𝑥𝑒 𝑦
By Picard method,
x
𝑦n+1 = 𝑦0 + ∫ f(𝑥, 𝑦n )d 𝑥
𝑥0
Here,
x
y1 = y0 + ∫ f(x, y0 ) dx
x0

x
y1 = 0 + ∫ (xey ) dx
0

Putting y0=0
at x=0.1
0.1
y1 = 0 + ∫0 (xe0 ) dx =5×10-3

Similarly,
0.1 −3
y2 = 0 + ∫0 (xe5×10 ) dx =5.025×10-3
Successively, we get,

y3=5.0251×10-3
y4=5.025×10-3

At x=0.2
0.2
y1 = 0 + ∫0 (xe0 ) dx =0.02

Similarly,
0.2
y2 = 0 + ∫0 (xe0.02 ) dx =0.0204

Likewise,
We get,

y3=0.0204
y4=0.0204

At x=1
1
y1 = 0 + ∫0 (xe0 ) dx =0.5

Similarly,
1
y2 = 0 + ∫0 (xe0.5 ) dx =0.824

Likewise,

We get,

y3=1.1398
y4=1.5630
y5=2.3865

4. Use Euler’s method to solve y’=3x2+1,y(1)=2.Take step size= 0.5 and estimate
y(2).

Solution:
We know, by Euler’s formula:
yi+1=yi +hf (xi,yi)--------(1)
Given,
f(x,y)=3x2+1
And,
y(1)=2
i.e xo=1 , yo=2
When h=0.5
yi+1=yi+0.5f(xi,yi)-----------(2)
Put i= 0,1,2,3,….
And x= 1,1.5,2,….
>> Table
Iterations x yi+1=yi+0.5f(xi,yi)
i=0 1 y1= 2+0.5×4= 4
i=1 1.5 y2= 4+0.5×7.75= 7.875
i=2 2 y3=7.875+0.5×13= 14.375

Hence, from the table we get: When x=2,we put y=7.875 y(2)=7.875 ans.

5. Solve the equation y’=x+y, y (0) =1 by Euler’s method. Taking step size 0.5 and 0.25,
find y(1).Compute error in both cases. Compare the results with exact solution.

Solution:
We know, by Euler’s formula:
yi+1=yi+hf(xi,yi)---------(1)
Given,
f(x,y)=x+y y(0)=1 i.e xo=0 , yo=1
When h=0.5
yi+1=yi+0.5f(xi,yi)---------(2)
>>Table
Iterations x yi+1=yi+0.5f(xi,yi)
i=0 0 y1=1+0.5×1= 1.5
i=1 0.5 y2=1.5+0.5×2= 2.5
I=3 1 y3=2.75+0.5×3.75= 4.625

Hence, from table:


When x=1 we put y=2.5
Ans: y(1)=2.5

When h=0.25
yi+1=yi+0.25f(xi,yi)---------(3)
>>Table
Iterations x yi+1=yi+0.25f(xi,yi)
i=0 0 y1=1+0.25×1= 1.25
i=1 0.25 y2=1.25+0.25×1.5= 1.625
i=2 0.50 y3=1.625+0.25×2.125=2.15625
i=3 0.75 y4=2.15625+0.25×2.90625=2.8828
i=4 1.0 y5=2.8828+0.25×3.8828=3.8519

Hence,from the table:


When x=1,we put y=2.8828
Ans: y(1)=2.8828

Exact solution:dy/dx=x+y--------(1)
Put x+y=v
Diff. wrt x: 1+ dy/dx=dv/dx dy/dx= dv/dx -1-------(2) From (1) and (2): x+y=dv/dx -1 v=dv/dx -
1 dv/(1+v) =dx
Integrating both sides: ln(1+v)=x+c
1+v=e(x+c)
1+x+y=ex.ec y=Cex-x-1-----(3) (C=ec) Given, y(0)=1
Then,eqn (3) becomes:
1=C.1-0-1
C=2
Hence,put the value of C in (3):
y=2ex-x-1 is the required equation.

For computation of error:From exact solution,y(1)=2e-1-1=3.4365From Euler’smethod:


Taking h=0.5, y(1)=4.625
%error=34.58%
Taking h=0.25, y(1)=3.8519
%error=12.08%

Conclusion: It is more precise if we take small step size.

𝟐𝒚
7. Use Heun’s method to solve 𝒚′ = , 𝒚(𝟏) = 𝟐.Takie step size =0.25 and estimate
𝒙
y(2).

Solution:
Given,
2𝑦
𝑓(𝑥. 𝑦) = 𝑦′ = 𝑥 ,
𝑦(1) = 2, ℎ = 0.25
To find: 𝑦(2) =?
𝑥1 = 𝑥0 + ℎ = 1 + 0.25 = 1.25
𝑥2 = 𝑥0 + 2ℎ = 1 + 2 × 0.25 = 1.5
𝑥3 = 𝑥0 + 3ℎ = 1 + 3 × 0.25 = 1.75
𝑥4 = 𝑥0 + 4ℎ = 1 + 4 × 0.25 = 2

Predictor equation: corrector equation:


0
𝑓(𝑥0 , 𝑦0 ) + 𝑓(𝑥1 , 𝑦10 )
𝑦1 = 𝑦0 + ℎ𝑓(𝑥0 , 𝑦0 )𝑦1 = 𝑦0 + ℎ ×
2
2×2 2×3
2×2 +
= 2 + 0.25 × ( ) = 2 + 0.25 × 1 1.25
1 2
= 3 = 3.1
𝑓(𝑥1 𝑦1 ) + 𝑓(𝑥2 , 𝑦20 )
𝑦20 = 𝑦1 + ℎ𝑓(𝑥1 , 𝑦1 )𝑦2 = 𝑦1 + ℎ ×
2
2 × 3.1 2 × 4.34
2 × 3.1 +
= 3.1 + 0.25 × = 4.34 + 0.25 × 1.25 1.5
1.25 2
= 4.34 = 5.6833
𝑓(𝑥2 , 𝑦2 ) + 𝑓(𝑥3 , 𝑦30 )
𝑦30 = 𝑦2 + ℎ𝑓(𝑥2 , 𝑦2)𝑦3 = 𝑦2 + ℎ ×
2
2 × 5.6833 2 × 7.577
2 × 5.6833 +
= 5.6833 + 0.25 × = 5.6833 + 0.25 × 1.5 1.75
1.5 2
= 7.577 = 7.7129
𝑓(𝑥3 , 𝑦3 ) + 𝑓(𝑥4 , 𝑦40 )
𝑦40 = 𝑦3 + ℎ𝑓(𝑥3 , 𝑦3 )𝑦4 = 𝑦3 + ℎ ×
2
2 × 7.7129 2 × 16.527
2 × 7.7129 +
= 7.7129 + = 7.7129 + 0.25 × 1.75 2
1.75 2
= 16.527 = 10.8806
Therefore, the required answer is 10.8806.

9. Solve the differential equation 𝒚′ = 𝒙𝟐 𝒚 + 𝟐𝒙, given 𝒚(𝟎) = 𝟎, use step size
0.2 and find
𝒚(𝟎. 𝟒).

Solution:
Given,
𝑦 = 𝑥 2 𝑦 + 2𝑥, 𝑥0 = 0, 𝑦(0.4) =?

𝑦0 = 0 , ℎ = 0.2
We know,
1
𝑦𝑛+1 = 𝑦𝑛 + 𝑘4
6
When n=0,
1
𝑦1 = 𝑦0 + (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
6
where,
𝑘1 = ℎ𝑓(𝑥𝑛 , 𝑦𝑛 )
= ℎ𝑓(𝑥0 , 𝑦0 )
= 0.2 × 𝑓(0,0)
=0
ℎ 𝑘1
𝑘2 = ℎ𝑓(𝑥0 + , 𝑦0 + )
2 2
= 0.2𝑓(0.1,0)
= 0.2 × (0. 12 × 0 + 2 × 0.1)
= 0.04
ℎ 𝑘2
𝑘3 = ℎ𝑓(𝑥0 + , 𝑦0 + )
2 2
= 0.2 × 𝑓(0.1,0.02)
= 0.2 × (0. 12 × 0.02 + 2 × 0.1)
= 0.04004
𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 )
= 0.2 × 𝑓(0.2,0.04)
= 0.2 × (0. 22 × 0.04 + 2 × 0.2)
= 0.08
so,
1
𝑦1 = 𝑦0 + 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )becomes,
1
= 0 + (0 + 2 × 0.04 + 2 × 0.04004 + 0.08)
6
= 0.04001
Now,
1
𝑦2 = 𝑦1 + (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
6
where,
𝑘1 = ℎ𝑓(𝑥1 , 𝑦1 )
= 0.2 × 𝑓(0.2,0.04)
= 0.2 × (0. 22 × 0.04 + 2 × 0.2)
= 0.08032
ℎ 𝑘1
𝑘2 = ℎ𝑓(𝑥1 + , 𝑦1 + )
2 2
0.2 0.08
= 0.2 × 𝑓(0.2 + , 0.04 + )
2 2
= 0.2 × 𝑓(0.3,0.08)
= 0.2 × (0. 32 × 0.08 + 2 × 0.3)
= 0.12144
ℎ 𝑘2
𝑘3 = ℎ𝑓(𝑥1 + , 𝑦1 + )
2 2
0.2 0.1214
= 0.2 × 𝑓(0.2 + , 0.04 + )
2 2
= 0.2 × 𝑓(0.3,0.1007)
= 0.2 × (0. 32 × 0.1007 + 2 × 0.3)
= 0.1218
𝑘4 = ℎ𝑓(𝑥0 + ℎ, 𝑦0 + 𝑘3 )
= 0.2 × 𝑓(0.2 + 0.2,0.04 + 0.1218)
= 0.2 × 𝑓(0.4,0.1618)
= 0.2 × (0. 42 × 0.1618 + 2 × 0.4)
= 0.1651
1
𝑦2 = 𝑦1 + 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )becomes,
1
= 0.04001 + (0.08032 + 2 × 0.12144 + 2 × 0.1218 + 0.1651)
6
= 0.1619
Therefore, the required answer for y(0.4) is 0.1619 using Runge-Kutta method.

10. Solve the initial value problem y’=0.5(1+x) y2 y (0) =1, for α=0 0.1 0.6 using
midpoint method formula.
Solution:
Here, y’=0.5(1+x) y2 , y(x0) =y0=1 x0=0 h=0.1
We have
yi+1=yi+k2h ---------1
Where,
k1=f (xi, yi)
k2=f(x1+1/2hiyi+1/2k1h)
So
k1=f(x0, y0)
=f (0, 2)
=0.5
k2=f(x0+1/2hiy0+1/2k1h)
=f (0.05, 1.025)
=0.5515
Y1=y0 +k2h
=1+0.5515*0.1
=1.055
Therefore, y (1) =1.055 (Approx.)
ⅆ𝒚
11. Find y (0.1) using Euler’s method when ⅆ𝒙 = 𝒙𝟐 +𝒚𝟐 and y (0) =1. Also obtain
y (0.1) using Runge-Kutta method using above equation with given initial
condition. State the reason for the difference in the result.
Solution:
𝑑𝑦
Here,𝑑𝑥 =𝑥 2 +𝑦 2 , 𝑥0 =0, 𝑦0= 1 we have to find y (0.1) =?
2 2
Taking h=0.1 and f (𝑥𝑚, 𝑦𝑚 ) =𝑥𝑚 +𝑦𝑚 , then
2 2
𝑦𝑚+1 =𝑦𝑚 + 0.1(𝑥𝑚 +𝑦𝑚 )
Putting m=0, 1, 2, 3, 4………………….. We get
𝑦0.1 =𝑦0 +0.1(𝑥02 +𝑦02 )
=1 + 0.1(02 +12 )
= 1.1
Hence y (0.1) =1.1
Again by Runge-Kutta method
𝑘1 = h* f ( 𝑥0 , 𝑦0 ) = 0.1f (0.1) =0.1 (02 + 12 ) = 0.1
ℎ ℎ 0.1 0.1
𝑘2 = h* f ( 𝑥0 + 2 , 𝑦0 + 2) = 0.1f (0+ 2 , 1 + ) = 0.1 (0.052 + 1.052 ) = 0.1105
2
ℎ 𝑘2 0.1 0.1105
𝑘3 = h* f ( 𝑥0 + 2 , 𝑦0 + ) = 0.1f (0+ 2 , 1 + ) = 0.1 (0.052 + 1.055252 ) = 0.111605
2 2
0.1 0.1105
𝑘4 = h* f ( 𝑥0 + ℎ, 𝑦0 + 𝑘3 ) = 0.1f (0+ 2 , 1 + ) = 0.1 (0.12 + 1.1116052 ) = 0.12456
2
1 1
Then, k = 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ) = 6 (0.1 + 2*0.1105 +2*0.111605 +0.12456) = 0.111462
Now, y (0.1) = 𝑦0 +k = 1+ 0.111462 = 1.111462

Euler's method is more preferable than Runge-Kutta method because it provides slightly better
results. Its major disadvantage is the possibility of having several iterations that result from a
round-error in a successive step.

12. Solve the initial value problem y’= x y +𝒚𝟐 given that y (0) = 1 for x =
0(0.1)0.3 using Rk4 method.
Solution:
Here, y’= x y + 𝑦 2 , y (0) = 1, h = 0.3
𝑥0 = 0, f (x, y) = x y +𝑦 2
Now using RK4 method,
𝑘1 = h* f ( 𝑥0 , 𝑦0 ) = 0.3*f (0, 1) = 0.3
ℎ ℎ 0.3 0.3
𝑘2 = h* f ( 𝑥0 + 2 , 𝑦0 + 2) = 0.3*f (0+ 2 , 1 + ) = 0.3*f (0.15, 1.15 ) = 0.4485
2
ℎ 𝑘2 0.3 0.4485
𝑘3 = h* f ( 𝑥0 + 2 , 𝑦0 + ) = 0.3*f (0+ ,1 + ) = 0.3*f (0.15, 1.2243) = 0.5047
2 2 2

𝑘4 = h* f ( 𝑥0 + ℎ, 𝑦0 + 𝑘3 ) = 0.3*f (0+ 0.3, 1 + 0.5047) = 0.3*f (0.3, 1.5047) = 0.8147


1 1
Then, k = 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ) = 6 (0.3 + 2*0.4485+2*0.5047 +0.8147) = 0.5035
Now, y (0.1) = 𝑦0 +k = 1+ 0.5035 = 1.5035
Again, 𝑥1 = 0.1, 𝑦1 =1.5035, h = 0.3
𝑘1 = h* f ( 𝑥1 , 𝑦1 ) = 0.3*f (0.1, 1.5035) = 0.723
ℎ ℎ 0.3 0.723
𝑘2 = h* f ( 𝑥1 + 2 , 𝑦1 + 2 ) = 0.3*f (0.1+ 2 , 1.5035 + ) = 0.3*f (0.25, 1. 865) = 1.183
2
ℎ 𝑘2 0.3 1.183
𝑘3 = h* f ( 𝑥1 + 2 , 𝑦1 + ) = 0.3*f (0.1+ 2 , 1.5035 + ) = 0.3*f (0.25, 2.095) = 1.474
2 2

𝑘4 = h* f ( 𝑥1 + ℎ, 𝑦1 + 𝑘3 ) = 0.3*f (0.1+ 0.3, 1.5035 + 1.474 ) = 0.3*f (0.4, 2.978) = 3.016


1 1
Then, k = 6 (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 ) = 6 (0.723 + 2*1.183 +2*1.474 +3.016) = 1.5089
Now, y (0.3) = 𝑦1 +k = 1.5035+ 1.5089 = 3.0125

5.2 Higher Order initial value Problems

13. Solve the following 2nd order differential equation by fourth order
Runge-Kutta method

ⅆ𝟐 𝒒 ⅆ𝒒 𝒒
𝑳 𝟐 +𝐑 + =𝟓
ⅆ𝒕 ⅆ𝒕 𝒄
where, L = 1, C = 0.25, R = 0.5 for t = 0 to 0.2 with a step of 0.1, given q(0) = 0
and q' (0) = 0
SOLUTION:
We have, t = 0 q=0
h = 0.1 q' = 0
𝑑2𝑞 𝑑𝑞 𝑞
𝐿 2 +R + =5
𝑑𝑡 𝑑𝑡 𝑐
L = 1, C = 0.25, R = 0.5, t = 0 to 0.2
let q' = z, q" = z'
𝑞
1*z' + 0.5z + =5
0.25
𝑞
or, z = 5 – 0.5z -
'
0.25
𝑞
g (t, q, z) = 5 – 0.5z -
0.25
where, i = 0,
1
q1 = q0 + ( m1 + 2m2 + 2m3 + m4) …………………. (1)
6
1
z1 = z0 + ( p1 + 2p2 + 2p3 + p4) ……………………... (2)
6
where,
m1 = h z0 = 0.1 × 0 = 0
p1 = h × g(t0, q0, z0)
= 0.1 g (0, 0, 0)
= 0.1 × 5
= 0.5
p1
m2 = h× (z0+ )
2
= 0.025
ℎ m1 p1
p2 = h g(t0 + , q0 + , z0 + )
2 2 2
0.1 0.5
= 0.1 g(0 + , 0 + 0, 0 + )
2 2
= 0.1 g (0.05, 0 , 0.25 )
= 0.4875
p
m3 = h ( z0+ )
2
0.4875
= 0.1 ( 0 + )
2
= 0.2437
h m2 p2
p3 = h g( t0 + , q0 + , z0 + )
2 2 2
= 0.1 × g(0.05, 0.0125, 0.24375 )
= 0.4828
m4 = h ( z0 + p3)
= 0.1 ( 0 + 0.4828 )
= 0.04828
p4 = h g( t0 + h, q0 + m3, z0 + p3 )
0.2437
= 0.1 × (5 – 0.5×0.4828- )
0.25
=0.4661
From (1) and (2),
𝟏
q1 = 0 + ( 0 + 2×0.025 + 2×0.2437 +0.04828)
𝟔
=0.2450
𝟏
z1 = 0 + ( 0.5 + 2×0.4875 + 2×0.0.4828 +0.466)
𝟔
= 0.48445

when i = 1,
1
q2 = q1 + (m1 + 2m2 + 2m3 + m4) …………… (3)
6
1
z2 = z1 + (p1 +2p2 + 2p3 +p4) ………………. (4)
6
m1 = h z1 = 0.1 × 0.4844 = 0.04844

p1 = h g ( t1, q2, z3)

=0.1 g (0.1 ,0.0245, 0.4844)


0.0245
=0.1 × (5 - 0.5 × 0.4844- )
0.25

=0.4659
𝑝1
m2 = h (z1 + )
2

0.4659
= 0.1 × (0.4844 + )
2

=0.07173
h m1 p1
p2 = h g (t1+ , q1 + , z1 + )
2 2 2
= 0.1 ×g (0.15, 0.04872, 0.71735)
=0.4446
p2
m3 = h (z1+ )
2
0.4446
=0.1 (0.4844 + )
2
=0.0706
h m2 p2
p3 = h g (t1+ , q1 + , z1 + )
2 2 2
0.0603
= 0.1 × (5 – 0.5 × 0.7069 - )
0.25
=0.4405

m4= h (z1 + p3) =0.09249


p4 = h g (t1 + h, q1 + m3, z1 +p3)
= 0.1g (0.1 +0.1, 0.0245+ 0.0706, 0.4844+0.4405)
=0.1g(0.2, 0.0951, 0.9249 )
0.0951
=0.1 × (5- 0.5× 0.9249 - )
0.25
=0.4157

From (3) and (4),


𝟏
y2 = 0.02450 + (0.04844+ 2×0.7173 +2 × 0.0706 +0.09249)
𝟔
= 0.09554
𝟏
z2 = 0.48445 + (0.4659+ 2×0.4946 +2 × 0.4405 +0.4157)
𝟔
= 0.9264

14. Using Runge – Kutta (RK-4) method solve y"= xy' + y2, y(0) =1, y'(0)=2, use
step size of 0.1 to find y(0,2).
Solution:
Let,
𝑑𝑦
= 𝑧 = 𝑓 (𝑥, 𝑦, 𝑧)
𝑑𝑥
𝑑𝑧
then, = xz + y2 = Q(x, y, z)
𝑑𝑥
We have,
x0= 0, y0 = 1, z0=0, h=0.2
Therefore, from Runge Kutta Formula,
1
y(x) = y0 + (k1+2k2+2k3+k4)……….(1)
6
1
where, y (x) =z0 + (l1+2l2+2l3+l4)….(2)
'
6
k1=hf(x0, y0, z0) = 0.2(0,1,0) = 0.2 × 0 =0
l1=hØ(x0, y0, z0) = 0.2(0,1,0) = 0.2 × 1 = 0.2
h 1 1
k2 =hf (x0 + , y0+ k1,z0+ l1)
2 2 2
=0.2f(0.1, 1, 0.1)
=0.02
h 1 1
l2 = hf (x0 + , y0+ k2,z0+ l2)
2 2 2
=0.2 (0.101)
=0.202
h 1 1
k3 = hf (x0 + , y0+ k2,z0+ l2)
2 2 2
=0.2 (0.101)
=0.202
h 1 1
l3 = hf (x0 + , y0+ k2,z0+ l2)
2 2 2
=0.2f(0.1,1.01, 0.101)
=0.206
k4= hf (x0+h,y0+k3, z0+l3)
=0.2(0.206)
=0.0412
l4=hf(x0+h, y0+k3, z0+l3)
=0.2f(0.2,1.202,0.206)
=0.297
equation (1) becomes, we get ,
1
y(0.2) = 1 + (0+2×0.02+2×0.202+0.04×2)
6
=1.0808
1
y'(0.2) = 1 + (0+2×0.202+2×0.206+0.297)
6
=0.2188

15. Solve the following system of the simultaneous equation with associated
initial condition using fourth order RungeKutta (RK-4) method.
Y’=y-z y(0)=0
Z’=-y+zz(0)=0
In the range of 0≤x≤1 with step size 0.5.
Solution:
Here
𝑑𝑧
f(x,y,z) = y’=y-z ; (x,y,z) = -y+z
𝑑𝑥

x0=0 ,y0=0 ,z0=0


let us take, h=0.5
k1=hf(x0,y0 ,z0) = 0.5f(0,0,0) =0
L1=hΦ(x0,y0 ,z0) = 0.5Φ(0,0,0) =0
ℎ 𝑘1 𝑙1
K2=hf(x0+ , y0+ , z0 + ) = 0.5f(0.25,0,0)=0
2 2 2
ℎ 𝑘1 𝑙1
L2=hΦ (x0+ , y0+ , z 0+ ) = 0.5Φ(0.25,0,0)=0
2 2 2
ℎ 𝑘2 𝑙2
K3=hf (x0+ , y0+ , z0 + ) = 0.5f(0.25,0,0)=0
2 2 2
ℎ 𝑘2 𝑙2
L3=hΦ (x0+ , y0+ , z 0+ ) = 0.5Φ (0.25,0,0)=0
2 2 2

K4=hf (x0+h, y0+k3 , z0+l3 ) = 0.5f(0.5,0,0) =0


L4=hΦ(x0+h, y0+k3 , z0+l3 ) = 0.5Φ(0.5,0,0) =0
1 1
Now, y(x) = y0 + (k1+2k2+2k3+k4) = 0+ (0+0+0) = 0
6 6
1 1
Z(x) = z0 + (l1+2l2+2l3+l4) = 0+ (0+0+0) = 0
6 6

16. Solve: y’’-x2y’-2xy=0, y(0)=1, y’(0)=0 for y(0.1) using RungeKutta (RK-4)
method.

Solution:-
Given,
y’’-x2y’-2xy=0
x0=0, y0=1, y’=0=z
Put y’=z
Differentiate w.r.t. x,
we obtain y’’=z’

Assume above equation in the form:


z’-x2z-2xy=0

We have, system of equations,


y’=z=f(x,y,z)
z’=x2z+2xy=g(x,y,z)

Using RK-4 formula,


y(x0+h)=y0+(k1+2k2+2k3+k4)/6
k1=hf(x0, y0, z0)=0.1*f(0, 1,0)=0.1*0=0
l1=hg(x0,y0,z0)=0.1*g(0, 1,0)=0

k2=hf(x0+h/2,y0+k1/2,z0+l1/2)
=0.1*f(0.05,1,0)
=0.1*0
=0
l2=h*g(x0+h/2, y0+k1/2, z0+l1/2)
=0.1*g(0.05,1,0)
=0.01
k3=h*f(x0+h/2, y0+k2/2, z0+l2/2)
= 0.1*f(0.05, 1, 0.005)
=0.1*0.005
=0.0005
l3=h*g(0.05,1,0.005)
=0.1*(0.052*0.005+2*0.05*1)
=0.01000125
k4=h*f(x0+h, y0+k3, z0+l3)
=0.1*f(0.1, 1.0005, 0.01000125)
=0.1*0.01000125
=0.001000125
l4=0.1*g(0.1, 1.0005, 0.01000125)
=0.1*(0.12*0.01000125+2*0.1*1.0005)
=0.02002000125
Then,
k=(k1+2k2+2k3+k4)/6
=(0+0+2*0.0005+0.001000125)
=0.0003334
l=(l1+2l2+2l3+l4)/6
=(0+2*0.01+2*0.01000125+0.02002000125)/6
=0.010004

y(0.1)=y0+k
=1+0.0003334
=1.0003334
z(0.1)=z0+l
=0+0.010004
=0.010004

5.3 Shooting Methods: boundary Value Problems


17. Shooting method to solve boundary value problems (BVP):

a) d2y/dx2=6x, y(1)=2, y(2)=9 in the interval (1,2)

Solution:
Let
dy/dx=z=f1(x,y,z)
dz/dx=6x=f2(x, y,z)
let initial guess be m0=1

Now, Applying Euler’s method,

yi+1=yi+hf1(xi, yi, zi)


zi+1=zi+hf2(xi, yi, zi)
At i=0:
y1=y0+hf1(x0, y0, z0)
z1=z0+hf2(x0, y0, z0)

Here,
x0=1, y0=2, z0=1, h=0.5
y1=2+0.5*f1(1,2,1)
=2+0.5*1
=2.5
z1=1+0.5*f1(1,2,1)
=1+0.5*6
=4
⸫y(1.5)=2.5 & z(1.5)=4
At i=1:
y2=y1+h*f1(x1, y1, z1)
z2=z1+h*f2(x1, y1, z1)
Here,
x1=1.5,
y1=2.5, z1=4
y2=2.5+0.5*f1(1.5, 2.5, 4)
=2.5+0.5*4
=4.5
z2=4+0.5*f2(1.5, 2.5, 4)
=4+0.5*(6*1.5)
=8.5
⸫y(2)=4.5 & z(2)=8.5

Again,
Let m1=z(1)=7
At i=0
y1=y0+h*f1(x0,y0,z0)
z1=z0+h*f2(x0,y0,z0)
Here,
x0=1, y0=2, z0=7
y1=2+0.5*f1(1,2,7)
=2+0.5*7
=5.5
z1=7+0.5*f2(1,2,7)
=7+0.5*6
=10
⸫y(1.5)=5.5 & z(1.5)=10
At i=1:
y2=y1+hf1(x1, y1, z1)
z2=z1+hf2(x1, y1, z1)
Here,
x1=1.5, y1=5.5, z1=10
y2=5.5+0.5*f2(1.5, 5.5,10)
=5.5+0.5*10
=10.5
z2=10+0.5*f2(1.5,5.5,10)
=10+0.5*9
=14.5
⸫y(2)=10.5 &z(2)=14.5

For better approximation,


We have,
β =9, β0=4.5, β1=10.5
& m0=1, m1=7
So, m2=m1-( β1- β)(m1-m0)/( β1- β0)
=7-(10.5-9)(7-1)/(10.5-4.5)
=5.5
Hence,
At i=0:
y1=y0+hf1(x0,y0,z0)
z1=z0+hf2(x0,y0,z0)
Here, x0=1, y0=2, z0=5.5
y1=2+0.5*f1(1,2,5.5)=2+0.5*5.5=4.75
z1=5.5+0.5*f2(1,2,5.5)=5.5+0.5*6=8.5
⸫y(1.5)=4.75 & z(1.5)=8.5

At i=1:
y2=y1+hf1(x1,y1,z1)
z2=z1+hf2(x1,y1,z1)
Here, x1=1.5, y1=4.75, z1=8.5
y2=4.75+0.5+f2(1.5,4.75,8.5)
=9.50
z2=10+0.5*f2(1.5,5.5,10)
=13
⸫ y(2)=9 &z(2)=13
The required solution is y(1)=2
y(1.5)=4.75
y(2)=9

b). d2y/dx2=3x+4y , y(0)=1, y(1)=1. Take step size=0.25.


Solution:-

Let dy/dx=z=f1(x,y,z)
dz/dx=3x+4y=f2(x,y,z)
y(0)=1, y(1)=1

Let initial guess,


m0=3

Applying Euler’s method


Yi+1=yi+hf1(xi, yi, zi)
Zi+1=zi+hf2(xi, yi, zi)

At i=0 :
y1=y0+hf1(x0, y0,z0)
z1=z0+h*f2(x0,y0,z0)

Here,
x0=0, y0=1, z0=3, h=0.25
y1=y0+hf1(0,1,3)
=1+0.25*3=1.75
z1=3+0.25*4=4
⸫y(0.25)=1.75, z(0.25)=4

At i=1:
y2=y1+hf1(x1, y1, z1)
z2=z1+hf2(x1, y1, z1)
Here, x1=x0+h=0.25
y2=1.75+0.25*4=2.75
z2=4+0.25*7.75=5.9375
⸫y(0.50)=2.75&z(0.50)=5.9375

At i=2:
y3=y2+hf1(x2, y2, z2)
z3=z2+hf2(x2, y2, z2)
Here, x2=x1+h=0.5
y3=2.75+0.25*5.9375=4.234375
z3=5.9375+0.25*12.5=9.0625
⸫ y(0.75)=4.234375 &z(0.75)=9.0625

At i=3:
y4=y3+hf1(x3, y3, z3)
z4=z3+hf2(x3, y3, z3)
Here, x3=x2+h=0.5+0.25=0.75
y4=4.234375+0.25*9.0625=6.5
z4=9.0625+0.25*19.1875=13.859375
⸫ y(1)=6.5 & z(1)=13.859375

Again, let m1=-3


At i=0
y1=y0+hf1(x0, y0,z0)
z1=z0+h*f2(x0,y0,z0)
Here, x0=0, y0=1, z0=-3
y1=1+0.25*(-3)=0.25
z1=-3+0.25*4=-2
⸫ y(0.25)=0.25 & z(0.25)=-2

At i=1
y2=y1+hf1(x1, y1, z1)
z2=z1+hf2(x1, y1, z1)
Here, x1=0.25
y2=0.25+0.25*(-2)=-0.25
z2=-2+0.25*1.75=-1.5625
⸫ y(0.5)=-0.25 &z(0.5)=-1.5625
At i=2:
y3=y2+hf1(x2, y2, z2)
z3=z2+hf2(x2, y2, z2)
Here, x2=0.25+0.25=0.50
y3=-0.25+0.25*(-1.5625)=-0.640625
z3=-1.5625+0.25*0.5
=-1.4375

At i=3
y4=y3+hf1(x3, y3, z3)
z4=z3+hf2(x3, y3, z3)
Here, x3=0.75
y4=-0.640625+0.5(-1.4375) =-1
z4=-1.4375+0.25*(-0.125) =-1.515625

For better approximation,


We have, β=1, β0=6.5, β1=-1
m0=3, m1=-3

So, m2=m1-( β1- β)(m1-m0)/( β1- β0)


=-3-(-1-1)(-3-3)/(-1-6.5)
=-1.4

Hence,
At i=0
y1=y0+hf1(x0, y0,z0)
z1=z0+h*f2(x0,y0,z0)

Here,
x0=0, y0=1, z0=-1.4
y1=1+0.25*(-1.4)=0.65
z1=-1.4+0.25*4=-0.4

At i=1
y2=y1+hf1(x1, y1, z1)
z2=z1+hf2(x1, y1, z1)

Here,
x1=0.25, y1=0.65, z1=-0.4
y2=0.6+0.25*(-0.4) =0.55
z2=-0.4+0.25*3.35=0.4375

At i=2:
y3=y2+hf1(x2, y2, z2)
z3=z2+hf2(x2, y2, z2)

Here,
x2=0.25+0.25=0.50
y2=0.55, z2=0.4375
y3=0.55+0.25*0.4375 =0.659375
z3=0.4375+0.25*3.7 =1.36225

At i=3
y4=y3+hf1(x3, y3, z3)
z4=z3+hf2(x3, y3, z3)
Here,
x3=0.75, y3=0.659375
z3=0.2625
y4=0.659375+0.25*0.2625 =0.725
z4=0.2625+0.25*0.4875 =0.384375

Hence, required solution is:


Y(0)=1
y(1.25)=0.65
y(1.50)=0.55
y(1.75)=0.659375
y(2)=0.725

19. Solve d2y/dx2=ex^2, y(0)=0, y(1)=0 for x=0.25,0.5 and 0.75 using the
shooting method.

Solution:-
Here,
We know that,
y0=y(0)=0
y1=y(0.25)
y2=y(0.5)
y3=y(0.75)
y4=y(1)=0
h=0.25
’’
y1 =(yi+1-2yi+2yi-1)/h2 =ex^2

At i=1, x=0.25
y1’’=(y2-2y1+y0)/0.0625=e0.25^2=1.0645
y2-2y1+y0=0.0665-----------------eqn(1)
At i=2, x=0.50
y2’’=(y3-2y2+y1)/0.0625=e0.5^2=1.2840
y3-2y2+y1=0.0803-----------------eqn(2)
At i=3, x=0.75
y3’’=(y4-2y3+y2 )/0.0625=e0.75^2=1.7551
y4-2y3+y2=0.1097
Letting y0=0 and y4=0,
We have following system of three equations:
-2y1+y2=0.0665
y1-2y2+y3=0.0803
y2-2y3=0.1097
Solving above equations,
We get,
y1=y(0.25)=-0.1175
y2=y(0.50)=-0.1684
y3=y(0.75)=-0.1391

6 Chapter-6
6.1 SOLUTION OF PARTIAL DIFFERENTIAL EQUATION
1. Find the value of u(x,y) satisfying the Laplace's equation 𝝏𝟐 = 𝟎 at the
pivotal points of a square region with given boundary values.
Solution
0 11.1 17 19.7 18.6

0 u1 u2 u3 21.9

0 u4 u5 u6 21

0 u7 u8 u9 17

8.7 12.1 12.8 9

To find out initial values


1
𝑢5 =4 [17 + 0 + 12.1 + 21] =12.5 (S.F)
1
𝑢1 =4 [0 + 12.5 + 17 + 0] =7.4 (D.F)
1
𝑢3 =4 [17 + 21 + 18.6 + 12.5] =17.3 (D.F)
1
𝑢2 = 4 [17 + 7.4 + 12.5 + 17.3] =13.5 (S.F)
1
𝑢7 =4 [0 + 12.1 + 0 + 12.5] =6.15 (D.F)
1
𝑢4 =4 [7.4 + 0 + 6.15 + 12.5] =6.5 (S.F)
1
𝑢9 =4 [12.5 + 9 + 12.1 + 21] =13.65 (D.F)
1
𝑢8 =4 [12.5 + 6.15 + 12.1 + 13.65] =11.1 (S.F)
1
𝑢6 = [17.3 + 12.5 + 13.65 + 21] =16.11 (S.F)
4

We carryout successive iteration using Gauss Seidel Formula:


(𝑛+1) 1 (𝑛) (𝑛)
𝑢1 =4 [11.1 + 0 + 𝑢4 + 𝑢2 ]

(𝑛+1) 1 (𝑛+1) (𝑛) (𝑛)


𝑢2 =4 [17 + 𝑢1 + 𝑢5 + 𝑢3 ]

(𝑛+1) 1 (𝑛+1) (𝑛)


𝑢3 =4 [19.7 + 𝑢2 + 𝑢6 + 21.9]
(𝑛+1) 1 (𝑛+1) (𝑛) (𝑛)
𝑢4 = 4 [𝑢1 + 0 + 𝑢7 + 𝑢5 ]

(𝑛+1) 1 (𝑛+1) (𝑛+1) (𝑛) (𝑛)


𝑢5 =4 [𝑢2 + 𝑢4 + 𝑢8 + 𝑢6 ]

(𝑛+1) 1 (𝑛+1) (𝑛+1) (𝑛)


𝑢6 =4 [𝑢3 + 𝑢5 + 𝑢9 + 21]

(𝑛+1) 1 (𝑛+1) (𝑛)


𝑢7 =4 [𝑢4 + 0 + 8.7 + 𝑢8 ]

(𝑛+1) 1 (𝑛+1) (𝑛+1)


𝑢8 =4 [𝑢5 + 𝑢7 + 12.1 + 17]

(𝑛+1) 1 (𝑛+1) (𝑛+1)


𝑢9 = [𝑢6 + 𝑢8 + 12.8 + 17]
4

FIRST ITERATION (n=0):


1
𝑢11 = 4 [11.1 + 6.5 + 13.5] =7.85
1
𝑢21 = 4 [17 + 7.85 + 12.5 + 13.5] =12.7
1
𝑢31 = 4 [19.7 + 12.7 + 16.11 + 21.9] =17.6
1
𝑢41 = 4 [7.85 + 6.15 + 12.5] =6.6
1
𝑢51 = 4 [12.7 + 6.6 + 11.1 + 16.11] =11.62
1
𝑢61 = 4 [17.6 + 11.62 + 13.65 + 21] =15.96
1
𝑢71 = 4 [6.6 + 8.7 + 11.1] =6.6
1
𝑢81 = 4 [11.62 + 6.6 + 12.1 + 13.65] =11
1
𝑢91 = 4 [15.96 + 11 + 12.8 + 17] = 14.2

SECOND ITERATION (n=1):


1
𝑢12 = 4 [11.1 + 6.6 + 12.7] =7.6
1
𝑢22 = 4 [17 + 7.6 + 11.62 + 17.6] =13.5
1
𝑢32 = 4 [19.7 + 13.5 + 15.96 + 21.9] =17.8
1
𝑢42 = 4 [7.6 + 6.6 + 11.62] =6.4
1
𝑢52 = 4 [13.5 + 6.4 + 11 + 15.96] =11.72
1
𝑢62 = 4 [17.8 + 11.72 + 14.2 + 21] =16.18
1
𝑢72 = 4 [6.4 + 8.7 + 11] =6.5
1
𝑢82 = 4 [11.72 + 6.5 + 12.1 + 14.2] =11.13
1
𝑢92 = 4 [16.18 + 11.13 + 12.8 + 17] =14.3

THIRD ITERATION (n=2)


1
𝑢13 = 4 [11.1 + 6.4 + 13.5] =7.6
1
𝑢23 = 4 [17 + 7.75 + 11.72 + 17.8] =13.5
1
𝑢33 = 4 [19.7 + 13.5 + 16.18 + 21.9] =17.8
1
𝑢43 = 4 [7.6 + 6.5 + 11.72] =6.4
1
𝑢53 = 4 [13.5 + 6.4 + 11.13 + 16.18] =11.8
1
𝑢63 = 4 [17.8 + 11.8 + 14.3 + 21] =16.2
1
𝑢73 = 4 [6.4 + 8.7 + 11.13] =6.5
1
𝑢83 = 4 [11.8 + 6.5 + 12.1 + 14.3] =11.1
1
𝑢93 = 4 [16.2 + 11.1 + 12.8 + 17] =14.3

Here, second and third iteration values are similar.


𝑢1 = 7.6 𝑢6 = 16.2
𝑢2 = 13.5 𝑢7 = 6.5
𝑢3 = 17.8 𝑢8 = 11.1
𝑢4 = 6.4 𝑢9 = 14.3
𝑢5 = 11.8

2. Solve 𝒖𝒙𝒙 +𝒖𝒚𝒚 =0 for the square mesh with boundary values as shown below. Iterate
till the mesh values are correct to two decimal places.

1 2 2 2

0 u1 u2 2

0 u3 u4 2

0 0 0 1

Solution:
To find initial values;
Let 𝑢4 =0 then;
1
𝑢1 = 4 [2 + 0 + 𝑢3 + 𝑢2 ]

or , 4𝑢1 − 𝑢2 − 𝑢3 =0 ------------------------- i
1
𝑢2 = 4 [2 + 𝑢1 + 0 + 2]

or , -𝑢1 + 𝑢2 = 4 -----------------------------------ii
1
𝑢3 = 4 [𝑢1 + 0 + 0 + 0]

or , -𝑢1 + 4𝑢3 = 0 ---------------------------------iii


Solving i , ii , iii
𝑢1 = 0.85
𝑢2 = 1.22
𝑢3 = 0.22
1
𝑢4 = 4 [𝑢2 + 𝑢3 + 0 + 2]

=0.86
We carryout successive iteration using Gauss Seidel Formula:
(𝑛+1) 1 (𝑛) (𝑛)
𝑢1 = 4 [2 + 0 + 𝑢3 + 𝑢2 ]

(𝑛+1) 1 (𝑛+1) (𝑛)


𝑢2 =4 [2 + 𝑢1 + 𝑢4 + 2]

(𝑛+1) 1 (𝑛+1) (𝑛)


𝑢3 = 4 [𝑢1 + 0 + 0 + 𝑢4 ]

(𝑛+1) 1 (𝑛+2) (𝑛+1)


𝑢4 = 4 [𝑢2 + 𝑢3 + 0 + 2]

FIRST ITERATION (n=0)


1
𝑢11 = 4 [2 + 0.22 + 1.22] = 0.86
1
𝑢21 = 4 [2 + 0.86 + 0.86 + 2] = 1.43

1
𝑢31 = [0.86 + 0.86] = 0.43
4
1
𝑢41 = 4 [1.43 + 0.43 + 2] = 0.965

SECOND ITERATION (n=1)


1
𝑢12 = 4 [2 + 0.43 + 1.43] = 0.965
1
𝑢22 = 4 [2 + 0.965 + 0.965 + 2] = 1.482
1
𝑢32 = 4 [0.965 + 0.965] = 0.482
1
𝑢42 = 4 [1.482 + 0.482 + 2] = 0.991

THIRD ITERATION (n=2)


1
𝑢13 = 4 [2 + 0.482 + 1.482] = 0.991
1
𝑢23 = 4 [2 + 0.991 + 0.991 + 2] = 1.495
1
𝑢33 = 4 [0.991 + 0.991] = 0.495
1
𝑢43 = 4 [1.495 + 0.495 + 2] = 0.997
FOURTH ITERATION (n=3)
1
𝑢14 = 4 [2 + 0.495 + 1.495] = 0.9997
1
𝑢24 = 4 [2 + 0.997 + 0.997 + 2] = 1.498
1
𝑢34 = 4 [0.997 + 0.997] = 0.498
1
𝑢44 = 4 [1.498 + 0.498 + 2] = 0.999

Here, third and fourth iteration values are similar.


The required values correct to two decimal places are:
𝑢1 = 0.997
𝑢2 = 1.498
𝑢3 = 0.498
𝑢4 = 0.999

3. Solve the Laplace’s equation 𝒖𝒙𝒙 + 𝒖𝒚𝒚 = 𝟎 in the domain of the figure given by
(a) Gauss-Jacobi’s Method and (b) Liebmann (Gauss- Seidel) Method.

Solution;
Let u1, u2, u3, u4 be the values of x at the interior mesh points.
Now,
1
𝑢1 = (1 + 𝑢2 + 𝑢3 + 1)
4
1 2
1
𝑢2 = 4 (𝑢1 + 2 + 4 + 𝑢4 )
1 1 4
𝑢3 = 4 (𝑢1 + 2 + 4 + 𝑢4 )

1 2 5
𝑢4 = (𝑢 + 5 + 5 + 𝑢3 )
4 2
Let 4u = 0, then, 4 5
u1 = 1.428 u2 = 2.86 u3 = 1.86 u4 =3.43
(a). Using Jacobi’s formula,

(𝑛+1) 1
𝑢1 = (1 + 𝑢2𝑛 + 1 + 𝑢3𝑛 )
4
(𝑛+1) 1 𝑛
𝑢2 = (𝑢 + 2 + 4 + 𝑢4𝑛 )
4 1
(𝑛+1) 1 𝑛
𝑢3 = (𝑢 + 2 + 4 + 𝑢4𝑛 )
4 1
(𝑛+1) 1 𝑛
𝑢4 = (𝑢 + 5 + 5 + 𝑢3𝑛 )
4 2
No. of iterations u1 u2 u3 u4
1 1.43 2.714 2.714 3.43
2 1.857 2.715 2.715 3.857
3 1.857 3.1785 3.1785 4.089
4 2.089 3.0445 3.0445 4.023
5 2.023 3.0115 3.0115 4.005
6 2.005 3.0025 3.0025 4.002
7 2.00115 3.0000 3.0000 4.0000
There is no significant difference between the 6th and 7th iterations values. Hence,
u1 = 2 u2 = 3 u3 = 3 u4 = 4
(b). Using Gauss-Seidel formula,
1
𝑢1 = (𝑢2 + 𝑢3 + 2)
4
1
𝑢2 = (𝑢 + 𝑢4 + 6)
4 1
1
𝑢2 = (𝑢 + 𝑢4 + 6)
4 1
1
𝑢4 = (𝑢 + 𝑢3 + 10)
4 2

No. of iterations u1 u2 u3 u4
0 1.43 2.715 2.715 3.85
1 1.8575 2.9268 2.9268 3.9634
2 1.9634 2.9817 2.9817 3.9908
3 1.9908 2.9954 2.9954 3.9977
4 1.9977 2.9988 2.9988 3.9994
5 1.9994 2.9997 2.9997 3.9998
6 1.9998 2.9999 2.9999 3.9999
7 1.9998 2.9999 2.9999 3.9999

Since, there is no significant difference difference between 6th and 7th iterations value. Hence,
u1 = 2 u2 = 3 u3 = 3 u4 = 4

4. Consider a steel plate of size15cm*15cm. If two of the sides are held at 100°C and
the other two sides are held at 0°C, what are the steady state temperature at the
interior points assuming a grid size of 5cm*5cm?

Solution; A 100 B
100
Let u1, u2, u3 u4 be the values of x at the interior mesh points.
u1 u2
From SFPF, 0 0
1
𝑢1 = 4 (100 + 𝑢2 + 𝑢3 + 100) …………….(i) 0 u3 u4 0
1
𝑢2 = 4 (𝑢1 + 100 + 𝑢4 ) ……………. (ii) D
100 100 C
1
𝑢3 = 4 (𝑢1 + 100 + 𝑢4 ) …………….. (iii)
1
𝑢4 = 4 (𝑢2 + 𝑢3 )……………. (iv)

Here, u2 = u3 then we can write above equations as,


4𝑢1 − 2𝑢2 = 200 ……….. (a)
4𝑢2 − 𝑢1 − 𝑢4 = 100 …………(b)
4𝑢4 − 2𝑢2 = 0 ………….. (c)
Solving these equations by Direct Methods, we get
u1 =75 u2 = u3 = 50 u4 = 25

5. Use liebmann’s method(Gauss-seidel) to solve the temperature of a square heated


plate.The boundary of the plate is indicated by the lines y=0,y=4,x=0 and x=4.The
temperature at the lines y=4,y=0,x=0,x=4 are held constant at 100⁰ C,0 ⁰C,75 ⁰C and
50⁰ C respectively.

Solution:

Here,

By question, The figure is shown.

It is not symmetrical. Now,

Using standard formula and Gauss-seidel iteration.

u5=1/4[75+100+50+0]=56.25

u1=1/4[75+10+u2+u4]

u2=1/4[u1+u3+u5+100]
u3=1/4[u2+u6+150]

U5=1/4[u4+u2+u6+u8]

u4=1/4[u1+u7+u5+75],

u6=1/4[u3+u9+u5+50]

u7=1/4[u4+u8+75]

u8=1/4[u7+u9+u5]

u9=1/4[u6+u8+50].

Initial guessu1=u2=u3=u4=u5=u6=u7=u8=u9=0 and u5=56.25

U1=43.75=u1(0),u2=39,u3=37.5,u4=32.81256,u5=56.25,u6=26.562,u7=18.75,u8=14.06,u9=12.5

Now iteration is carried out.

itr1

U1=61.70,u2=59.375,u3=53.89,u4=48.43,u5=28.10,u6=39.06,u7=30.468,u8=21.875,u9=22.65.

itr2

u1=70.70,u2=35.92,u3=62.10,u4=48.817,u5=42.185,u6=38.6,u7=36.32,u8=20.30,u9=27.73

itr3

u1=64.93,u2=68.74,u3=56.145,u4=56.05,u5=35.92,u6=45.50,u7=36.02,u8=26.55,u9=27.24

itr4

u1=74.97, u2=64.24, u3=66.06, u4=52.96, u5=49.21, u6=42.32, u7=39.4, u8=24.79, u9=30.51

itr5

u1=73.05,u2=72.56,u3=64.14,u4=59.64,u5=46.07,u6=48.94,u7=38.18,u8=29.78,u9=29.27

itr6

u1=76.8,u2=70.81,u3=67.87,u4=58.07,u5=52.73,u6=47.37,u7=41.104,u8=28.38,u9=32.18

itr7

u1=75.97,u2=74.35,u3=67.08,u4=61.40,u5=51.15,u6=50.69,u7=40.36,u8=31.50,u9=31.43
itr8

u1=77.68,u2=73.54,u3=68.76,u4=60.62,u5=54.48,u6=49.90,u7=41.97,u8=30.73,u9=33.04

itr9

u1=77.29,u2=75.23,u3=68.36,u4=62.30,u5=53.69,u6=51.57,u7=41.58,u8=32.37,u9=32.65

itr10

u1=78.13,u2=74.83,u3=69.2,u4=61.89,u5=5.36,u6=51.17,u7=42.41,u8=31.98,u9=33.48

Therefore,the values of itr9 and itr10 are mostly equal so the required values are:

U1=78.13

U2=74.13

U3=69.2

U4=61.89

U5=55.36

U6=51.17

U7=42.41

U8=31.98

U9=33.48

6. Solve uxx+uyy=0 in 0≤x≤4,0≤y≤4,given u(0,y)=0;u(4,y)=8+2y;u(x,0)=x2/2 and


u(x,4)=x2.Take h=k=1and obtain the result corect upto one decimal digit.

Solution:

Here:

Solving of laplace equation in 0≤x≤4,0≤y≤4 and h=k=1.

The boundary conditions or constraints are:


a.u(0,y)=0

u(0,0)=u(0,1)=u(0,2)=u(0,3)=u(0,4)=0.

b.u(4,y)=8+2y

u(4,0)=8,u(4,1)=10,u(4,2)=12,u(4,3)=14,u(4,4)=16.

c.u(x,0)=x2/2

u(0,0)=0,u(1,0)=0.5,u(2,0)=2,u(3,0)=4.5,u(4,0)=8.

d.u(x,4)=x2

u(0,4)=0,u(1,4)=1,u(2,4)=4,u(3,4)=9,u(4,4)=16.

putting this values in above grid points.

The unknown points are u1,u2,u3,u4,u5,u6,u7,u8,u9,and there is no symmetry.

Now using standard 5 point formula and diagonal 5 point formula.

U5=1/4[4+2+0+12]=4.5,u1=1/4[0+4.5+0.4]=4.25,

U3=9.125,u7=1.625,u9=6.625,u2=5.468,u4=2.593,u6=8.06,u8=3.687

The equations are:

U1=1/4[1+u2+u4]

U2=1/4[4+u1+u3+u5]

U3=1/4[23+u2+u6]

U4=1/4[u1+u5+u7]

U5=1/4[u2+u4+u6+u8]

U6=1/4[12+u3+u5+u9]

U7=1/4[0.5+u4+u8]

U8=1/4[2+u5+u7+u9]

U9=1/4[14.5+u6+u8]

Now by iteration,
itr1

u1=2.265,u2=5.4687,u3=9.132,u4=2.5937,u5=4.952,u6=8.0625,u7=1.695,u8=3.6875,u9=6.5617

itr2

u1=2.2656,u2=5.0872,u3=9.1328,u4=2.28,u5=4.953,u6=8.1695,u7=1.695,u8=3.802,u9=6.5625

itr3

u1=2.078,u2=5.0878,u3=9.0621,u4=2.284,u5=4.8196,u6=8.1620,u7=1.632,u8=3.802,u9=6.615

itr4

u1=2.079,u2=5.00,u3=9.062,u4=2.20,u5=4.82,u6=8.12,u7=1.632,u8=3.8,u9=6.616

values of iteration 3 and 4 are equal upto 1 decimal so,the required values are:

u1=2.079

u2=5.0

u3=9.062

u4=2.2

u5=4.82

u6=8.12

u7=1.632

u8=3.8

u9=6.616

7. Solve the Poisson’s equation𝝏𝟐 𝒇=2x2y2 over the square domain of 0≤x ≤3 and0≤y ≤ 3
with f=0 on the boundary and h=1.

Solution: Here,
The given differential equation is,
𝜕 2𝑢 𝜕 2𝑢
+ = 2𝑥 2 𝑦 2
𝜕𝑥 2 𝜕𝑦 2
By using Poisson’s formula,
ui+1,j +ui,j+1+ui-1,j+ui,j-1 -4uij =h2f (ih,jh) ……………(i)
For f1 put i=1, j=2
Then 0+0+f2+f3-4f1= 12f (1,2) A 0 0 B
Or, f2+f3-4f1 = 2*1*4
u1 u2
Or, f2+f3-4f1 = 8 0 0
1
Or, f 1= 4 (𝑓2 + 𝑓3 − 8) …………….. (ii) 0
u3 u4
0
Again, for f2 put i=2, j=2
D 0 0 C
Then, 0+0+f1+f4-4f2 = 1f (2,2)
Or, 0+0+f1+f4-4f2 = 2*4*4
1
𝑓2 = 4 (𝑓1 + 𝑓4 − 32) …………. (iii)

For f3, put i=1 j=1


Then, 0+f1+0+f4-4f3 = 1f (1,1)
Or, 0+f1+0+f4-4f3 = 1f (1,1)
Or, f1+f4-4f3 = 2
1
𝑓3 = 4 (𝑓1 + 𝑓4 − 2) ……………… (iv)

For f4; put i=2, j=1


Then, 0+f2+0+f3-4f4 = 1f (2,1)
Or, f2+f3-4f4 = 2*4*1
1
𝑓4 = 4 (𝑓2 + 𝑓3 − 8 )……………….. (v)

Here we can see that f4 = f1. So with f4 = f1 above equations are reduced to
4f1-f2-f3 = -8
4f2-2f1 = -32
4f3-2f1 = -2
Now solving these equations by Direct methods, we get,
−22 −43 −13 −22
𝑓1 = 𝑓2 = 𝑓3 = 𝑓4 =
4 4 4 4
8. Solve the equation 𝝏𝟐 𝒖 = −𝟏𝟎(𝒙𝟐 + 𝒚𝟐 + 𝟏𝟎)over the square mesh with sides x=0,
y=0, x=3, y=3 and u=0 on the boundary and mesh length = 1.

Solution;
The given differential equation is,
𝜕 2𝑢 𝜕 2𝑢
+ = −10(𝑥 2 + 𝑦 2 + 10) … … … … (𝑖)
𝜕𝑢2 𝜕𝑦 2
Let u1,u2,u3,u4 be the values of u at the four mesh points as shown in figure. Replacing LHS of
eqn (i) by finite difference expressions and putting x=ih, y=jh on the RHS of it, we get
ui+1,j +ui,j+1+ui-1,j+ui,j-1 -4uij = -10 (i2+j2+10) …………(ii)
for u1 by putting i=1, j=2 in eqn(ii), we get
0+u2+u3+0-4u1= -10 (1+4+10) A 0 B
0
1
Or, 𝑢1 = 4 (𝑢2 + 𝑢3 + 150)
u1 u2
Or, 4u1-u2-u3 = 150 …………….. (a) 0 0

For u2 by putting i=2, j=2 in eqn(ii), we get u3 u4 0


0
1
Or, 𝑢2 = 4 (𝑢1 + 𝑢4 + 180)
D C
Or, 4𝑢2 − 𝑢1 − 𝑢4 = 180 … … … … . (𝑏)
For u3 by putting i=1, j=1 in eqn(ii), we get
1
Or, 𝑢3 = 4 (𝑢1 + 𝑢4 + 120)
Or, 4𝑢3 − 𝑢1 − 𝑢4 = 120 … … … … . (𝑐)
For u4 by putting i=2, j=1 in eqn(ii), we get
1
Or, 𝑢4 = 4 (𝑢2 + 𝑢3 + 150)
Or, 4𝑢4 − 𝑢2 − 𝑢3 = 150 … … … … (𝑑)
Here we can see that u4 = u1. So with u4 = u1eqns (a)-(d) reduces to
4𝑢1 − 𝑢2 − 𝑢3 = 150
4𝑢2 − 2𝑢1 = 180
4𝑢3 − 2𝑢1 = 120
Now solving these equations by Direct Method, we get
𝑢1 = 75 𝑢2 = 82.5 𝑢3 = 67.5 𝑢4 = 75
THE END

You might also like