FALL 2023 MTH603 Solution of Assignment # 1 Section In-charge: Arooba Fatima Total Marks 20 Question 1: Marks=10 Use Secant method to compute the root of the equation x3 - 5 x + 1 = 0, [0,1] with the accuracy of 4-decimal point. Solution: 1st iteration: x0 = 0 and x1 = 1 f ( x0 ) = f (0) =1 and f ( x1 ) = f (1) = −3 ī x2 = x0 f ( x1 ) − x1 f ( x0 ) 0(−3) − 1(1) = 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 x3 = x1 f ( x2 ) − x2 f ( x1 ) 1(−0.2344) − 0.25(−3) = 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: x2 = 0.25 and x3 = 0.1864 f ( x2 ) = f (0.25) = − 0.2344 and f ( x3 ) = f (0.1864) = 0.07448 x4 = x2 f ( x3 ) − x3 f ( x2 ) 0.25(0.07448) − 0.1864( −0.2344) = f ( x3 ) − f ( x2 ) 0.07448 − (−0.2344) x4 = 0.2017 f ( x4 ) = f (0.2017) = (0.2017)3 − 5(0.2017) + 1 = − 0.00029 4th iteration: x3 = 0.1864 and x4 = 0.2017 f ( x3 ) = f (0.1864) = 0.07448 and f ( x4 ) = f (0.2017) = − 0.00029 x5 = x3 f ( x4 ) − x4 f ( x3 ) 0.1864(−0.00029) − 0.2017(0.07448) = 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 Using Gauss Siedal Iteration Method to solve system of linear equations by taking initial starting vector as (0, 0, 0)T . 6 x1 − 2 x2 − x3 + x4 = 3 − x1 + 6 x2 − x3 − x4 = −9 2 x1 − x2 + 6 x3 + 2 x4 = 15 x1 + x2 − x3 + 6 x4 = 27 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 đĨ1 = 2+3 = 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 + 2.5 = 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 đĨ3 = 2.5 + 2.25 = 2.375 2 Now, f(2.375)=0.02148 >0 , therefore root will lie between (2.25,2.375). The 4th approximation to the root is đĨ4 = 2.25 + 2.375 = 2.31250 2 Now, f(2.3125)=-0.94604< 0 , therefore root will lie between (2.375, 2.3125). The 5th approximation to the root is đĨ5 = 2.375 + 2.3125 = 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, đĨđ+1 = đĨđ − đĨđ3 + 2đĨđ2 + 10đĨđ − 20 3đĨđ2 + 4đĨđ + 10 đĨđ+1 2(đĨđ3 + đĨđ2 + 10) = 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 đĨ0+1 2(đĨ03 + đĨ02 + 10) = 3đĨ02 + 4đĨ0 + 10 2((1.2)3 + (1.2)2 + 10) 26.336 đĨ1 = = = 1.37741 3(1.2)2 + 4(1.2) + 10 19.12 Similarly, For 2nd iteration put n=1 đĨ2 = 29.02105 = 1.36883 21.20136 đĨ3 = 28.87692 = 1.36881 21.0964 đĨ4 = 28.87656 = 1.36880 21.09614 For 3rd iteration put n=2 For 4th iteration put n=3 Hence , the root is 1.3688. Section in charge : Husna Muzaffar đđŽđđŦđđĸđ¨đ§# đ: Marks 10 Solve the system of equations by using Crout’s method. 2đĨ + 5đĻ + 3đ§ = 16 3đĨ + đĻ + 2đ§ = 11 −3đĨ + 7đĻ + 8đ§ = 10 Solution: Solution: đđ + đđ + đđ = đđ − − − − − (đ) đđ + đ + đđ = đđ − − − − − (đ) −đđ + đđ + đđ = đđ − − − − − (đ) Convert the given system in the matrix form. 16 2 5 3 đĨ [ 3 1 2] [đĻ] = [11] 10 −3 7 8 đ§ Now, đĨ 16 2 5 3 A=[ 3 1 2] , x = [đĻ] , B = [11] đ§ 10 −3 7 8 Crouts’s method. For LU decomposition Let đŋ = đ´đ đ11 2 5 3 [ 3 1 2] = [đ21 đ31 −3 7 8 0 đ22 đ32 đ11 2 5 3 [ 3 1 2] = [đ21 đ31 −3 7 8 đ11 đĸ12 đ21 đĸ12 + đ22 đ31 đĸ12 + đ32 đ11=2 đ11 đĸ12 = 5 => đĸ12 = 5⁄2 0 1 0 ] [0 đ33 0 đĸ12 1 0 đĸ13 đĸ23 ] 1 đ11 đĸ13 đ21 đĸ13 + đ22 đĸ23 ] đ31 đĸ13 + đ32 đĸ23 + đ33 đ11 đĸ13 = 3 => đĸ13 = 3⁄2 đ21 = 3 đ21 đĸ12 + đ22 = 1 => 3(5⁄2)+ đ22 =1 15 + đ22 = 1 2 đ22 = 1 − 15 −13 = 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 đĸ23 = 5 13 đ31 = −3 đ31 đĸ12 + đ32 = 7 5 −3 ( ) + (đ32 ) = 7 2 −15 + đ32 = 7 2 đ32 = 7 + đ32 = 15 2 29 2 đ31 đĸ13 + đ32 đĸ23 + đ33 = 8 3 (−3)( ) + 2 29 2 5 + đĩ + đ33=8 90 đ33 =13 A = đŋđ 2 2 5 3 [ 3 1 2] = [ 3 −3 7 8 −3 5 −13 2 29 2 0 1 5 2 0][ 0 1 90 13 0 0 3 2 5 ]=[ 13 1 2 5 3 3 1 2] −3 7 8 đđ = đŠ & đ¨ = đŗđŧ => đŗđđ = đ đĻ1 2 0 0 16 đĻ [ 3 −6.5 ] [ ] = [ 0 2 11] −3 14.5 6.9231 đĻ3 10 2đĻ1 = 16 − − − − − − − − − − − (i) 3đĻ1 − 6.5đĻ2 = 11 − − − − − − − − − − − (ii) −3đĻ1 + 14đĻ2 + 6.9231đĻ3 = 10 − − − − − − − − − − − (iii) đĻ1 = 8 Put đđ = đ đĸđ§ đđĒđŽđđđĸđ¨đ§ (đĸđĸ) 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 =ī§ ī§ ī¨ īļ īˇ īˇ īˇ ī¸ in UX = Y x y z âĒ z = y3 = 0.722 âĒ y= ( y2 − u23 ī z ) = 2 − 0.385 ī 0.722 īģ 1.722 âĒ x = ( y1 − u12 ī y − u13 ī z ) = 8 − 2.5 ī1.722 −1.5 ī 0.722 = 2.611 x = 2.611, y = 1.722, and z = 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 Use Newton Raphson method to find the root of f ( x) = x 3 − 2 x + 2 with x0 = 0.2 (Perform only three iterations) Solution: Question 2 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 (Perform only two iteration) Solution: 10 Marks