Department of Mathematics MTL107: Numerical Methods And

Department of Mathematics MTL107: Numerical Methods And

Department of Mathematics MTL107: Numerical methods and Computations MATLAB PRACTICE SHEET-3: Iterative Techniques in Matrix Algebra-Jacobi, Gauss-Siedel Iterative Techniques, Successive Over-Relaxation(SOR) Techniquesfor Solving Linear Systems, Condition Number, Well-conditioning, Ill-conditioning, The Conjugate Gradient Method. −3 1. Use the Jacobi method to solve the linear systems , with T OL = 10 in the l1 norm. using x(0) = 0: a. 3x1 − x2 + x3 = 1; b. 10x1 − x2 = 9; 3x1 + 6x2 + 2x3 = 0; −x1 + 10x2 − 2x3 = 7; 3x1 + 3x2 + 7x3 = 4: −2x2 + 10x3 = 6: c. 10x1 + 5x2 = 6; d. 4x1 + x2 + x3 + x5 = 6; 5x1 + 10x2 − 4x3 = 25; −x1 − 3x2 + x3 + x4 = 6; −4x2 + 8x3 − x4 = −11:6; 2x1 + x2 + 5x3 − x4 − x5 = 6: −x3 + 5x4 = −11; −x1 − x2 − x3 + 4x4 = 6; 2x2 − x3 + x4 + 4x5 = 6: 2. Use the Gauss-Seidel method to solve the linear systems in Exercise 1, with T OL = 10−3 in the l1 norm. 3. The linear system 2x1 − x2 + x3 = −1; 2x1 + 2x2 + 2x3 = 4; −x1 − x2 + 2x3 = −5: t has the solutin (1; 2; −p2) : 5 a. Show that ρ(Tj) = 2 > 1: b. Show that the Jacobi method with x(0) = 0 fails to give a good approximation after 25 iterations. 1 c. Show that ρ(Tg) = 2 : d. Use the Gauss-Seidel method with x(0) = 0 to approximate the solution to the linear −5 system to within 10 in the l1 norm. 4. The liear system x1 − x3 = 0:2; 1 1 − 2 x1 + x2 + 4 x3 = −1:425; 1 x1 − 2 x2 + x3 = 2: has the solutin (0:9; −0:8; 0:7)t: a. Is the coefficient matrix 21 0 −13 1 1 A = 4 2 1 − 4 5 1 1 − 2 1 strictly diagonally dominant ? b. Compute the spectral radius of the Gauss-Seidel matrix Tg. c. Use the Gauss-Seidel iterative method x(0) = 0 to approximate the solution to the linear system with a tolerance of 10−2 and a maximum of 300 iterations. d. What happens in part(c) when the system is changed to x1 − 2x3 = 0:2; 1 1 − 2 x1 + x2 − 4 x3 = −1:425; 1 x1 − 2 x2 + x3 = 2: 5. Use the SOR method with ! = 1:2 to solve the linear systems , with a tolerance −3 (0) T OL = 10 in the l1 norm. using x = 0: a. 3x1 − x2 + x3 = 1; b. 10x1 − x2 = 9; 3x1 + 6x2 + 2x3 = 0; −x1 + 10x2 − 2x3 = 7; 3x1 + 3x2 + 7x3 = 4: −2x2 + 10x3 = 6: c. 10x1 + 5x2 = 6; d. 4x1 + x2 + x3 + x5 = 6; 5x1 + 10x2 − 4x3 = 25; −x1 − 3x2 + x3 + x4 = 6; −4x2 + 8x3 − x4 = −11:6; 2x1 + x2 + 5x3 − x4 − x5 = 6: −x3 + 5x4 = −11; −x1 − x2 − x3 + 4x4 = 6; 2x2 − x3 + x4 + 4x5 = 6: 6. (i) Use Gaussian elimination and 3-digit rounding arithmetic to approximate the solution to the following linear systems. (ii) Then use one iteration of iterative refinement to im- prove the approximation, and compare the approximations to the actual solutions. a. 0:03x1 + 58:9x2 = 59:2; b. 3:03x1 − 12:1x2 + 14x3 = −119; 5:31x1 − 6:10x2 = 47:0; −3:03x1 + 12:1x2 − 7x3 = 120; t Actual solution [10; 1] 6:11x1 − 14:2x2 + 21x3 = −139: 1 t Actual solution [0; 10; 7 ] p p p c. 1:19x1 + 2:11x2 − 100x3 + x4 = 1:12; d. πx1 − ex2 + 2x3 − 3x4 = 11; 14:2x − 0:122x + 12:2x − x = 3:44; π2x + ex − e2x + 3 x = 0; 1 2 3 4 p1 2 p 3 7 4 p 100x − 99:9x + x = 2:15; 5x − 6x + x − 2x = π; 2 3 4 1 p2 3 4 p 3 2 1 15:3x1 + 0:110x2 − 13:1x3 − x4 = 4:16; π x1 − e x2 − 7x3 + 9 x4 = 2; Actual solution [0:176; 0:0126; −0:0206; −1:18]t: Actual solution [0:788; −3:12; 0:167; 4:55]t: −3 −1 7. Perform the conjugate gradient method with T OL = 10 in the l1 norm, (C = C = I ) on each of the following linear systems. a. 3x1 − x2 + x3 = 1; b. 10x1 − x2 = 9; −x1 + 6x2 + 2x3 = 0; −x1 + 10x2 − 2x3 = 7; x1 + 2x2 + 7x3 = 4: −2x2 + 10x3 = 6: c. 10x1 + 5x2 = 6; d. 4x1 + x2 − x3 + x4 = −2; 5x1 + 10x2 − 4x3 = 25; x1 + 4x2 − x3 − x4 = −1; −4x2 + 8x3 − x4 = −11; −x1 − x2 + 5x3 + x4 = 0: −x3 + 5x4 = −11; x1 − x2 + x3 + 3x4 = 1; e. 4x1 + x2 + x3 + x5 = 6; f. 4x1 − x2 − x4 = 0; x1 + 3x2 + x3 + x4 = 6; −x1 + 4x2 − x3 − x5 = 5; x1 + x2 + 5x3 − x4 − x5 = 6; −x2 + 4x3 − x6 = 0: x2 − x3 + 4x4 = 6; −x1 + 4x4 − x5 = 6: x1 − x3 + 4x5 = 6: −x2 − x4 + 4x5 − x6 = −2: −x3 − x5 + 4x6 = 6: 8. Given 2 3 2 3 2 3 4 −1 0 0 −1 0 0 0 0 0 0 0 6−1 4 −1 0 7 6 0 −1 0 0 7 60 0 0 07 6 7 6 7 6 7 A1 = 6 7 ; −I 6 7 ; and O = 6 7 : 4 0 −1 4 −15 4 0 0 −1 0 5 40 0 0 05 0 0 −1 4 0 0 0 −1 0 0 0 0 Form the 16 × 16 matrix A in partitioned form, 2 3 A1 −I 0 0 6−I A −I 0 7 6 1 7 A=6 7. 4 0 −I A1 −I 5 0 0 −I A1 Let b = (1; 2; 3; 4; 5; 6; 7; 8; 9; 0; 1; 2; 3; 4; 5; 6)t: a. Solve Ax = b using the conjugate gradient method with tolerance 0.05. b. Solve Ax = b using the preconditioned conjugate gradient method with C −1 = D−1=2 and tolerance 0.05. c. Is there any tolerance for which the methods of part(a) and part(b) require a different number of iterations ? ANSWERS 1. Jacobi's Algorithm gives the following results: a. x(10) = (0:03507839; −0:2369262; 0:6578015)t b. x(6) = (0:9957250; 0:9577750; 0:7914500)t c. x(22) = (−0:7975853; 2:794795; −0:2588888; −2:251879)t d. x(14) = (−0:7529267; 0:04078538; −0:2806091; 0:6911662)t: 2. The Gauss-Seidel Algorithm gives the following results: a. x(6) = (0:03535107; −0:2367886; 0:6577590)t b. x(4) = (0:9957475; 0:9578738; 0:7915748)t c. x(10) = (−0:7973091; 2:794982; −0:2589884; −2:251798)t d. x(7) = (0:7866825; −1:002719; 1:866283; 1:912562; 1:989790)t: 2 1 1 3 0 2 − 2 3 5 3. a. Tj = 4−1 0 −15 and det(λI − Tj) = λ + 4 λ. 1 1 2 2 0 p p 5 5 Thus, the eigenvalues of Tj are 0 and ± 2 i; so ρ(Tj) = 2 > 1: b. x(25) = (−20:827873; 2:0000000; −22:827873)t: 20 1 − 1 3 2 2 2 1 1 1 c. Tg = 40 − 2 − 2 5 and det(λI − Tg) = λ λ + 2 1 0 0 − 2 1 1 Thus, the eigenvalues of Tg are 0, − 2 ; and − 2 ; and ρ(Tj) = 1=2: (23) t −5 d. x = (1:0000023; 1:9999975; −1:0000001) is within 10 in the l1 norm. 4. a. A is not strictly diagonally dominant. 2 0 0 1 3 b. a. Tj = 40:5 0 0:255 and ρ(Tj) = 0:97210521: −1 0:5 0 Since Tj is convergent, the Jacobi method will converge. c. With x(0) = (0; 0; 0)t; x(187) = (0:90222655; −0:79595242; 0:69281316)t: d. ρ(Tj) = 1:39331779371: Since Tj is not convergent, the Jacobi method will not converge. 5. The SOR Algorithm gives the following results. a. x(12) = (0:03488469; −0:2366474; 0:6579013)t b. x(7) = (0:9958341; 0:9579041; 0:7915756)t c. x(8) = (−0:7976009; 2:795288; −0:2588293; −2:251768)t d. x(7) = (−0:7534489; 0:04106617; −0:2808146; 0:6918049)t: e. x(10) = (0:7866310; −1:002807; 1:866530:1:912645; 1:989792)t f. x(7) = (0:9999442; 1:999934; 1:000033; 1:999958; 0:9999815; 2:000007)t: 6. Gaussian elimination and iterative refinement give the following results. a. (i) (10:0; 1:01)t; (ii) (10:0; 1:00)t b. (i) (12:0; 0:499; −1:98)t; (ii) (1:00; 0:500; −1:00)t c. (i) (0:185; 0:0103; −0:0200; −1:12)t; (ii) (0:177; 0:0127; −0:0207; −1:18)t d. (i) (0:799; −3:12; 0:151; 4:56)t; (ii) (0:758; −3:00; 0:159; 4:30)t (3) t (3) −9 7. a. x = (0:06185567013; −0:1958762887; 0:6185567010) ; jjr jj1 = 0:4 × 10 : (3) t (3) −9 b. x = (0:9957894738; 0:9578947369; 0:7915789474) ; jjr jj1 = 0:1 × 10 : c. x(4) = (−0:7976470579; 2:795294120; −0:2588235305; −2:251764706)t; (4) −7 jjr jj1 = 0:39 × 10 : d. x(4) = (−0:7534246575; 0:04109589039; −0:2808219179; 0:6917808219)t; (4) −9 jjr jj1 = 0:11 × 10 : e. x(5) = (0:4516129032; 0:7096774197; 1:677419355; 1:741935483; 1:806451613)t; (5) −9 jjr jj1 = 0:2 × 10 : f. x(4) = (1:000000000; 2:000000000; 1:000000000; 2:000000000; 0:9999999997; 2:0000000000)t; (4) −9 jjr jj1 = 0:44 × 10 : −2 8. This converges in 6 iterations with tolerance 5:00 × 10 in the l1norm and a. Solution Residual 2.55613420 0.00668246 4.09171393 -0.00533953 4.60840390 -0.01739814 3.64309950 -0.03171624 5.13950533 0.01308093 7.19697808 -0.02081095 7.68140405 -0.04593118 5.93227784 0.01692180 5.81798997 0.04414047 5.85447806 0.03319707 5.94202521 -0.00099947 4.42152959 -0.00072826 3.32211695 0.02363822 4.49411604 0.00982052 4.80968966 0.00846967 3.81108707 -0.01312902 (6) jjr jj1 = 0:046: −2 This converges in 6 iterations with tolerance 5:00 × 10 in the l1norm and (6) jjr jj1 = 0:046: b.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    6 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us