Jacobi method
From CFD-Wiki
(Difference between revisions)
(fixed dot product notation) |
(towards a uniform notation for linear systems : A*Phi = B) |
||
Line 1: | Line 1: | ||
We seek the solution to set of linear equations: <br> | We seek the solution to set of linear equations: <br> | ||
- | :<math> A \cdot | + | :<math> A \cdot \Phi = B </math> <br> |
- | |||
In matrix terms, the definition of the Jacobi method can be expressed as : <br> | In matrix terms, the definition of the Jacobi method can be expressed as : <br> | ||
<math> | <math> | ||
- | + | \phi^{(k)} = D^{ - 1} \left( {L + U} \right)\phi^{(k - 1)} + D^{ - 1} B | |
</math><br> | </math><br> | ||
Where '''D''','''L''' and '''U''' represent the diagonal, lower triangular and upper triangular matrices of coefficient matrix '''A''' and k is iteration counter.<br> | Where '''D''','''L''' and '''U''' represent the diagonal, lower triangular and upper triangular matrices of coefficient matrix '''A''' and k is iteration counter.<br> | ||
Line 18: | Line 17: | ||
::: for j := 1 step until n do <br> | ::: for j := 1 step until n do <br> | ||
:::: if j != i then | :::: if j != i then | ||
- | ::::: <math> \sigma = \sigma + a_{ij} | + | ::::: <math> \sigma = \sigma + a_{ij} \phi_j^{(k-1)} </math> |
:::: end if | :::: end if | ||
::: end (j-loop) <br> | ::: end (j-loop) <br> | ||
- | ::: <math> | + | ::: <math> \phi_i^{(k)} = {{\left( {b_i - \sigma } \right)} \over {a_{ii} }} </math> |
:: end (i-loop) | :: end (i-loop) | ||
:: check if convergence is reached | :: check if convergence is reached | ||
Line 27: | Line 26: | ||
---- | ---- | ||
- | '''Note''': The major difference between the Gauss-Seidel method and Jacobi method lies in the fact that for Jacobi method the values of solution of previous iteration (here k) are used, where as in Gauss-Seidel method the latest available values of solution vector | + | '''Note''': The major difference between the Gauss-Seidel method and Jacobi method lies in the fact that for Jacobi method the values of solution of previous iteration (here k) are used, where as in Gauss-Seidel method the latest available values of solution vector <math>\Phi</math> are used. <br> |
---- | ---- | ||
<i> Return to [[Numerical methods | Numerical Methods]] </i> | <i> Return to [[Numerical methods | Numerical Methods]] </i> |
Revision as of 20:47, 15 December 2005
We seek the solution to set of linear equations:
In matrix terms, the definition of the Jacobi method can be expressed as :
Where D,L and U represent the diagonal, lower triangular and upper triangular matrices of coefficient matrix A and k is iteration counter.
Algorithm
- Chose an intital guess to the solution
- for k := 1 step 1 untill convergence do
- for i := 1 step until n do
-
- for j := 1 step until n do
- if j != i then
- end if
- if j != i then
- end (j-loop)
-
- end (i-loop)
- check if convergence is reached
- for i := 1 step until n do
- end (k-loop)
Note: The major difference between the Gauss-Seidel method and Jacobi method lies in the fact that for Jacobi method the values of solution of previous iteration (here k) are used, where as in Gauss-Seidel method the latest available values of solution vector are used.
Return to Numerical Methods