Note: This problem uses the same setup as the Jacobi and Gauss-Seidel questions, but you are asked to calculate different values. It will probably be useful to copy code from those problems, but make sure that you alter your final answers accordingly. Any matrix A can be decomposed into a diagonal, upper and lower part: so that A = D + U + L. You can easily find these matrices in Matlab with the commands diag, triu and tril. These matrices are useful for devising different matrix splitting methods. For instance, in the Jacobi method we let A = P + T where P = D and T = U + L, and in the Gauss-Seidel method we set P = D + L and T = U. Another common matrix splitting method is called successive over-relaxation (SOR). It is exactly the same as the splitting methods we have already seen, except we set P = 1/w D + L and T = (w-1)/w D + U, where w is a constant between 1 and 2. (Notice that if w = 1 then this is exactly the same as Gauss-Seidel.) We will use this method to solve the system A_103 phi = rho that was described in the Jacobi and Gauss-Seidel problems. As a reminder, the setup for those problems is included at the bottom of this page. I have not included pretests for A, rho or phi in this problem, since you already know how to define them. Instead, you should define the matrices D, U and L for this problem and save them in variables named D, U and L. For any given w, the SOR method can be written as phi_k = M phi_{k-1} + c. For w = 1.6, find the largest (in magnitude) eigenvalue of M and save its magnitude in a variable named ans1. (Remember that you can find the magnitude of a number in Matlab with the abs command. Your answer should be a positive real number.) For every value of w between w = 1 and w = 1.99 in increments of 0.01, find the largest (in magnitude) eigenvalue of M. Find the value of w that gives you the smallest maximum eigenvalue and save this w in a variable named ans2. (That is, find the value of w for which this matrix splitting method will converge the fastest.) Use SOR to solve for phi with the optimal w you found in ans2. Your initial guess should be a vector of all 1's and you should stop when ||phi_k - phi_{k-1}||_inf < 10^-5. (These are the same conditions as in the Jacobi and Gauss-Seidel problems.) Determine the total number of iterations required with this optimal w (the initial guess does not count as an iteration, but every other guess does) and save this value in a variable called ans3. Save your final guess in a 103 x 1 column vector called ans4. To test the efficacy of this method, find the maximum error between your final answer and the true solution phi. That is, find ||ans4 - phi||_inf. Save your result in a variable named ans5. Poisson's Equation Consider the linear system A_n phi = rho, where A_n is an n x n matrix with 2's on the main diagonal, -1's directly above and below the main diagonal and 0's everywhere else. For example, A_5 = [ 2 -1 0 0 0; -1 2 -1 0 0; 0 -1 2 -1 0; 0 0 -1 2 -1; 0 0 0 -1 2]. This is a discretized version of Poisson's equation which appears very often in physical applications. We will discuss discretizations and differential equations, including the origin of the matrix A_n, later in the class. Construct the matrix A_103 in Matlab. (You should be able to do this in only a few lines with the help of the diag command. In particular, you should figure out what the commands diag(v), diag(v, 1) and diag(v, -1) do when v is a vector.) In addition, construct the 103 x 1 vector rho such that the jth entry of rho is defined according ot the formula rho_j = 2(1 - cos(37 pi / 104)) sin(37 pi j / 104). If you are particularly good with trigonometric identities, you can show that the exact solution to our problem is the 103 x 1 vector phi whose jth entry is defined according to the formula phi_j = sin(37 pi j / 104).