418 Chapter 7 Numerical Methods
Iterative Methods
Systems of up to 10 equations, such as those in the foregoing examples, can
readily be solved by elimination. It is easy to see, however, that we might well
want a finer mesh to get better accuracy and that a finer mesh will increase the
number of equations dramatically. For example, if we use x= y= 1 / 10
in a numerical solution of Eqs. (3)–(5), the system to be solved contains 81
unknowns (or 25 if we use symmetry). Problems involving many thousands of
unknowns are quite common. These large systems of simultaneous equations
are almost always solved byiterative methods, which generate a sequence of
approximate solutions.
Consider again the potential problem in Eqs. (3)–(6). Let us take a mesh
with x= y= 1 /Nand number the points of the mesh with a double index
so that
u(xi,yj)∼=ui,j. (20)
Then the replacement equations for the potential equation are
ui+ 1 ,j− 2 ui,j+ui− 1 ,j
( x)^2
+ui,j+^1 −^2 ui,j+ui,j−^1
( y)^2
= 0 ,
or, using x= yand some algebra,
ui,j=^14 (ui+ 1 ,j+ui− 1 ,j+ui,j+ 1 +ui,j− 1 ), (21)
valid foriandjranging from 1 toN−1. (This is the same as Eq. (7).) The
boundary conditions, Eqs. (4) and (5), determine
u 0 ,j= 0 , uN,j= 0 , j= 0 ,...,N, (22)
ui, 0 =f(xi), ui,N=f(xi), i= 0 ,...,N. (23)
The simplest iterative method, called the Gauss–Seidel method, works this
way. We sweep through the array ofu’s, replacing eachui,jby the combination
ofu’s given on the right-hand side of Eq. (21). After several sweeps through
the array, the numbers no longer change much. When the new and old values
ofui,jat each point agree closely enough, we stop.
The result is a set of numbers that satisfy Eq. (21) approximately. Since the
exact solution of the replacement equations is still just an approximation to
the solution of the original problem in Eqs. (3)–(6), it is not urgent to get that
exact solution of the replacement equations.
An iterative method such as the Gauss–Seidel method is very easy to imple-
ment on a spreadsheet without programming. (See the CD.)