NM Assignment Solution
NM Assignment Solution
NM Assignment Solution
[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 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.
= 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
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
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
=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
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 of the given function is 1.673 which is correct for three decimal places.
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 27 32
= [𝑥 2 − 4𝑥 − 2𝑥 + 8] − [𝑥 2 − 𝑥 − 4𝑥 + 4] + [𝑥 2 − 2𝑥 + 2]
3 2 3
= −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
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
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
+
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.
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
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!
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
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)
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).
13.9130−6.7134 6.7134−4.4366
or, 0.5a1+2(1)a2+0=6 [ − ]
0.5 0.5
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
18−31 31−17
1*a1+2(1+1)a2 +1*a3 = 6 [ − ]
1 1
25−18 18−31
1*a2+2(1+1)a3 +0 = 6 [ − ]
1 1
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
Solution:
We know that the cubic spline interpolation formula is;
𝑎𝑖−1 𝑎𝑖 1
𝑦(𝑥) = (ℎ𝑖2 𝑢𝑖 − 𝑢𝑖3 ) + 3
(𝑢𝑖−1 − ℎ𝑖2 𝑢𝑖−1 ) + (𝑓𝑖 𝑢𝑖−1 − 𝑓𝑖−1 𝑢𝑖 )
6ℎ𝑖 6ℎ𝑖 ℎ𝑖
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
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
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.
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
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
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:
Here,
ℎ = 0.1 𝑥0 = 0.7 𝑦0 = 0.644218 Δ𝑦0
= 0.073138 Δ 𝑦0 = −0.007167 Δ 𝑦0 = −0.00066 Δ4 𝑦0
2 3
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
∴ 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
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
=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
ℎ
= 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
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
=𝟎. 𝟕𝟖𝟓𝟑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𝑥
=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
=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
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
c) when h=0.75
xi 0 0.75 1.5 2.25 3 3.75 4.5 5.25 6
ℎ
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
𝟏 𝟑
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
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
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
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
𝟏+𝐬𝐢𝐧 𝒙
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
Solution:
The difference table is:
1.0 7.989
0.414
0.378 0.006
0.299 0.005
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
0 30.13
1.49
1.25 0.24
-0.14 0.02
-0.57
0.6 33.24
= 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.
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.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
= [ 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
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.
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
11. A curve is drawn to pass through the points given by the following table.
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
𝐼𝑛𝑡𝑒𝑟𝑣𝑎𝑙 𝑜𝑓 𝑥
𝐴 = [(𝑦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
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
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
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:
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
= 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
Or, 𝑑𝑣 = 𝑎 ∗ 𝑑𝑡
Integrating both sides we get,
𝑏
0r, V=∫𝑎 𝑎 ∗ 𝑑𝑡
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√ℎ 𝑑ℎ
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.
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
3
1 3 9 2
= 3/2 ∫−1 (3 (2 𝑈 + 2) + 5) 𝑑𝑢
=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
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
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
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
Again; we have,
UX = Y
3 −4 7 𝑥1 6
−13 25
[0 3 𝑥
3 ] [ 2] 4 ]
= [−43
−43 𝑥
0 0 13
3 13
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.
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.
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: -
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
No of iteration X Y Z W
Hence, X=0.81
Y=1.81
Z=1.78
W=-0.280
2 3 -1
2 -1 3
Solution: -
Then, AX = I
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
1 2 1 x11 1
0 -1 -3 x21 = -2
0 0 16 x31 8
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,
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
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
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
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
Hence,
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
𝟔 −𝟒 𝟑
15. Find the largest eigenpair of [𝟐 𝟑 𝟐] using the Power method.
𝟏 𝟐 𝟒
Solution:
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
𝟏 𝟐 𝟏
[𝟐 𝟑 −𝟏]
𝟐 −𝟏 𝟑
𝑥11 𝑥12 𝑥13
Let X = [𝑥21 𝑥22 𝑥23] be the inverse of A.
𝑥31 𝑥32 𝑥33
Then, AX = I
1 2 1 : 1 0 0
[2 3 −1 : 0 1 0]
2 −1 3 : 0 0 1
1 2 1 : 1 0 0
[0 −1 −3 : −2 1 0]
0 −5 1 : −2 0 1
1 0 −5 : −3 2 0
[0 −1 −3 : −2 1 0]
0 0 16 : 8 −5 1
16 0 0 : −8 7 5
[0 −16 0 : −8 1 3]
0 0 16 : 8 −5 1
First system,
16 0 0 𝑥11 −8
[0 −16 0 ] [𝑥21] = [−8]
0 0 16 𝑥31 8
16x11 = -8 x11 = -0.5
Second system,
16 0 0 𝑥12 7
[0 −16 0 ] [𝑥22] = [ 1 ]
0 0 16 𝑥32 −5
Third system,
16 0 0 𝑥13 5
[0 −16 0 ] [𝑥23] = [3]
0 0 16 𝑥33 1
𝟐 −𝟏 𝟐
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
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
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
𝑑𝑥
(𝑥 − 𝑥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
(𝑥 − 𝑥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
𝒂. 𝒚′ (𝒙) = 𝒙𝟐 + 𝒚𝟐 , 𝒚(𝟎) = 𝟎
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
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
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
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.
𝟐𝒚
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
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
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
=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
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
𝑑𝑥
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’
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
Solution:
Let
dy/dx=z=f1(x,y,z)
dz/dx=6x=f2(x, y,z)
let initial guess be m0=1
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
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
Let dy/dx=z=f1(x,y,z)
dz/dx=3x+4y=f2(x,y,z)
y(0)=1, y(1)=1
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
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
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
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
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]
=0.86
We carryout successive iteration using Gauss Seidel Formula:
(𝑛+1) 1 (𝑛) (𝑛)
𝑢1 = 4 [2 + 0 + 𝑢3 + 𝑢2 ]
1
𝑢31 = [0.86 + 0.86] = 0.43
4
1
𝑢41 = 4 [1.43 + 0.43 + 2] = 0.965
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)
Solution:
Here,
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].
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
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
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
Solution:
Here:
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.
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
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)
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