CH 11
CH 11
2
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Jacobi Iterative Method
n
1
xi ( k 1)
aii j 1
( aij x j ) bi
(k )
i 1,2 n
j i
4
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
4. Terminate the procedure when
a s
or max. number of iterations is reached.
How to define εa
We have vectors so we’ll use norms to to define εa
X ( k 1) X ( k )
a
X ( k 1)
x
max xi
1i n
p norm
1/ p
n p
x p xi
i 1
n
p=1 x 1 xi
i 1
1/ 2
2
n
p=2 x 2 xi Euclidean norm
i 1 6
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The distance between two vectors is defined as the norm of the
difference of the vectors.
y y1 y2 yn T
x y
max xi yi
1i n
1/ 2
n
2
x y 2 ( xi yi )
i 1
7
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 11.1
Solve the linear system with Jacobi iterative method
4 x1 x2 x3 7
4 x1 8 x2 x3 21 x ( 0)
1 2 2 T
2 x1 x2 5 x3 15
iter. no x1 x2 x3
0 1 2 2
1 1.75 3.375 3
2 1.8438 3.875 3.025
3 1.9625 3.925 2.963
4 1.9906 3.9766 3
8
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Gauss-Seidel Method
The Gauss-Seidel method is a commonly used iterative
method. It is same as Jacobi technique except that it uses the
latest values of x’s.
1 i 1 n
ij j )
( k 1) ( k 1)
xi ( a x (aij x (jk ) ) bi i 1,2n
aii j 1 j i 1
9
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 11.2
iter.no x1 x2 x3 εa
0 1 2 2
2 x1 x2 7 x3 3
Iterate until εa ≤ 0.02 . Use maximum magnitude norm to
calculate εa . Ensure convergence before starting to iterate.
iter.no x1 x2 x3 εa
0 0 0 0
1 -0.2000 0.1556 -0.5079
2 0.1670 0.3343 -0.4286 0.8562
3 0.1909 0.3335 -0.4217 0.0567
4 0.1864 0.3312 -0.4226 0.0107
12
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Improvement of Convergence Using Relaxation
15
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Solution of Nonlinear Systems of Equations
f1 ( x1 , x2 , x3 , , xn ) 0 x1 g1 ( x1 , x2 , x3 , , xn )
f 2 ( x1 , x2 , x3 , , xn ) 0 x2 g 2 ( x1 , x2 , x3 , , xn )
f n ( x1 , x2 , x3 , , xn ) 0 xn g n ( x1 , x2 , x3 , , xn )
16
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Fixed Point Iteration:
iter. no x1 x2
0 0 0
1 0.2500
2 0.4955 0.2522
3 0.5000 0.2500
19
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 11.6:
Use fixed-point iteration method to determine the roots of
x1 10 x1 x22 8 0
2
x1 x22 x1 10 x2 8 0
with D{ (x1 , x2) \ 0≤ x1, x2≤ 1.5}. Compute 3 iterations with
Gauss-Seidel Scheme and calculate εa in each iteration by
using maximum magnitude norm.
iter. no. x1 x2 εa
0 0 0
1 0.8 0.88
2 0.9414 0.967 0.1462
3 0.9821 0.99 0.0411
20
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Newton-Raphson method
f1 ( x1 , x2 , x3 , , xn ) 0
f 2 ( x1 , x2 , x3 , , xn ) 0
f n ( x1 , x2 , x3 , , xn ) 0
( k 1) (k ) f ( x(k ) )
Newton Raphson equation: x x
f ( x ( k ) )
(k ) (k )
f1 f1 f1 ( k 1) f1 f1 f1 (k ) (k )
x x1 x1 f1 ( x1 , x2 , x3 , , xn )
x2 xn
x x2 xn
1 1
f 2 f 2 f 2 f 2 f 2 f 2
x2 x2 f 2 ( x1 , x2 , x3 , , xn )
x1 x2 xn x1 x2 xn
f f n f n f f n f n
n xn n xn f n ( x1 , x2 , x3 ,, xn )
x1 x2 xn x1 x2 xn
22
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Solve this set of linear equations at each iteration:
(k ) ( k 1) (k ) (k ) (k )
J X J X F
J ( k ) { X ( k 1) X ( k ) } F ( k )
Rearrange:
J ( k ) X ( k ) F ( k )
(k )
f1 f1 f1
x1
(k )
f1 ( x1 , x2 , x3 ,, xn )
(k )
x
x2 xn
1
f 2 f 2
f 2
x2 f ( x , x , x ,, xn )
x1 x2 xn 2 1 2 3
f n f n f n
xn f n ( x1 , x2 , x3 ,, xn )
x1 x2 xn
(k 1) (k ) (k )
X X X 23
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 11.7:
Use Newton-Raphson method to determine the roots of
iter.no x1 x2
0 1 1
1 1.2200 1.2200
2 1.2002 1.2002
24
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Solution: f1 f1
x x2 4 x1 2 x2
f1 ( x1, x2 ) 2 x12 x22 4.32 0 J 1
f 2 f 2 2 x1 2 x2
f 2 ( x1, x2 ) x12 x22 0 x1 x2
1st iteration
x1(0) x2(0) 1
4 x1( 0) 2 x2( 0) x1( 0) f1 ( x1( 0) , x2( 0) )
(0) ( 0) ( 0)
(0)
2 x1 2 x2 x2 (0)
f 2 ( x1 , x2 )
4 2 x1(0) 1.32
2 2 ( 0 ) 0 , x1
( 0)
0.22, x2 0.22
(0)
x2
x1(1) x1( 0) x1(0) 1.22
x2(1) x2( 0) x2(0) 1.22
25
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
2nd iteration
x1(1) x2(1) 1.22
4 x1(1) 2 x2(1) x1(1) f1 ( x1(1) , x2(1) )
(1) (1) (1)
(1)
2 x1 2 x2 x2 (1)
f 2 ( x1 , x2 )
x2
(1)
x1( 2) x1(1) x1(1) 1.2002
x2( 2) x2(1) x2(1) 1.2002
26
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 11.8:
Use Newton-Raphson method to determine the roots of
x1 x1 x2 10
2
x2 3x1 x22 57
with initial guesses of x1(0) =1.5, x2(0) =3.5.
Iterate until εa ≤ 0.001 . Use maximum magnitude norm to
calculate εa .
iter. no. x1 x2 εa
0 1.5 3.5
1 2.036 2.8439
2 1.9987 3.0023 0.0528
3 2.0000 2.999999≈3 0.0008
27
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.