** Next:** Solving tridiagonal simultaneous equations
** Up:** FINITE DIFFERENCING IN (omega,x)-SPACE
** Previous:** The leapfrog method

The **Crank-Nicolson method** solves both the accuracy and the
stability problem.
Recall the difference representation of the **heat-flow equation** (27).

| |
(29) |

Now, instead of expressing the right-hand side entirely at time *t*,
it will be averaged at *t* and *t*+1, giving
| |
(30) |

This is called the **Crank-Nicolson method**.
Defining a new parameter
,the difference star is
| |
(31) |

When placing this star over the data table, note that,
typically, three elements at a time cover unknowns.
To say the same thing with equations,
move all the *t*+1 terms in
(30) to the left and the *t* terms to the right, obtaining
| |
(32) |

Now think of the left side of equation (32)
as containing all the *unknown* quantities
and the right side as containing all *known* quantities.
Everything on the right can be combined into a single known quantity,
say, *d*_{t}^{x}.
Now we can rewrite equation (32)
as a set of simultaneous equations.
For definiteness,
take the *x*-axis to be limited to five points.
Then these equations are:

| |
(33) |

Equation (32)
does not give us each *q*_{t+1}^{x}
*explicitly*, but
equation (33)
gives them
*implicitly*
by the solution of simultaneous equations.
The values and are adjustable
and have to do with the side **boundary condition**s.
The important thing to notice is that the matrix is **tridiagonal**, that is,
except for three central diagonals all the elements of the
matrix in (33) are zero.
The solution to such a set of simultaneous equations
may be economically obtained.
It turns out that the cost is only about twice
that of the **explicit method** given by (27).
In fact, this **implicit method** turns out to
be cheaper, since the increased accuracy
of (32) over (27)
allows the use of a much larger numerical choice of .A program that demonstrates the stability of the method,
even for large , is given next.

A **tridiagonal** simultaneous equation
solving subroutine `rtris()` explained in the next section.
The results are stable, as you can see.

** Next:** Solving tridiagonal simultaneous equations
** Up:** FINITE DIFFERENCING IN (omega,x)-SPACE
** Previous:** The leapfrog method
Stanford Exploration Project

12/26/2000