# Gauss-Seidel method

(Difference between revisions)
 Revision as of 05:07, 15 September 2005 (view source)Zxaar (Talk | contribs)← Older edit Revision as of 06:23, 3 October 2005 (view source)Zxaar (Talk | contribs) Newer edit → Line 6: Line 6: In matrix terms, the definition of the Gauss-Seidel method can be expressed as :
In matrix terms, the definition of the Gauss-Seidel method can be expressed as :
$[itex] - x^{(k)} = \left( {D - L} \right)^{ - 1} \left( {Ux^{(k - 1)} + Q} \right) + x^{(k)} = \left( {D - L} \right)^{ - 1} \left( {Ux^{(k - 1)} + q} \right)$
[/itex]
Where '''D''','''L''' and '''U''' represent the diagonal, lower triangular and upper triangular matrices of coefficient matrix '''A''' and k is iteration counter.
Where '''D''','''L''' and '''U''' represent the diagonal, lower triangular and upper triangular matrices of coefficient matrix '''A''' and k is iteration counter.
Line 29: Line 29: :    end (k-loop) :    end (k-loop) ---- ---- + + + ---- + Return to [[Numerical methods | Numerical Methods]]

## Revision as of 06:23, 3 October 2005

We seek the solution to set of linear equations:

$A \bullet X = Q$

For the given matrix A and vectors X and Q.
In matrix terms, the definition of the Gauss-Seidel method can be expressed as :
$x^{(k)} = \left( {D - L} \right)^{ - 1} \left( {Ux^{(k - 1)} + q} \right)$
Where D,L and U represent the diagonal, lower triangular and upper triangular matrices of coefficient matrix A and k is iteration counter.

The pseudocode for the Gauss-Seidel algorithm:

### Algorithm

Chose an intital guess $X^{0}$ to the solution
for k := 1 step 1 untill convergence do
for i := 1 step until n do
$\sigma = 0$
for j := 1 step until i-1 do
$\sigma = \sigma + a_{ij} x_j^{(k)}$
end (j-loop)
for j := i+1 step until n do
$\sigma = \sigma + a_{ij} x_j^{(k-1)}$
end (j-loop)
$x_i^{(k)} = {{\left( {q_i - \sigma } \right)} \over {a_{ii} }}$
end (i-loop)
check if convergence is reached
end (k-loop)