0% found this document useful (0 votes)
159 views

Nms 2nd Lesson (II)

Numerical mathematics and statistics
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
159 views

Nms 2nd Lesson (II)

Numerical mathematics and statistics
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 20
x =1, y=2, z=-l andt = 2 which is the required solution. 17) Solve by Gauss-Jordan method. 2x+y+z 3x + 2y +3z = X+4y+9z = ition : The Augmented matrix is (A:B) = Ae 8 Applying R, > R, - aR and R, (A:B) ~ 10 18 16 . Ze eel 10 323: 18 Ae oa 1 eRe QR we get 2a 10 0 05 15 3 @ 35 85 ll Applying R, — R, — 2R, and R, — R, -7R, we get (A:B) ~ Apply R; > R-R, , (A:B) ~ Hence we get 2x =14, 20 2: 4 © OS 1G eg 3 0 0 -2: -10 R, > R,+ 0.75 R, 20 0 14 005 0 : 45 0 0 2: -10 O5Sy=-45, -2z2=-10 Thus x = 7, y = -9, and z = 5 is the required solution. e 70 | 25. LU Decomposition Method (Cholesky's method or Crout's method) This is also a direct method Let AX = LN Ad te easel aad aaa eo cre an upper triangular matrix U. We will explain this method by considering three three unknonws. aoe S Consider the system of equations aX, +a,X, + a,x, = b Ay) + ayX, + A,X, = by 3K, + Ay + ayk, = by which can be written in the form AX = B where 7d) a ay ay Bs b A=/4u 42 !3/,X =| x2] and B =| bz 1 As? yy x; b, i Now the Coefficient matrix A is decomposed (factorized) into the product of Lower triangular matrix L and upper triangular matrix U. The diagonal elements of either L or U can be unity for convenience, Then we have A= LU -> (2) where 4 0 0 topes; L=l4& & O/amuU=l/o 1 a, Gi fe bs oot Since AX = B = (LU) X =B + LY = B where Y = UX (3) Now A = LU reduces to 4 9 O)f1 wu uo; a2 ay Flér fa Off0 1 uy a an ay By 832 As, 4 fa &a)l0 0 1 4 4 a ay My ff nui nuns =a, ay ay] = fy Guntln Guus +laus 6: Guet62 bnus + Coun + bs esas ts ere ate lee ere ERO Equating coefficients and simplifying we get , f= ay Ly = u,= 22280 Bi ae u ay, Far 2M, + u, = Sa— ity ln Now L and U are known from (3) we have LY = B 4 0 .0)(y 1 & O}ly,| = b, fn bse Multiplying and equating we get 4yy, 2b, > y= Ly = ar 2yths — Css) (ys. b; 45 = ay = 43-33 a ay SOsr My £8 cen a ay b,-¢ LY, + LnY, = b, = y, = WPS 41 + Lu, + Lysty, = bs => y, = y Y2 |, L and U Ys X can be found out from UX = Y Working Rule Then knowing y = 2 by Cys —faa¥2 b33 Let AX = B be the given system of equations Step 1 : Find the lower triangular matrix L and upper triangular matrix U using LU Step 2 :Consider LY = B and Find Y Step 3 : Consider UX = Y and Find X The elements of X constitute the solution of the given system. ee WORKED EXAMPLES 18) Solve the Following system of equations by using the Crout's method. x+y+z=1 3x+y-3z2 =5 x- 2y - Sz = 10 Solution : The matrix form of the given system is AX = B where nie x 1 A=[3 ! -3) x-l¥] pal 5 1-2 -5 z 10 We have LU =A : Tym Ome OD) (Aeruysmtys, \pne (le atc 7 OO | ORR tu) (| Sn GLO 0 1) Ub 2 5 Multiplying the matrices on the Jeft hand side and equating the corresponding elements on both sides, we get ante es) ma, 4n = Lusty = S4nt Ly tu 4,0, + 4, =-3 L,u,,+0,u, stl, ee the ubove equations, we get m= 2 Ly = -3,£,=3 > (4) u,=1 u,=1,u,=3 5 (5) Then using (1), (4) (5) we get 4 0 0 100 ee Cae a = ; 1-3 3 | & ‘y bs ‘2 Uys and U = Consider LY = B 1 0 O//fy, 3 -2 O} |y2 1 -3 3) \Ys. oof orn This gives ’ y= 1]. 3y, -2y,=5 [y= 1 y, -3y; +3y, = 10 => ys 1 Thus y =| y2 Ys, Now consider UX = Y la hyp 1 0.1 3yly| =|-1 0 0 lz 2 y +3; By back substitution we get y =-1-3x2=-7 x=14+7-2=6 +. x = 6, y = -7 and z = 2 is the required solution. 19) Use LU decomposition method to solve the system of equations. 2x+y+4z =12 4x + lly -z = 33 8x-3y +22 = 20 Solution : The matrix form of the given system is AX = B where 2 ie 4 x 12 Az=|4 Wl -1|,x=|]y|,B=| 33 See 2, 20 We have LU = A 4 0 O)(1 ur us) (2 1 4 (x fm 01/0 1 Usteya at -1 ty fn tyJl0 Oo 1 8 -3 2 Multiplying the matrices on the left hand side and equating the corresponding ele: on both sides, we get 4,52, 4,28 (1) ‘Numerical and Statistical Methods 4 ae CEES co -e Pepe cee e ase ga fite2t fytgtty =, Sut ba =F Lua, Laas + Lay = Lyttle Solving the above equations, we get i £, = 9,6, =-Tand 4, =-21 > 4) u,, = 12, u,,=2and wu, =-1 > (5) Then using (1), (4) and (5) we get 4, 0 0) (2 0 0 Qn Ga O|a|]@ 9 © by ny bs Sie? 2) Hleru mtu, an (tel ee andu=/9 1 tml .{0 1 -1 ooi1 oo. Consider LY = B 20 0 y 12 aro a0 Y2] | 33 8 -7 -21) ly, 20 This gives 2y,= 12, dy, + 9y, = 33, By, ~7y, -21y, = , ls 'y; = 20 =h=6] [y= 1] and y, =I ” 6 El Ys, 1 Now consider UX = Y CS at This gives x + 3 +22 =6 y2=l z=l By back substitution we get an a eae ae numerical and Statistical Methods (BCA) 8 ysle+z =14+1 x=6-3 261-223 *=3,y=2andz=1 js the required solution. 20) Solve the Following system of equations by using the Crout's method. 3k +y +22 =3 2x -3y -2 = 3 X42 4224 Solution : The matrix form of the given system is AX = B where Biola 2 x 3 aioe [xen [fee B=|3 121 z 4 we have LU = A wm © OVO a ag 3 alee ccc | (Oe re [ees 6 fa &e)\O 0 1 aie Multiplying the matrices on the left hand side and equating the corresponding elements on both sides, we get 4,=3, 4,=2, ca eae 4Un Lt, ‘ AyByyt by es fu ial £0, a Lb, <1 Ly Uy tlyUaytly, Solving the above equations, we get 4,5-11B 2,258 1,218 u,=248 Using (1), (4) (5) we get % 0 0 Baa) 0 OO} _|2 -11/3 0 CCC) nS Ss Turse 113 2/3 Py ORM es ee OTT ® © i ORC aa Consider LY = B ie Yo 15/11 % fn Now consider UX = Y WY} AVJENYAS 1 0 1 aii} y} _ fast 0 0 1 Zz -1 = xX+ a + de =I 7 15 aati z=-l By back substitution we get y =2and x=1 X= 1, y = 2 and z = -1 is the required solution. 21) Use LU decomposition method to solve the following system of equations, X, + 3x, + 8x, =4 x, + 4x, +3x, X, + 3x, + 4x, = Solution : The matrix form of the given system of equation is AX = B where 2 ies eS x i A= 14 3) x= %2/and B= |~2 13 4 x3 1 =—_ ~~ numerical and Statistical Methods (BCA) n we have LU = A 4 9 OL up us) (1 3 8 fy 00 1 agli 4 3 ty G2 %3J\O 0 1 134 Multiplying the matrices on the left hand side and equating the corresponding elements on both sides, we get 4,=1, . 4,21 Te ae a Ly = 8 Etat Lady = 3 Ly uty tstlyy Solving the above equations, we get 4n= 1,2, = 0,2, =-4 (4) U2 = 3, Wy = 8, u,, = -5 > (5) Using (1), (4) (5) we get &, 0 O ye ree |e OV FN COC) 6 bn bs) lo -4 Ne eanur 13 8 anddu=}9 1 | 2/0 1 -5 0 0 i oo1 Consider LY = B 10 0 ys 4 aetna y2| ~| 2 10 -4) ys This gives y,=4]. y,+y,=-2= y, 4y, = 1 Sly, = 34 yi Q wy =|22} =| 7° Y3 314, Now consider UX = Y nes) [: 1 aC ca 00 3/4 This gives X, + 3x, + 8x, x, - Sx, =-6 x, = 3/4 By back substitution we get x, =-9/4 and x, = 19/4 = 2. x= -2 gc 3 is the required solution. 26 Iterative Methods In the preceeding sections we considered the Gauss elimination method, Gay pveerio jen thet Uyiecartete ane eneciendletisel enelal ron nemncncieste system of 8 fauations. These methods yield the exact solutions for the system and are methods. In many situations, it is tedious to obtain exact solutions and we find only approximate solutions. which can be achieved using iterative method, Where with a rough approximation (which is called initial approximation) of the solution ang "* step by step towards better approximations. Here we consider one such iterative method ie as the Gauss-Seidel method. But the method of iteration is not applicable to all systems of equations, These ca applicable when each equation of the system must contain one large coefficient (auch 5 than the others in that equation) and the large coefficient must be attached to a Gifferent unig, in that equation, ° In other words the solution of a system of linear equations will exist by iterative proog fficient is greater than the sum of the absolute yak if the absolute value of the largest coe! equation (which is the condition for Convergence} of all remaining coefficients in each licable when the numerically large coefficients are along thea Note : Iterative method is app! diagonal of the coefficient matrix. Such a system is called diagonally dominant system. Ss time we may have to fe-arrange the given system of equations to meet this requirement. 2.7 Gauss-Seidel Method Consider the system of equations : Sr om rea a %\* 2nX, + a,x, = b, aX, + 8,X,+4,x, = b, Tefey as therefore ,."° =) (Uh) g when the imate solution of th The iteration process is stoppe degree of accuracy. The final values of %» ©, x, x,” are not given We ta, fe Ky Xy ; « proximation’ x system (1). s Important Note When the initial PI them as x,” = and x,° = : : EXAMPLES tem of equations. 22) Using Gauss-Seidel method solve the followin’ a nox +y 22 = 17 3x + 20y -2 = 38 2x By + 202 = 25 is nerf 0). Carry out three iterations using the initial approximation (0, 0, 0), is diagonally dominant solving fOr % Ys Z We ge that the given system Solution : We note 1 eae 22) AO x 1 i pig — at + * Y= oo aaa : 1 a 3y] method is given by z ‘The iterative scheme for Gauss-Seidel f= y+ 22°) xed = ple 20 Dag axen-e 28] p90) 20 yn? 1 a = 95 25- axe 4 By] given that initial approximation is x= 0, y= 0, 27 = 0 Putting r = 0 in (1) we get “my ny Z [17 - y+ 22) = 35 [17 - 0 + 0] = 085 a 20 y= bag - ax + 2 1 a 3x0 + 20] = 55 [-18 -2.25+0}=-1.0275 1 2 = = [25- ee 39 (25 - 2x" + By" = 35 [25-1.7-3.0825] =1.0109 Putting r= 1 in (1) we get qos 3p U7 = ¥ + 221 = 1.0025 1 = 5p [18 - 3x2 + 119 = - 0.9998 1 29 = 55 (25 - 2x + 3y%] = 0.9998 Putting = 2 in (1) we get 1 = sp LIT ~ yo + 22% = 0.9999 yO) = J (218 ~ 3x0 + 2) = -0.9999 QP sy (25 ~ 250) + 3) = 1.0000 After three iterations X = 0.9999 = 1, y = - 0.9999 = -1, z = 1.0000 = 1 23) Using Gauss-Seidel method solve the following system of equations. lx+y+z=12 x+l0y+z=12 x +y + 102 = 12 Carry out 4 iterations. Solution : We note that the given system is diagonally dominant solving for x, y, 2 we get 1 x= 7p (l2-y-2 ae Y= 7p 2-x-2 1 z= 75 li2-y—) The iterative scheme for Gauss-Seidel method is given by ed nya yor = * (12 = xe» — 0 30) =0,1,23 1 we) = 5 (12 — xe — yy Let us take the initial approximation is x%=0 = y® = 20 Putting r = 0 in (1) we get eo ere eee ore x0 = 2-¥" 1 0 ane all 1 y= gh 9-x0- A1= 7g? 12-0) = 9, 1 1 = yt) = — [12+1.241.08) 2 = 7 2-29 -¥I= 70 T= os, Putting r = 1 in (1) we get 1 (0] = 0.9948 fe eee] xe io £ y 1 <0] = 1.0033 a= + 2 -x- 2) = 1 Pail 2 = [12 - x — y"] = 1.0002 Putting r = 2 in (1) we get x0 = © [12 — y® — 29] = 0.9997 10 1 is — x® — 2] = 1,00002 y= 75 U2-x Hoe z [12 - x — y®) = 1.00003 Putting r = 3 in (1) we get x = a [12 - y® — 2°] = 0.9999 ~ 1 y= 3 [12 - x — 2] = 0.9999 = 1 edn yat : After four iterations the solution is x= ly=iz=1 24) Solving the following system of equations by using Gauss-Seidel meti.d correct to 3 decimal places. 8x -3y+2z = 20 4x + lly -z = 33 6x +3y + 122 = 35 BSCE CHEER CECE ECE Ce CECE CECE CCEEE ERE C CECE EEC CCCEEEPEESCCTCET Hee CEERRRL EEL Leterrier eerie merical and Statistical Methods (BCA) 83 Solution : We note that the given system is diagonally dominant solving for x, y, 2 we get 1 x = 3 [20 + 3y -22) 1 ¥ = 7 33 - 4x 42] 1 2 = Ty (35 - 6x -3y) The iterative scheme for Gauss-Seidel method is given by i XD = 5 120 + 3y0 — 22 1 yen = 1133 anim 4 20) =) 041,23. 1 200 = > [35 — 6xied — ayn} Let the initial approximation be x =0=y%= 20 Putting r = 0 in (1) we get i 1 x0 = § [20 + 3y 220 = & [20 40-0) = 25 1 y= i [33 - 4x 4 2] = + [33-10+0] = 2.0909 = = [35 - 6x" — 3y) = — (35-15-6.272) =1.1439 Putting r = 1 in (1) we get 1 x? = a (20 + 3y -22] = 2.9981 1 y? = 77 3 - 4x + 2} = 20138 1 2 = 135 - 6x ~ 3y%] = 0.9142 . Putting r = 2 in (1) we get l x) = 5 120 + 3y -27 = 3.0266 Numerical and Statistical Method, (te, y S u ot ig3 — 4x + 2 J= 1.9825 i 1.9077 om = z [35 - 6x? - 3y) Proceeding similarly we get (x, y, 2) = (3.0165, 1.9856, 0.9120) (x, y), 2) = (3.0166, 1.9859, 0.9119) (x®, y", 2) = (3.0167, 1.9859, 0.9118) ‘The approximate solution corrected to 3 decimal places is x= 3.0167, y = 1.9859 and z = 0.9118 25) Solving the following system of equations by using Gauss-Seidel method correcteq to 3 decimal places. X+y +54z = 110 27x + 6y -z = 85 6x + ISy + 2z =72 Solution : Since the diagonal elements in the coefficient matrix are not dominant, we rearrange the equations as follows, such that the diagonal elements in the coefficient matrix are dominant, 27x + 6y -z = 85 6x + ISy + 2z = 72 x+y +54z = 110 We note that now the system is diagonally dominant solving for x, y, z we get 1 x = = [85 - 6y +2] 7 1 y = 7g (72 - 6x -22] 1 z= 5; (10-x-y) The iterative scheme for Gauss-Seidel method is given by I = = Gy" + 2 37 (85 - by" + 29) xn = 1 y= — [72 — 6x" — 22) a) 20123... 15 wy a on _ yo) 20) mF (110 — xt — yor} - Numerical and Statistical Methods (BCA) 85 Let the initial approximation be x =0=y%~ 20 Putting r in (1) we get xb 5 _ gy 4 om 77 [85 - by + 2) 1 7 (85-0 +0} = 3.14815 1 1 ye jg (726x220) = 75 [72-6(3.14815) - 0] = 3.54074 1 i he AY =. 34 [110-x!-y}= 4 (110-3.14815- 3.54074}=1.91317 Putting r = 1 in (1) we get 1 xO = 7 (85 - 6y! + 2M 2.43218 mee OL Dt] = y? = Fy (72 - 6x 22 = 3.57204 Pe Flv 10-x0- yy = 1,92585 Putting r = 2 in (1) we get 1 i a (85 - 6y® + 2°] = 2.42569 1 y= Fy (72 -6x0- 22) = 357294 1 rer @)_y0y] = u 5g L110-x6 -y®)] = 1.92595 Putting r = 3 in (1) we get 1 x9 = = [85 - 6y + 29)] = 2.42549 2 1 yi = Fy (72 6x22) = 3.57301 1 ce ieee 29 = Zp UT10-x9-y9] = 192595 Itis clear that the solutions in third and fourth iterations are same corrected to 3 decimal places. Hence the solution is x= 2.425, y = 3.573 and z = 1.926 26) Solve by Gauss Seidal method. a 28x + dy -z = 32 x + 3y + 102 = 24 2x + Ty + 42 = 35 Carry out 4 iterations. aretha Solution : Presently the given system is not diagonally dominant. eet Bi Biven Equations as follows so that the given system becomes diagonally domin: 28x + 4y -2 = 32 2x + ITy + 4z = 35 x + 3y + 10z = 24 Solving for x, y, z we get x = >, [32 - 4y +z) y = 7 [35 - 2x -4z] 1 2 = jp (24-x-3y] Let x= 0 = y= 2 be the initial approximation, Then by iterative scheme of Gauss Seidal method we get First Iteration : x = 1 1 3g 82 - 4y% + 20) = 3g 32-0+0) = 1.1429 1 ee [35 - 2x ~ 420) = Bos 2x1.1429-0] =1.9244 mn =o [24-x)— syMl=7 mu. 1429- 3x1. 9244) = 1.8084 Second Iteration : 1 xO = 55 [32 - dy! + 21" 0.9325 y® = — [35 - 2x — 42!) = 1.5236 22) = 3 [24 -x® — 3y] = 1.8497 aero Third Iteration : xo = 1 3g (32 - 4y® + 2] = 0.9913 1 y= 77 135 - 2x - 420 = 1.5070 Me 6 [24 -x® — 3y0)] = 1.8488 Fourth Iteration : x= = [32 - 4y® + 2] = 0.9936 y= + B35 a 2x — 47] = 1.5069 w= + [24 -x — 3y4)] = 1.8486 After 4 iterations the approximate solution is ; x= 0.9936, y = 1.5069 and z = 1.8486 27) Apply the Gauss-Seidel iterative method to solve. Sx +2y+2=12 x + 4y +22 =15 Xx + 2y + 5z = 20 Carry out 4 iterations by taking the initial approximation as (1, 0, 3) Solution : We note that the given system is diagonally dominant. Solving for x,y, 2 we get 1 x= 5 [12-2y-2] 4 s-x-2 1 y = @ (IS -x-2z] > (0) 1 z= 5 20-x -2y] It is given that x= 1, y = 0, 2 =3 For the First Iteration (1) gives we [12 - 2y — 2) = t (12-0- 3] =18 y= Ble ule 1 (15 - x - 220) on U5 - 18-6) = 1.8 eat ig fee chne nae ea meaner aba poeta oN ‘Numerical and Statistical Methods a8 Ay a = FE (20- x" -2yi “j (20 ~ 1,8 - 3.6) = 2.92 For the Second Iteration (1) gives aoe ; (12 - 2y" ~ 2) = 1,096 1 p y= | [IS ~ x ~ 221) = 2.016 1 2 = = [20 ~ x" -2y2 = 2.9744 For the Third Iteration (1) gives HG ; [12 - ay — 229 = 0.9987 y= i [15 - x® — 222) = 2.0131 fs i [20 ~ x0 ay = 2.995 For the Fourth Iteration (1) gives x= ; [12 = 2y - 29] = 0.9958 ys i [5 = x ~ 2299 = 2.0036 0 =} 20 yo -2yey = 29504 Thus the approximate solution after 4 iteration is X = 0.9958, y = 2.0036 and z = 2.9994 28) Use Gauss-Seidel method to solve the system of equations. 13x, + 5x, - 3x, + x,= 18 2x, + 12x, + x, 4x, = 13 3x,- 4x, + 10x, + x, = 29 2x, + x,- 3x, + 9x, = 31 Carry out 4 iterations. Solution : We note that the given system is diagonally dominant, solving for x,.X,.%,.%, We get 1 4 = 75 [18 - 5x, #3x, -x,) rrical and Statistical Methods (BCA) ee | \ x, 1 2 U3 - 2x, ~ x, + ax 1 : Jo (29 ~ 3x, + 4x, - x) 1 a Xo = 9 GL ~ 2x, ~ x, + 3x) ‘The iterative scheme for Gauss-Seidel method is given by 1 RO) = Ty 18 - 5x, 43x, x0) PSOE oar geet a cnet ! Tq U3 - 2x," — x, + 4x, -@ ca 1 XY = 75 (29 — 3x, + axe — 25) r= 0,1,23.. on od on ct x 9 (31 = 2x, — xo 4 3x00] Let the initial approximation be x,= 0 = x9 = x, = x0 Putting r = 0 in (1) we get 1 + XO = Ty (1B-5x, 43x94, Ty [18-040-0] = 1.3846 1 1 A = 7p L13-2x "4, 44n,}= 75 [13-2.7692-040} =0.8526 1 1 XG 57 (29-3x, bn, -4 5 [29-4 153843.4104-0]-2.8257 x” =F LB1-2-ays3x) {31-2.7692-0852648.477113 9839 Putting r = 1 in (1) we get x” * [18-5x,(43x,0—x,] = 1.4023 1? = Busan mada." = 1.9421 x = 18-34 201 = 2.8578 x2) SE [BL 3x 1% 3x = 3.8696

You might also like