Chapter 7: Problem 18
Write a program that solves the problem described in Exercise 10 , with a right-hand-side vector defined so that the solution is a vector of all \(1 \mathrm{~s}\). For example, for \(\omega=0\) the matrix and right-hand side can be generated by $$ \begin{aligned} &\mathrm{A}=\text { delsq }\left(\text { numgrid }\left(r \mathrm{~S}^{\prime}, \mathrm{N}+2\right)\right) ; \\ &\mathrm{b}=\mathrm{A} \text { *ones }\left(\mathrm{N}^{\wedge} 2,1\right) \end{aligned} $$ Your program will find the numerical solution using the Jacobi, Gauss-Seidel, SOR, and CG methods. For CG use the MATLAB command pcg and run it once without preconditioning and once preconditioned with incomplete Cholesky IC(0). For SOR, use the formula for finding the optimal \(\omega^{*}\) and apply the scheme only for this value. As a stopping criterion use \(\left\|\mathbf{r}_{k}\right\| /\left\|\mathbf{r}_{0}\right\|<10^{-6}\). Also, impose an upper bound of 2000 iterations. That is, if a scheme fails to satisfy the accuracy requirement on the relative norm of the residual after 2000 iterations, it should be stopped. For each of the methods, start with a zero initial guess. Your program should print out the following: \- Iteration counts for the five cases (Jacobi, Gauss-Seidel, SOR, CG, PCG). \- Plots of the relative residual norms \(\frac{\left\|\mathbf{r}_{k}\right\|}{\mathfrak{b} \|}\) vs. iterations. Use the MATLAB command semilogy for plotting. Use two grids with \(N=31\) and \(N=63\), and repeat your experiments for three values of \(\omega: \omega=0, \omega^{2}=10\), and \(\omega^{2}=1000 .\) Use your conclusions from Exercise 16 to explain the observed differences in speed of convergence.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.