Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(40 points) Extra credit: Consider the n n pentadiagonal matrix 1 1/2 1/2 A=11/2 1/2 1/2 1/2 n Such a matrix can be constructed in
(40 points) Extra credit: Consider the n n pentadiagonal matrix 1 1/2 1/2 A=11/2 1/2 1/2 1/2 n Such a matrix can be constructed in MATLAB by typing: % Construct the pentadiagonal matrix: one ones (n, 1); A 0.5 spdags([ 2*(1: n), one],-2:2,n,n); * one one one Let Xe be the vector of n ones and consider n 500. Set b = Axe, i.e., in order to find the rhs vector, fix tol 10-13, and consider an initial vector with n zeros. Then: Use your code developed in Question 6 (employing the Conjugate Gradient (CG) method without preconditioning) to solve the linear system Ax b Use the Preconditioned Conjugate Gradient (PCG) method implemented in my_pcg.m MATLAB file with the Jacobi and Gauss-Seidel precondition- ers in order to solve the same linear system (see, Remarks for details about the preconditioners in the respective cases) Compare/plot (in a semilog scale) the errors of these three runs against step number k. Attach your plot Remarks: As far as the preconditioners P are concerned, use the following: Jacobi preconditioner: P- D (D is the diagonal matrix extracted from A) . Gauss-Seidel preconditioner: P = (1+LD-1)(D+U) with L and U being the strictly lower and upper triangular matrices, again, extracted from A Also, the MATLAB function my pcg.m is provided! (40 points) Extra credit: Consider the n n pentadiagonal matrix 1 1/2 1/2 A=11/2 1/2 1/2 1/2 n Such a matrix can be constructed in MATLAB by typing: % Construct the pentadiagonal matrix: one ones (n, 1); A 0.5 spdags([ 2*(1: n), one],-2:2,n,n); * one one one Let Xe be the vector of n ones and consider n 500. Set b = Axe, i.e., in order to find the rhs vector, fix tol 10-13, and consider an initial vector with n zeros. Then: Use your code developed in Question 6 (employing the Conjugate Gradient (CG) method without preconditioning) to solve the linear system Ax b Use the Preconditioned Conjugate Gradient (PCG) method implemented in my_pcg.m MATLAB file with the Jacobi and Gauss-Seidel precondition- ers in order to solve the same linear system (see, Remarks for details about the preconditioners in the respective cases) Compare/plot (in a semilog scale) the errors of these three runs against step number k. Attach your plot Remarks: As far as the preconditioners P are concerned, use the following: Jacobi preconditioner: P- D (D is the diagonal matrix extracted from A) . Gauss-Seidel preconditioner: P = (1+LD-1)(D+U) with L and U being the strictly lower and upper triangular matrices, again, extracted from A Also, the MATLAB function my pcg.m is provided
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started