Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

(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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Master The Art Of Data Storytelling With Visualizations

Authors: Alexander N Donovan

1st Edition

B0CNMD9QRD, 979-8867864248

More Books

Students also viewed these Databases questions

Question

name three characteristics of algorithms

Answered: 1 week ago

Question

5. How would you describe your typical day at work?

Answered: 1 week ago

Question

7. What qualities do you see as necessary for your line of work?

Answered: 1 week ago