Special Matrices and Gauss-Seidel GaussWe will cover 11.1 Special matrices 11.2 GAUSS-SEIDEL
a c 0 0 0 0 0
b d f 0 0 0 0 0 0
0 e g i 0 0 0 0 0
0 0 h j l 0 0 0 0
0 0 0 k k 0 0 0
0 0 0 0 z q 0 0
0 0 0 0 0 p r t 0
0 0 0 0 0 0 s u
0 0 0 0 0 0 0 v
m n
0 0
w x
Forward elimination
ek f k ! fk f g k1 k 1 k ! 2 , 3, - , n ! r ek r rk k k 1 fk 1
Use factor = ek / fk1
to eliminate subdiagonal element Apply the same matrix operations to right hand side
Back substitution
xn ! rn fn k ! n 1, n 2, - , 3, 2 , 1
rk g k x k 1 xk ! fk
x4 ! x3 !
r4 4 ! !4 f4 1 r3 g 3 x 4 1 ( 0.5 )( 4 ) ! !3 f3 1
r2 g 2 x 3 1 ( 1)( 3 ) ! !2 x2 ! f2 1 x1 ! r1 g 1 x 2 3 ( 2 )( 2 ) ! !1 f1 1
Example 11.1
2.04 1 0 0
1
>> A=[2.04 -1 0 0; -1 2.04 -1 0; 0 -1 2.04 -1; 0 0 -1 2.04] A= 2.0400 -1.0000 0 0 -1.0000 2.0400 -1.0000 0 0 -1.0000 2.0400 -1.0000 0 0 -1.0000 2.0400 >> rhs=[40.8 0.8 0.8 200.8] rhs = 40.8000 0.8000 0.8000 200.8000 >> x = tri_diag(A,rhs) x= 65.9698 93.7785 124.5382 159.4795
11.2 GAUSS-SEIDEL GAUSS Iterative or approximate methods provide an alternative to the elimination methods. The Gauss-Seidel method is the most commonly used iterative method. The system [A]{X}={B} is reshaped by solving the first equation for x1, the second equation for x2, and the third for x3, and nth equation for xn. For conciseness, we will limit ourselves to a 3x3 set of equations.
Now we can start the solution process by choosing guesses for the x s. A simple way to obtain initial guesses is to assume that they are zero. These zeros can be substituted into x1equation to calculate a new x1=b1/a11.
New x1 is substituted to calculate x2 and x3. The procedure is repeated until the convergence criterion is satisfied:
I a ,i
For all i, where j and j-1 are the present and previous iterations.
Fig. 11.4
Example 11.3