In this assignment, we will study the solution of a linear system using iterative methods. The system comes from the discretization of a two-dimensional PDE, Poisson's equation. For an integer size n, it can be created with the MATLAB code
A = delsq(numgrid('S', n+2)) * (n+1)^2;
b = ones(n^2, 1);
which produces a matrix A of size N ×N where N = n2.
1. Solve the system Ax = b for n = 50 using the following 6 methods, all starting from the zero initial vector.
(a) Jacobi's method
(b) The Gauss-Seidel method
(c) The SOR method, with ω = 2/(1 +√8/(n + 1))
(d) The Conjugate Gradient (CG) method
(e) The Preconditioned CG method, using M = the tridiagonal part of A
(f) The Preconditioned CG method, using M = RtR where R is computed by the MATLAB command R = ichol(A);. Note: Do not form the matrix M explicitly, but use two backslashes involving Rt and R. Perform 1000 iterations with each method and compute the ∞-norm of the error at each iteration. Plot the convergence (errors vs. iteration) of the methods in a semi-log plot.
2. Solve the system again using the 6 methods above, but for the values n = 5,10,20,50,100. Iterate until the error is less than 10-6 times the initial error, but not more than 1,000 iterations. Plot the number of iterations vs. the system size N in a log-log plot.
3. Using the plot in 2. and assuming that the computational time for each iteration is proportional to N, estimate the exponent p in the total solution time T = constant·Np for each of the methods