Fall 2023 - MTH603 - 1 - SOL
Fall 2023 - MTH603 - 1 - SOL
Fall 2023 - MTH603 - 1 - SOL
MTH603
Solution of Assignment # 1
Total Marks 20
Question 1: Marks=10
x3 - 5 x + 1 = 0, [0,1]
Solution:
1st iteration:
x0 = 0 and x1 = 1
f ( x0 ) = f (0) =1 and f ( x1 ) = f (1) = −3
x0 f ( x1 ) − x1 f ( x0 ) 0(−3) − 1(1)
x2 = =
f ( x1 ) − f ( x0 ) −3 − 1
x2 = 0.25
f ( x2 ) = f (0.25) = (0.25)3 − 5(0.25) + 1 = − 0.2344
2nd iteration:
x1 =1 and x2 = 0.25
f ( x1 ) = f (1) = − 3 and f ( x2 ) = f (0.25) = −0.2344
x1 f ( x2 ) − x2 f ( x1 ) 1(−0.2344) − 0.25(−3)
x3 = =
f ( x2 ) − f ( x1 ) −0.2344 − (−3)
x3 = 0.1864
f ( x3 ) = f (0.1864) = (0.1864)3 − 5(0.1864) + 1 = − 0.07448
3rd iteration:
4th iteration:
x3 = 0.1864 and x4 = 0.2017
f ( x3 ) = f (0.1864) = 0.07448 and f ( x4 ) = f (0.2017) = − 0.00029
x3 f ( x4 ) − x4 f ( x3 ) 0.1864(−0.00029) − 0.2017(0.07448)
x5 = =
f ( x4 ) − f ( x3 ) (−0.00029) − (0.07448)
x5 = 0.2016
f ( x5 ) = f (0.2016) = (0.2016)3 − 5(0.2016) +1 = 0.0001
The approximation root of the equation x3 -5x+1=0 using secant method is 0.2016
(after 4th iteration).
Question 2: Marks=10
Solution:
1
x1( n +1) = [3 + 2 x2 ( n ) + x3( n ) − x4 ( n ) ]
6
1
x2 ( n +1) = [−9 + x1( n +1) + x3( n ) + x4( n ) ]
6
1
x3( n +1) = [15 − 2 x1( n +1) + x2( n +1) − 2 x4 ( n ) ]
6
1
x4 ( n +1) = [27 − x1( n +1) − x2 ( n +1) + x3( n +1) ]
6
For n=0
1
x1(1) = [3 + 2(0) + (0) − (0)] = 0.5
6
1
x2 (1) = [−9 + (0.5) + (0) + (0)] = −1.4167
6
1
x3(1) = [15 − 2(0.5) + (−1.4167) − 2(0)] = 2.0972
6
1
x4 (1) = [27 − (0.5) − (−1.4167) + (2.0972)] = 5.0023
6
For n=1
1
x1(2) = [3 + 2(−1.4167) + (2.0972) − (5.0023)] = −0.4564
6
1
x2 (2) = [−9 + (−0.4564) + (2.0972) + (5.0023)] = −0.3928
6
1
x3(2) = [15 − 2(−0.4564) + (−0.3928) − 2(5.0023)] = 0.9192
6
1
x4 (2) = [27 − (−0.4564) − (−0.3928) + (0.9192)] = 4.7947
6
For n=2
1
x1(3) = [3 + 2(−0.3928) + (0.9192) − (4.7947)] = −0.2769
6
1
x2 (3) = [−9 + (−0.2769) + (0.9192) + (4.7947)] = −0.5938
6
1
x3(3) = [15 − 2(−0.2769) + (−0.5938) − 2(4.7947)] = 0.8951
6
1
x4 (3) = [27 − (−0.2769) − (−0.5938) + (0.8951)] = 4.7943
6
For n=3
1
x1(4) = [3 + 2(−0.5938) + (0.8951) − (4.7943)] = −0.3478
6
1
x2 (4) = [−9 + (−0.3478) + (0.8951) + (4.7943)] = −0.6097
6
1
x3(4) = [15 − 2(−0.3478) + (−0.6097) − 2(4.7943)] = 0.9162
6
1
x4 (4) = [27 − (−0.3478) − (−0.6097) + (0.9162)] = 4.8123
6
For n=4
1
x1(5) = [3 + 2(−0.6097) + (0.9162) − (4.8123)] = −0.3526
6
1
x2 (5) = [−9 + (−0.3526) + (0.9162) + (4.8123)] = −0.604
6
1
x3(5) = [15 − 2(−0.3526) + (−0.604) − 2(4.8123)] = 0.9128
6
1
x4 (5) = [27 − (−0.3526) − (−0.604) + (0.9128)] = 4.8116
6
For n=5
1
x1(6) = [3 + 2(−0.604) + (0.9128) − (4.8116)] = −0.3511
6
1
x2 (6) = [−9 + (−0.3511) + (0.9128) + (4.8116)] = −0.6045
6
1
x3(6) = [15 − 2(−0.3511) + (−0.6045) − 2(4.8116)] = 0.9124
6
1
x4 (6) = [27 − (−0.3511) − (−0.6045) + (0.9124)] = 4.8113
6
For n=6
1
x1(7) = [3 + 2(−0.6045) + (0.9124) − (4.8113)] = −0.3513
6
1
x2 (7) = [−9 + (−0.3513) + (0.9124) + (4.8113)] = −0.6046
6
1
x3(7) = [15 − 2(−0.3513) + (−0.6046) − 2(4.8113)] = 0.9126
6
1
x4 (7) = [27 − (−0.3513) − (−0.6046) + (0.9126)] = 4.8114
6
(Fall-2023)
MTH-603 Assignment No.1
Section Incharge: Kiran Naseem Aslam
Maximum Marks: 20
Question 1 10 Marks
Find a root of the given equation 𝑥 3 − 𝑥 − 11 = 0, in the interval (2,3) using Bisection Method
after Five Iterations.
Note: Accuracy up to four decimal places is required.
Solution:
We can see that f(2)=-5<0 and f(3)=13 >0. So, our root will lie between (2,3).
The First approximation to the root is
2+3
𝑥1 = = 2.5
2
Now, f(2.5)=2.125 >0 , therefore root will lie between (2,2.5).
The 2nd approximation to the root is
2 + 2.5
𝑥2 = = 2.25
2
Now, f(2.25)=-1.85938<0 , therefore root will lie between (2.5,2.25).
The 3rd approximation to the root is
2.5 + 2.25
𝑥3 = = 2.375
2
2.375 + 2.3125
𝑥5 = = 2.34375
2
So, the 2.3438 is the approximate root of the function after fifth iteration and of course this is
not exact root of the function because f(2.3437) ≠ 0.
Question 2 10 Marks
Find a root of the given equation in the interval (1,2) using Newton-Raphson Method after four
iterations
𝑥 3 − 20 = −2𝑥 2 − 10𝑥
Take Initial value 1.2.
Note: Accuracy up to four decimal places is required.
Solution:
First rearrange given equation
𝑥 3 + 2𝑥 2 + 10𝑥 − 20 = 0
Let 𝑓(𝑥) = 𝑥 3 + 2𝑥 2 + 10𝑥 − 20.
𝑓 ′ (𝑥) = 3𝑥 2 + 4𝑥 + 10
As we know Newton –Raphson Formula is
𝑓(𝑥𝑛 )
𝑥𝑛+1 = 𝑥𝑛 −
𝑓 ′ (𝑥𝑛 )
So,
𝑥𝑛3 + 2𝑥𝑛2 + 10𝑥𝑛 − 20
𝑥𝑛+1 = 𝑥𝑛 −
3𝑥𝑛2 + 4𝑥𝑛 + 10
2(𝑥𝑛3 + 𝑥𝑛2 + 10)
𝑥𝑛+1 =
3𝑥𝑛2 + 4𝑥𝑛 + 10
We can see that f(1)=-7<0 and f(2)=16 >0. So, our root will lie between (1,2). Since initial value
𝑥0 = 1.2 so,
For First approximation put n=0
28.87692
𝑥3 = = 1.36881
21.0964
For 4th iteration put n=3
28.87656
𝑥4 = = 1.36880
21.09614
Hence , the root is 1.3688.
Section in charge : Husna Muzaffar
𝐐𝐮𝐞𝐬𝐭𝐢𝐨𝐧# 𝟏: Marks 10
2𝑥 + 5𝑦 + 3𝑧 = 16
3𝑥 + 𝑦 + 2𝑧 = 11
−3𝑥 + 7𝑦 + 8𝑧 = 10
Solution:
Solution:
𝟐𝒙 + 𝟐𝒚 + 𝟑𝒛 = 𝟏𝟔 − − − − − (𝟏)
𝟑𝒙 + 𝒚 + 𝟐𝒛 = 𝟏𝟏 − − − − − (𝟐)
−𝟑𝒙 + 𝟕𝒚 + 𝟖𝒛 = 𝟏𝟎 − − − − − (𝟑)
2 5 3 𝑥 16
[ 3 1 2] [𝑦] = [11]
−3 7 8 𝑧 10
Now,
2 5 3 𝑥 16
A=[ 3 1 2] , x = [𝑦] , B = [11]
−3 7 8 𝑧 10
Crouts’s method. For LU decomposition
Let 𝐿 = 𝐴𝑈
𝑙11=2
𝑙21 = 3
15
+ 𝑙22 = 1
2
15 −13
𝑙22 = 1 − =
2 2
𝑙21 𝑢13 + 𝑙22 𝑢23 = 2
3 −13
(3) ( ) + ( 𝑢 )=2
2 2 23
9 13
− 𝑢 =2
2 2 23
13 9
− 𝑢23 = 2 −
2 2
13 4−9
− 𝑢23 =
2 2
13 −5
− 𝑢23 =
2 2
5
𝑢23 =
13
𝑙31 = −3
5
−3 ( ) + (𝑙32 ) = 7
2
−15
+ 𝑙32 = 7
2
15
𝑙32 = 7 +
2
29
𝑙32 =
2
𝑙31 𝑢13 + 𝑙32 𝑢23 + 𝑙33 = 8
3 29 5
(−3)( ) + + 𝐵 + 𝑙33=8
2 2
90
𝑙33 =13
A = 𝐿𝑈
2 5 0 1 5 3
2 5 3 −13 2 2 2 5 3
[ 3 1 2] = [ 3 2
0][
0 1
5 ]=[ 3 1 2]
29 90 13
−3 7 8 −3 −3 7 8
2 13 0 0 1
𝐀𝒙 = 𝑩 & 𝑨 = 𝑳𝑼 => 𝑳𝒖𝒙 = 𝐁
2 0 0 𝑦1 16
[ 3 −6.5 0 ] [ 𝑦2 ] = [ 11]
−3 14.5 6.9231 𝑦3 10
2𝑦1 = 16 − − − − − − − − − − − (i)
𝑦1 = 8
3(8) − 6.5𝑦2 = 11
24 − 6.5𝑦2 = 11
−6.5𝑦2 = 11 − 24
𝑦2 = 2
Put
𝑦1 = 8 and 𝑦2 = 2 in equation (iii) we get
𝑦3 = 0.723
1. UX=Y
x
X = y
z in UX = Y
▪ z = y3 = 0.722
𝐐𝐮𝐞𝐬𝐭𝐢𝐨𝐧# 𝟐:
Solve the following system of equations by using Jacobi′ s iterative method for
the first three iterations by taking initial starting of solution vector as (0,0,0).
4𝑥 − 𝑦 − 𝑧 = 3
−2𝑥 + 6𝑦 + 𝑧 = 9
−𝑥 + 𝑦 + 7𝑧 = −6
Solution:
1st Iteration: -
Put initial values x=0, y=0 and z=0 in equations (i), (ii) and (iii)
1 3
x = 3 + 2 ( 0 ) + 2 ( 0 ) = = 0.375
8 8
1 9
y = 9 + 2 ( 0 ) − 0 = = 1.5
6 6
1 6
z = 6 + 2 ( 0 ) − 0 = = 0.8571
7 7
2nd Iteration
Put the values x=0.375, y=1.5 and z=0.8571 in equations (i), (ii) and (iii)
1 7.7142
x = 3 + 2 (1.5) + 2 ( 0.8571) = = 0.9642
8 8
1 8.8929
y = 9 + 2 ( 0.375) − 0.8571 = = 1.4822
6 6
1 5.25
z = 6 + 2 ( 0.375) − 1.5 = = 0.75
7 7
3rd Iteration
Put the values x=0.9642, y=1.4822 and z=0.75 in equations (i), (ii) and (iii)
1 7.4644
x = 3 + 2 (1.4822 ) + 2 ( 0.75) = = 0.9330
8 8
1 10.1784
y = 9 + 2 ( 0.9642 ) − 0.75 = = 1.6964
6 6
1 6.4462
z = 6 + 2 ( 0.9642 ) − 1.4822 = = 0.9208
7 7
(Fall-2023)
MTH-603 Assignment No.1
Section In charge: Zulfiqar Ahmad Noor
Question 1 10 Marks
Solution:
Question 2 10 Marks
Solve the system of equation by Jacobi method starting with (0,0,0)
10 x + y + z = 24
− x + 20 y + z = 21
− x − 2 y + 100 z = 300
Solution: