In: Math
The Jacobi iterative method works fine with well-conditioned linear systems. If the linear system is ill-conditioned, it is most probably that the Jacobi method will fail to converge.
The Jacobi method can generally be used for solving linear systems in which the coefficient matrix is diagonally dominant.
your matrix A is strictlydiagonally dominant. In other words, for each row i in your matrix, the absolute summation of all of the columns j at row i without the diagonal coefficient at i must be less than the diagonal itself. In other words:
However, there are some systems that will converge with Jacobi, even if this condition isn't satisfied, but you should use this as a general rule before trying to use Jacobi for your system. It's actually more stable if you use Gauss-Seidel. The only difference is that you are re-using the solution of xand feeding it into the other variables as you progress down the rows. To make this Gauss-Seidel, all you have to do is change one character within your for loop.