Samiksha Jaiswal (Editor)

Jacobi method

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

In numerical linear algebra, the Jacobi method (or Jacobi iterative method) is an algorithm for determining the solutions of a 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.

Contents

Description

Let

A x = b

be a square system of n linear equations, where:

A = [ a 11 a 12 a 1 n a 21 a 22 a 2 n a n 1 a n 2 a n n ] , x = [ x 1 x 2 x n ] , b = [ b 1 b 2 b n ] .

Then A can be decomposed into a diagonal component D, and the remainder R:

A = D + R where D = [ a 11 0 0 0 a 22 0 0 0 a n n ]  and  R = [ 0 a 12 a 1 n a 21 0 a 2 n a n 1 a n 2 0 ] .

The solution is then obtained iteratively via

x ( k + 1 ) = D 1 ( b R x ( k ) ) ,

where x ( k ) is the kth approximation or iteration of x and x ( k + 1 ) is the next or k + 1 iteration of x . The element-based formula is thus:

x i ( k + 1 ) = 1 a i i ( b i j i a i j x j ( k ) ) , i = 1 , 2 , , n .

The computation of xi(k+1) requires each element in x(k) except itself. Unlike the Gauss–Seidel method, we can't overwrite xi(k) with xi(k+1), 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: initial guess x ( 0 ) to the solution, (diagonal dominant) matrix A , right-hand side vector b , convergence criterion Output: solution when convergence is reached Comments: pseudocode based on the element-based formula above k = 0 while convergence not reached do for i := 1 step until n do σ = 0 for j := 1 step until n do if j ≠ i then σ = σ + a i j x j ( k ) end end x i ( k + 1 ) = 1 a i i ( b i σ ) end k = k + 1 end

Convergence

The standard convergence condition (for any iterative method) is when the spectral radius of the iteration matrix is less than 1:

ρ ( D 1 R ) < 1.

A sufficient (but not necessary) 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:

| a i i | > j i | a i j | .

The Jacobi method sometimes converges even if these conditions are not satisfied.

Example

A linear system of the form A x = b with initial estimate x ( 0 ) is given by

A = [ 2 1 5 7 ] ,   b = [ 11 13 ] and x ( 0 ) = [ 1 1 ] .

We use the equation x ( k + 1 ) = D 1 ( b R x ( k ) ) , described above, to estimate x . First, we rewrite the equation in a more convenient form D 1 ( b R x ( k ) ) = T x ( k ) + C , where T = D 1 R and C = D 1 b . Note that R = L + U where L and U are the strictly lower and upper parts of A . From the known values

D 1 = [ 1 / 2 0 0 1 / 7 ] ,   L = [ 0 0 5 0 ] and U = [ 0 1 0 0 ] .

we determine T = D 1 ( L + U ) as

T = [ 1 / 2 0 0 1 / 7 ] { [ 0 0 5 0 ] + [ 0 1 0 0 ] } = [ 0 1 / 2 5 / 7 0 ] .

Further, C is found as

C = [ 1 / 2 0 0 1 / 7 ] [ 11 13 ] = [ 11 / 2 13 / 7 ] .

With T and C calculated, we estimate x as x ( 1 ) = T x ( 0 ) + C :

x ( 1 ) = [ 0 1 / 2 5 / 7 0 ] [ 1 1 ] + [ 11 / 2 13 / 7 ] = [ 5.0 8 / 7 ] [ 5 1.143 ] .

The next iteration yields

x ( 2 ) = [ 0 1 / 2 5 / 7 0 ] [ 5.0 8 / 7 ] + [ 11 / 2 13 / 7 ] = [ 69 / 14 12 / 7 ] [ 4.929 1.714 ] .

This process is repeated until convergence (i.e., until A x ( n ) b is small). The solution after 25 iterations is

x = [ 7.111 3.222 ] .

Another example

Suppose we are given the following linear system:

10 x 1 x 2 + 2 x 3 = 6 , x 1 + 11 x 2 x 3 + 3 x 4 = 25 , 2 x 1 x 2 + 10 x 3 x 4 = 11 , 3 x 2 x 3 + 8 x 4 = 15.

If we choose (0, 0, 0, 0) as the initial approximation, then the first approximate solution is given by

x 1 = ( 6 0 0 ) / 10 = 0.6 , x 2 = ( 25 0 0 ) / 11 = 25 / 11 = 2.2727 , x 3 = ( 11 0 0 ) / 10 = 1.1 , x 4 = ( 15 0 0 ) / 8 = 1.875.

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.

The exact solution of the system is (1, 2, −1, 1).

An example using Python and Numpy

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

Produces the output:

Weighted Jacobi method

The weighted Jacobi iteration uses a parameter ω to compute the iteration as

x ( k + 1 ) = ω D 1 ( b R x ( k ) ) + ( 1 ω ) x ( k )

with ω = 2 / 3 being the usual choice.

Recent developments

In 2014, a refinement of the algorithm, called scheduled relaxation Jacobi (SRJ) method, was published. The new method employs a schedule of over- and under-relaxations and provides performance improvements for solving elliptic equations discretized on large two- and three-dimensional Cartesian grids. The described algorithm applies the well-known technique of polynomial (Chebyshev) acceleration to a problem with a known spectrum distribution that can be classified either as a multi-step method or a one-step method with a non-diagonal preconditioner. However, none of them are Jacobi-like methods.

Improvements published in 2015.

References

Jacobi method Wikipedia