{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw5 - [x]=Jacobi(A,b,x that implements Jacobi iteration(cf...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 257 Numerical Methods - Homework 5 September 29, 2006 1. [1pt] 7.3 #2 2. [2pt] 7.3c #5. Turn in your implementation of Tri() . You can construct the matrix in MATLAB with: A = full(spdiags([4*ones(100,1),-ones(100,1),-ones(100,1)],[0,-1,1],100,100)); 3. [1pt] 8.1 #1a 4. [1pt] 8.1 #9 5. [1pt] 8.1 #21 6. [1pt] 8.1 #22 7. [Optional 0pt] (a) Write a MATLAB function [L,U]=ludoo(A) that implements LU using the Doolittle implementation (cf. pg. 320). (b) Write a MATLAB function [x]=solve ludoo(L,U,b) to solve Ax = b with LU from the previous problem (c) Test your methods above by comparing ˆ x = A \ b with our solution for a random nxn matrix problem (A and b) with n=100. (The norm || x - ˆ x || should be around machine precision). 8. [Optional 0pt] (a) Write a MATLAB function
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: [x]=Jacobi(A,b,x) that implements Jacobi iteration (cf. pg. 347). (b) Write a MATLAB function [x]=GS(A,b,x) that implements Gauss-Seidel iteration (cf. pg. 347). (c) In both iterative methods let x k denote the approximate solution vector after the k-th iteration (where x is initialized to the zero vector). For both methods above, compute the norm of the residual r k = || b-Ax k || at each iteration where A = gallery(’poisson’,10); in MATLAB. Create a semilog plot showing the norm residual throughout iteration. (d) Repeat the previous problem on the matrix A = gallery(’poisson’,10) - 2*speye(100); . What happens? Hint: look at Theorem 2, pg. 349. 1...
View Full Document

{[ snackBarMessage ]}