Mathematical Methods for Physics and Engineering : A Comprehensive Guide

(lu) #1

NUMERICAL METHODS


appreciate how this would apply in (say) a computer program for a 1000-variable


case, perhaps with unforseeable zeros or very small numbers appearing on the


leading diagonal.


Solve the simultaneous equations
(a) x 1 +6x 2 − 4 x 3 =8,
(b) 3 x 1 − 20 x 2 +x 3 =12,
(c) −x 1 +3x 2 +5x 3 =3.

(27.22)


Firstly, we interchange rows (a) and (b) to bring the term 3x 1 onto the leading diagonal. In
the following, we label the important equations (I), (II), (III), and the others alphabetically.
A general (i.e. variable) label will be denoted byj.


(I) 3 x 1 − 20 x 2 +x 3 =12,
(d) x 1 +6x 2 − 4 x 3 =8,
(e) −x 1 +3x 2 +5x 3 =3.

For (j) = (d) and (e), replace row (j)by


row (j)−

aj 1
3

×row (I),

whereaj 1 is the coefficient ofx 1 in row (j), to give the two equations


(II)

(


6+^203


)


x 2 +

(


− 4 −^13


)


x 3 =8−^123 ,

(f)

(


3 −^203


)


x 2 +

(


5+^13


)


x 3 =3+^123.

Now|6+^203 |>| 3 −^203 |and so no interchange is required before the next elimination. To
eliminatex 2 ,replacerow(f)by


row (f)−

(


−^113


)


38
3

×row (II).

This gives


(III)

[ 16


3 +


11
38 ×

(−13)
3

]


x 3 =7+^1138 × 4.

Collecting together and tidying up the final equations, we have


(I) 3x 1 − 20 x 2 +x 3 =12,
(II) 38 x 2 − 13 x 3 =12,
(III) x 3 =2.

Starting with (III) and working backwards, it is now a simple matter to obtain


x 1 =10,x 2 =1,x 3 =2.

27.3.2 Gauss–Seidel iteration

In the example considered in the previous subsection an explicit way of solving


a set of simultaneous equations was given, the accuracy obtainable being limited


only by the rounding errors in the calculating facilities available, and the calcula-


tion was planned to minimise these. However, in some situations it may be that


only an approximate solution is needed. If, for a large number of variables, this is

Free download pdf