7.5. Indirect methods exercises#
Answer the following exercises based on the content from this chapter. The solutions can be found in the appendices.
Exercise 7.1
Using a pen and calculator, calculate the first 2 iterations of the Jacobi method for solving the system of linear equations below. Use starting values of \(x_i^{(0)} = 0 \) and work to 4 decimal places.
Solution
\(k\) |
\(x_1\) |
\(x_2\) |
\(x_3\) |
\(x_4\) |
|---|---|---|---|---|
0 |
0.0000 |
0.0000 |
0.0000 |
0.0000 |
1 |
3.5000 |
2.5000 |
-3.0000 |
1.0000 |
2 |
1.8750 |
1.1250 |
-2.0000 |
1.6667 |
Exercise 7.2
Repeat Exercise 7.1 using the Gauss-Seidel method.
Solution
k |
x(1) |
x(2) |
x(3) |
x(4) |
|---|---|---|---|---|
0 |
0.0000 |
0.0000 |
0.0000 |
0.0000 |
1 |
3.5000 |
1.6250 |
-1.9750 |
1.0333 |
2 |
2.3417 |
1.6792 |
-2.4025 |
1.5800 |
Exercise 7.3
Repeat Exercise 7.1 using the SOR method using the optimum value for the relaxation parameter.
Solution
\(\omega = 1.1136\)
k |
x(1) |
x(2) |
x(3) |
x(4) |
|---|---|---|---|---|
0 |
0.0000 |
0.0000 |
0.0000 |
0.0000 |
1 |
3.8977 |
1.6989 |
-2.0944 |
1.0749 |
2 |
2.0994 |
1.7227 |
-2.4910 |
1.7763 |
Exercise 7.4
Calculate the spectral radii for the three methods used to compute the solution to the system from Exercise 7.1. Which of the three methods would you expect to converge to a solution the fastest?
Solution
The SOR method will converge the fastest.
Exercise 7.5
Write a program to calculate the solution to the system of linear equations from Exercise 7.1 using the Jacobi, Gauss-Seidel and SOR methods using a convergence tolerance of \(tol=10^{-6}\). How many iterations did each of the three methods take to converge to the solution?
Solution
\(\mathbf{x} = (1.931496, 1.821914, -2.616440, 1.835620)\)
Jacobi: 19 iterations
Gauss-Seidel: 10 iterations
SOR: 7 iterations
Exercise 7.6
A linear system has the following coefficient matrix. What is the largest value that \(\alpha\) can be in order for the Jacobi method to be convergent?
Solution
\(\alpha = 4\)