Jacobi method


In numerical linear algebra, the Jacobi method is an iterative algorithm for determining the solutions of a strictly diagonally dominant system of linear equations. Each diagonal element is solved for, and an approximate value is plugged in. The process is then iterated until it converges. This algorithm is a stripped-down version of the Jacobi transformation method of matrix diagonalization. The method is named after Carl Gustav Jacob Jacobi.

Description

Let
be a square system of n linear equations, where:
Then A can be decomposed into a diagonal component D, a lower triangular part L and an upper triangular part U:
The solution is then obtained iteratively via
where is the kth approximation or iteration of and is the next or k + 1 iteration of. The element-based formula is thus:
The computation of requires each element in x except itself. Unlike the Gauss–Seidel method, we can't overwrite with, as that value will be needed by the rest of the computation. The minimum amount of storage is two vectors of size n.

Algorithm

Input:, matrix, right-hand side vector, convergence criterion
Output:
Comments:
while convergence not reached do
for i := 1 step until n do

for j := 1 step until n do
if j ≠ i then

end
end

end

end

Convergence

The standard convergence condition is when the spectral radius of the iteration matrix is less than 1:
A sufficient condition for the method to converge is that the matrix A is strictly or irreducibly diagonally dominant. Strict row diagonal dominance means that for each row, the absolute value of the diagonal term is greater than the sum of absolute values of other terms:
The Jacobi method sometimes converges even if these conditions are not satisfied.
Note that the Jacobi method does not converge for every symmetric positive-definite matrix.
For example

Example

A linear system of the form with initial estimate is given by
We use the equation, described above, to estimate. First, we rewrite the equation in a more convenient form, where and. From the known values
we determine as
Further, is found as
With and calculated, we estimate as :
The next iteration yields
This process is repeated until convergence. The solution after 25 iterations is

Another example

Suppose we are given the following linear system:
If we choose as the initial approximation, then the first approximate solution is given by
Using the approximations obtained, the iterative procedure is repeated until the desired accuracy has been reached. The following are the approximated solutions after five iterations.
0.62.27272-1.11.875
1.047271.7159-0.805220.88522
0.932632.05330-1.04931.13088
1.015191.95369-0.96810.97384
0.988992.0114-1.01021.02135

The exact solution of the system is.

An example using Python and Numpy

The following numerical procedure simply iterates to produce the solution vector.

def jacobi:
D = np.diag
LU = A - D
x = x_init
for i in range:
D_inv = np.diag
x_new = np.dot
if np.linalg.norm < epsilon:
return x_new
x = x_new
return x
  1. problem data
A = np.array
b = np.array
  1. you can choose any starting vector
x_init = np.zeros
x = jacobi
print
print
print

Produces the output:

x:
computed b:
real b:

Weighted Jacobi method

The weighted Jacobi iteration uses a parameter to compute the iteration as
with being the usual choice.

Convergence in the symmetric positive definite case

In case that the system matrix is of symmetric positive-definite type one can show convergence.
Let be the iteration matrix.
Then, convergence is guaranteed for
where is the maximal eigenvalue.
The spectral radius can be minimized for a particular choice of as follows
where is the matrix condition number.