Jacobi method
From CFD-Wiki
(Difference between revisions)
Line 26: | Line 26: | ||
: end (k-loop) | : 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 '''X''' are used. <br> |
Revision as of 05:15, 15 September 2005
We seek the solution to set of linear equations:
For the given matrix A and vectors X and Q.
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 X are used.