Lec 12 Jacobi Method
Lec 12 Jacobi Method
Lec 12 Jacobi Method
1 i 1 n
x1
1 1
(b1 a12 x2 a1n xn )
0 0 k 1
xi bi
aii
aij x aij x
k
j
k
j
a11 j 1 j i 1
1
x2
1
(b2 a21 x10 a23 x30 a2 n xn0 )
a22
1
x1n (bn an1 x10 an 2 x20 ann1 xn01 )
ann
xk+1=Exk+f iteration for Jacobi method
1 i 1 n xk+1=-D-1(L+U)xk+D-1b
bi aij x j aij x j
k 1
xi k k
aii j 1 j i 1 E=-D-1(L+U)
Dxk+1 Lx k Uxk f=D-1b
Jacobi Method with examples
Consider the two-by-two system x
1
y3
2x y 6 2
x 2y 6 1
Start with x (1) y (1) 1/ 2 y x3
2
Simultaneous updating
New values of the variables are
not used until a new iteration
step is begun
y ( 2)
1 (1) 1 11
x ( 2) y 3 3
2 4 4
y (1)
1 (1) 1 11
y ( 2) x 3 3
2 4 4 x (1) x ( 2)
Jacobi Method
Cont
1 ( 2) 11 13
x ( 3)
y 3 3
2 8 8
1 11 13
y (3) x ( 2) 3 3
2 8 8
Jacobi Method
Consider the three-by-three system
2 x1 x2 x3 1
x1 2 x2 x3 6
x1 x2 2 x3 3
x1 0.5 x2 0.5 x3 0.5
x2 0.5 x1 0.5 x3 3.0
x3 0.5 x1 0.5 x2 1.5
y ( 2)
A necessary and sufficient
condition for the
convergence of the Jacobi y (1)
method x (1) x ( 2) x
The magnitude of the largest
eigenvalue of the iteration
matrix C be less than 1
Jacobi method : Example 1
Consider a circuit shown in figure here; currents i1, i2, and i3 are given by
4X2 + 5X3 = 5
1 0.25 0 0
4 0 0
0 10 0 0 0.1 0
0 0 5 0 0 0.2
1
X3
Functional Value
0.8
The actual Solution:
0.6
0.4
X1
(X1 , X2 , X3 ) =
X2
0.2
(0.41379, 0.17241, 0.86206)
0
0 2 4 6 8 10
Number of Iterations
Iteration 1 2 3 4 5 6 7
0, x2 0, x3 0 and x4 0.
( 0) ( 0) ( 0) ( 0)
x1
1 1 3
(1)
x1 (0) (0)
0.6000,
10 5 5 (1)
1 1 3 25 x1
(1)
x2 (0) (0) (0)
2.2727,
11 11 11 11 (1)
1 1 1 11 x2
(0)
(1)
x3 (0) (0)
5 10 10 10
1.1000
(1)
3 1 15 x3
(0)
(1)
x4 (0)
8 8 8
1.8750
(1)
x4
Jacobi method : Example 3
1 (1) 1 (1) 3
(2)
x1 x2 x3
10 5 5
1 (1) 1 (1) 3 (1) 25
x3
( 2)
x2 x1 x4
11 11 11 11
1 (1) 1 (1) 1 (1) 11
x1
( 2)
x3 x2 x4
5 10 10 10
3 (1) 1 (1) 15
x2
( 2)
x4 x3
8 8 8
1 ( k 1) 1 ( k 1) 3
x1 x3
(k)
x2
10 5 5
1 ( k 1) 1 ( k 1) 3 ( k 1) 25
x3
(k )
x2 x1 x4
11 11 11 11
1 ( k 1) 1 ( k 1) 1 ( k 1) 11
x1 x4
(k )
x3 x2
5 10 10 10
3 ( k 1) 1 ( k 1) 15
x2 x3
(k )
x4
8 8 8
Jacobi method : Example 3
Results:
iteration 0 1 2 3
15 x20 5 x30 15
x
1
1
7.5
2 2 b Ax1 54.8546
21 4 x10 x30 21 2
x2
1
2.625
8 8
x31 7 4 x10 x20 7.0
Jacobi method : Example 4
15 2.625 5 7
x
1
1 11.3125
2
21 4 7.5 7
x12 0.25
8 b Ax2 208.3761
2
x31 7 4 7.5 2.625 39.625
4) do { 1 jN
a) compute: xi bi Qij x j
Aii j 1
max xi xi
i 1,.., N
b) compute error: err
max bi
i 1,.., N
xi xi
c) update x:
}while err>tol
Matlab
program
Running the program
I ran the script with the
stopping tolerance (tol) set to
1e-8:
Definition: N
Theorem:
If the matrix A is diagonally dominant then Ax=b has a unique
solution x and the Jacobi iteration produces a sequence which
converges to x for any initial guess
Informally:
The more diagonally dominant a matrix is the faster it will
converge this holds some of the time.