Writing the system Av=b in components, we have
Assume for the moment that A is diagonally dominant - that is,
.
Assume we have an initial guess.
For any future iterate, we can write
With any luck, this procedure will converge. Indeed, if A is strictly diagonally dominant, convergence can be proved.
Note that we compute just based on
.
What if we used new information, the
, as soon
as they are available? We would have something like
This is the Gauss-Siedel method.
If you run trough the calculation for GS, based on the usual approximation for second derivatives, you see that grid points decouple into two sets, say the odd and even grid points (in 1D) or black and red squares on a checkerboard (in 2D). The solution at the odd gridpoints depends only on the solution at neighboring even points, and vise versa. Thus you can solve the system in two sweeps of Jacobi-like passes on the odd and even, or red and black, grid points.
Jacobi and GS are both notoriously slow in converging. Next we will look at speeding up the calculation, based on the multigrid method. But to set the stage for your first assignment
Homework 1 Part 1 Write a Jacobi and Red-Black GS solver for the 2-point BVP
with Dirichlet and Neumann boundary
conditions, on a grid of N=100 - N=1000.
In contrast to earlier work, however, assume that a=a(x)
is prescribed but NOT constant. In fact,
for the homogeneous Dirichlet problem with f=1, let
a=1 for 0<x<.25 and .75< x <1,
but a =
for .25 < x < .75. Start with
to test your solver.
Then push
How many iterations does it take for convergence?