4 Iterative methods
An implementation of the five-point stencil
leads to a system of simultaneous equations in the unknowns. This system of equations can be dealt with using methods seen in HELM booklet 30, but here we show ways in which systematic iterative methods can be derived directly from the numerical stencil .
The general approach is as follows:
- Start with an initial guess for the unknowns. Call this initial guess .
- Use some means to improve the guess. Call the improvement .
- And so on. In general we derive a new set of approximations in terms of the previous approximations .
4.1 Jacobi iteration
The approach we adopt here is to update the approximation at the centre of the stencil using the four old values around the edge of the stencil. That is
rearranging this gives
The following Example uses the same data (rounded to four decimal places here) as in Example 6.
Example 7
Suppose that satisfies Laplace’s equation
in the square region with on the boundary. Assuming a mesh size of use the Jacobi iteration, with starting values , to perform two iterations. The boundary data are as given in the schematic below.
Solution
Putting in the initial guesses for the four unknowns we obtain the situation depicted below.
The first iteration involves using
where, in this case, . So the first iteration gives us
The second iteration begins by putting these new approximations to the interior values into the grid. This gives
We now apply to obtain
In practice, using a computer to carry out the arithmetic, we would continue iterating until the results settle down to a converged value. Using a computer spreadsheet, for example, we can see that a total of 15 iterations is enough to achieve results converged to four decimal places. We noted earlier that, to four decimal places, , , and .
The following Task uses the same data as the preceding Task (pages 23-24), except that we have rounded the boundary data to four decimal places instead of using the exact fractions.
Task!
Suppose that satisfies Poisson’s equation
in the square region with on the boundary. Assuming a mesh size of use the Jacobi iteration, with starting values , to perform two iterations. The boundary data are as given in the schematic below.
Putting in the initial guesses for the four unknowns we obtain the situation depicted below.
The first iteration involves using
where in this case . So the first iteration gives us
The second iteration begins by putting these new approximations to the interior values into the grid. This gives
We now perform the second iteration again, but with the new values. We obtain
In the case above 17 iterations are required to achieve results that have converged to 4 decimal places. We find that , , and .
4.2 Gauss-Seidel iteration
In the implementation of the Jacobi method we used old values for the southerly and westerly points when new values had already been calculated.
The Gauss-Seidel method uses the new values as soon as they are available. Stating this formally we have
Example 8 below uses the same data as Examples 6 and 7.
Example 8
Suppose that satisfies Laplace’s equation
in the square region with on the boundary. Assuming a mesh size of , use the Gauss-Seidel iteration, with starting values , to perform two iterations. The boundary data are as given in the schematic below.
Solution
Putting in the initial guesses for the four unknowns we obtain the situation depicted below.
The first iteration involves using
where in this case . So the first iteration gives us
The second iteration begins by putting these new approximations to the interior values into the grid. This gives
We now apply to obtain
(And, using a computer spreadsheet, for example, we can see that a total of 7 iterations is enough to achieve results converged to four decimal places. This compares well with the 15 iterations required by Jacobi in Example 7.)
Task!
Suppose that satisfies Poisson’s equation
in the square region with on the boundary. Assuming a mesh size of use the Gauss-Seidel iteration, with starting values , to perform two iterations. The boundary data are as given in the schematic below.
Putting in the initial guesses for the four unknowns we obtain the situation depicted below.
The first iteration involves using
where in this case . We need to take care so as to use new values as soon as they are available So the first iteration gives us
(to 4 decimal places).
The second iteration begins by putting these new approximations to the interior values into the grid. This gives
We now apply again, but with the new values. We obtain
and we can write this information in the form
Again, a computer can be used to continue iterating until convergence. This method applied to this Task needs 8 iterations to achieve 4 decimal place convergence, a fact which compares very well with the 17 required by the Jacobi method.
4.3 Convergence
We now summarise some important points
- For the problems discussed in these pages, the Jacobi and Gauss-Seidel methods will always converge for any initial guesses . (Of course, very poor initial guesses will result in more iterations being required.)
- For a given problem and given starting guesses , the Gauss-Seidel method will, in general, converge in fewer iterations than Jacobi . (That is, using the new, improved values as soon as they are available speeds up the process.)
- One possible advantage with the Jacobi approach is that it can be parallelised , that is, it is in theory possible to do all the calculations for a given iteration simultaneously. In other words, everything we will need to know to carry out an iteration is known before the iteration begins. This is not the case with Gauss-Seidel in which during an iteration, most calculations use a result from within the current iteration. This advantage with Jacobi only manifests itself when using computers with a parallelisation option and for large problems.
Exercises
-
Suppose that
satisfies Laplace’s equation
in the square region . Assuming a mesh size of use the Jacobi iteration, with starting values , to perform two iterations. The boundary data are as given in the schematic below:
-
Suppose that
satisfies Laplace’s equation
in the square region . Assuming a mesh size of use the Gauss-Seidel iteration, with starting values , to perform two iterations. The boundary data are as given in the schematic below.
-
Putting in the initial guesses for the four unknowns we obtain the situation depicted below.
The first iteration involves using
where in this case . So the first iteration gives us
The second iteration begins by putting these new approximations to the interior values into the grid. This gives
We now apply to obtain
-
Putting in the initial guesses for the four unknowns we obtain the situation depicted below.
The first iteration involves using
where in this case . So the first iteration gives us
The second iteration begins by putting these new approximations to the interior values into the grid. This gives
We now apply to obtain