$30
MATH 472 COMPUTING PROJECT # 3
The object of this project is to implement and study the convergence rates of three
iterative methods: Jacobi, Gauss-Seidel and SOR. These methods will be applied to
the system Ax = b where A is the n n tridiagonal matrix A = [1 2 1] and
we want to apply these methods to di?erent system sizes n = 25; 50; 100; 200.
For a given n, let h =
1
n+1 . The vector b is given by
bi = 2h
2
; i = 1; : : : ; n;
and the solution x is given by
xi = ih(1 ih); i = 1; : : : ; n:
Implement each of the three methods paying special attention not the store the
matrix in general form and to avoid multiplication by zeros. In other words
you need to exploit the sparsity of the matrix.
For the SOR method use the following values for the relaxation parameter !:
n 25 50 100 200
! 1.78486 1.88402 1.93968 1.96922
For each of the 12 tasks
(1) Start the iteration with x
(0) = 0.
(2) Stop the iteration when kx
(k)xk1 < 106
. Print the number k of iterations.
(3) Calculate and print the experimental estimation of ?(T) using the formula
?(T) ? exp ?
1
k
log
kx
(k) xk1=kx
(0) xk1
?