Академический Документы
Профессиональный Документы
Культура Документы
Pn
i=1
E.g. 2 Finite difference method : Consider u(x) = f (x) where 0 < x < 1 and u(0) = a0 , u(1) = a1 .
In calculus, we know
g(x + h)
+g(x h)
g(x + h) + g(x h)
f (x)
h2
g(x)
2
h2
g(x) hg 0 (x) + g(x)
2
2g(x) + h2 g(x)
g(x) + hg 0 (x) +
1
Now, partition [0, 1] into xi = ih; h = n+1
.
Then, the differential equation can be approximated by
u1
f (x1 ) u0
u2
f (x2 )
system of
A . =
.
.
.
linear
system
.
.
f (xn ) u1
un
where
2
1
1
A= 2
h
1
2
..
.
1
..
.
1
..
2 1
1 2
a11 a12 a1n
x1
b1
a21 a22 a2n x2 b2
..
.. .. = ..
.
.
.
.
.
.
.
. . .
an1 an2 ann
xn
bn
0
c11 c12 c1n
x1
b1
0
a
x
22
2n
2
b2
.. .. = ..
..
.
. . .
cnn
xn
b0n
Computational cost : O(n3 ) [Check it if interested]
From linear algebra, we also learnt LU factorization.
Decompose a matrix A into A = LU.
Then solve the equation by:
A~x = ~b L(u~x) = ~b
1
by elementary
row operation
Let ~y = u(~x). Solve for L~y = ~b first (backward substitution). Then solve for u~x = ~y (easy).
For A =symmetric positive definite (~xT A~x > 0 for all ~x), then A = LLT . Decomposition can be done by Cholesky
decomposition : (Numerical analysis).
Computational cost : O(n3 )
Goal :
Develop iterative method : Find a sequence ~x0 , ~x1 , ~x2 , ... such that ~xR ~x = solution as k (Stop when the
error is small enough).
Splitting method for general linear systems
Consider the system A~x = f~; A Mnn (R) (n is big )
We can split A as follows:
A = M + (A M ) = M (M A) = N P
Solving A~x = f~ is equivalent to solving:
(N P )~x = f N~x = P ~x + f~
We can develop an iterative scheme as follows
N~xn+1 = P ~xn + f~
D~x
~xk+1
= f~
(D A)~xk + f~
= D1 (D A)~xk + D1 f~
a11 xk+1
+ a12 xk2 + + a1n xkn = f1
k
a21 x1 + a22 xk+1
+ + a2n xkn = f2
2
..
k
k
an1 x1 + an2 x2 + + ann xk+1
= fn
n
for xk+1
1
for xk+1
2
..
.
for xk+1
n
Example : Consider
5
3
2
2
9
1
3
x1
1
1 x2 = 2
7
x3
3
Then:
1
0
0
0 3
7
2
2 3
5 0 0
0 1 ~xk + 0 9 0
~xk+1
1 0
0 0 7
0
0.186
Start with ~x0 = 0 . The sequence converges in 7 iteration to ~x7 = 0.331
0
0.423
5
= 0
0
0
9
0
1
2
3
a11 xk+1
+ a12 xk2 + + a1n xkn = f1
1
a21 xk+1
+ a22 xk+1
+ + a2n xkn = f2
1
2
..
.
k+1
k+1
an1 x1 + an2 x2 + + ann xk+1
= fn
n
for xk+1
1
for xk+1
2
..
.
for xk+1
n
Gauss-Seidel is equivalent to
~xk+1 = (L + D)1 U~xk + (D + L)1 f~
Exampl : Continue with last example
~xk+1
5
= 3
2
0
9
1
0
0
0 0
7
0
3
5
1 ~xk + 3
0
2
2
0
0
0
9
1
0
1
0 2
7
3
0.186
0
Start with ~x0 = 0 . The sequence converges in 7 iteration to : ~x7 = 0.331 .
0.423
0
Start with ~x =
0
0
1 0
0 1
. Then ~x =
1
4
6
0
7
2
5
0
34
34
, ~x =
~xk +
1
0
0
1
1
4
6
174
214374
3
7
, ~x =
, ...~x =
which
294
300127
doesnt converges.
x1
1
=
!
x2
1
How about Gauss Seidel ?? It also doesnt converges !
The real solution should be :
Our next goal is to check when Jacobi method and Gauss-Seidel method would converge.
Answer : Matrix A must satisfy certain property : Strictly diagonal dominant (SDD).
Analysis of Covergence
Let A = N P .
m = 0, 1, 2, ...
i=1
(
~e
m
1
a1 ~u1 +
n
X
ai
i=2
i
1
m
u~i
= ~e
aij ej
= ei
aij ej
= ei
j=1
N
X
aii ei +
j=1,j6=i
ei (aii )
N
X
aij ej
j=1,j6=i
|ei | |aii |
N
X
|aij | |ej |
j=1,j6=i
|el | |all |
N
X
j=1,j6=l
|all |
N
X
N
X
|alj | |ej |
|alj | |el |
j=1,j6=l
|alj |
j=1,j6=l
So we have
Ball
N
X
|alj |
j=1,j6=l
PN
That is the ball with centre all and with radii j=1,j6=i |alj |.
Note : We dont know l unless we know and ~e.
But : we can conclude
N
[
l=1
X
|alj |
Ball
j=1
j6=l
Example : Determine the upper bounds on the eigenvalues for the matrix:
2 1 0
0
1 2 1 0
A=
0 1 2 1
0
0 1 2
SN
PN
Then all eigenvalues lie within l=1 Ball
j=1,j6=l |alj | .
P
N
For l = 1 and 4, Ball
|alj | = { : | 2| 1}.
Pj=1,j6=l
N
For l = 2 and 3, Ball
|a
|
= { : | 2| 2} .
lj
j=1,j6=l
Therefore
N
N
[
X
Ball
|alj | = circle with radius 2 and centre at (2,0)
l=1
j=1,j6=l
That is (A) = 1 4.
To prove the convergence of Jacobi method and the Gauss-Seidel method, let us introduce some definition.
Definition: A matrix M = (aij ) is called strictly diagonally dominant (SDD) if:
n
X
|aii | >
|aij | ,
i = 1, 2, ..., n
j=1,j6=i
P
aij ~xm
, i = 1, 2, ..., n (1)
j +
i
aii
aii
j=1,j6=i
1
aii
n
X
aij ~xj +
j=1,j6=i
fi
aii
(2)
(1)-(2):
~em+1
=
i
1
aii
n
X
aij ~em
j
j=1,j6=i
Therefore
m+1
~e
i
n
X
aij m
~ej
aii
j=1,j6=i
n
X
j=1,j6=i
aij m
k~e k
aii
k~em k = max ~em
j
= r k~em k
n
X
aij
< 1
r = max
aii
i
j=1,j6=i
~em+1
r k~e k
Inductively,
k~em k rm
~e0
6
Therefore
k~em k 0 as
Theorem : The Gauss-Seidel Method converges to the solution of A~x = f~ if A is strightly diagonally dominant.
Proof : Gauss-Seidel Method can be written as:
~xm+1
=
i
i1
X
aij
aii
j=1
~xm+1
n
X
fi
aij m
~xj +
a
aii
j=i+1 ii
(1)
i1
X
aij
j=1
aii
n
X
fi
aij
~xj +
a
a
ii
j=i+1 ii
~xj
(2)
(1)-(2):
~em+1
=
i
i1
X
aij
~em+1
aii
o
nP
aij
n
m
= (em
1 , ..., en ), and r = maxi
j=1,j6=i aii Again, we will prove:
j=1
Let ~em
n
X
aij m
~e
a j
j=i+1 ii
m+1
~e
r k~em k ,
m = 0, 1, 2, ...i
Induction on i :
When i = 1,
m+1
~e
1
n
X
a1j m
a11 ~ej
j=2
k~em k
n
X
a1j
a11
j=2
r k~e k
Assume ~em+1 r k~em k for k = 1, 2, ..., i 1.
Then :
m+1
~e
i
n
i1
X
X
aij m
aij m+1
+
~ej
~e
aii
aii j
j=i+1
j=1
i1
n
X
X
aij
aij
m
m
r k~e k
aii + k~e k
aii
j=1
j=i+1
n
X
aij
< k~em k
aii
j=1,j6=i
r k~e k
< r k~em k .
By MI, ~em+1
i
Hence
m+1
~e
< r k~em k
Therefore
k~em k < rm
~e0
0 as m as r < 1
Example : Consider
A~x =
10
1
1
10
x1
x2
=
12
21
= ~b
12
21
Let
M=
10 0
0 10
10
0
0
10
1
1
0
1
1
0
1
0
!
1 m
10
~j
K
10
1
0
10
1
10
1
0
0
1
~xk + D1
12
21
=
0
1
10
1
10
0
1
1
1
= 0 = 10
or = 10
Eigenvalue of M : 2 100
1
Therefore M is diagonalizable and (M ) = 10 .
1
0
,
~xk+1 =
We need to check:
(M ) =
0
0
1
0
0
1
0
~xk + (L + D)1~b
1
100
Eigenvalue of M :
100
=0=
Therefore
(M ) =
1
~em =
100
1
or = 0
100
1
100
m
~
KGS
|1 | 10m k
For Jacobi, k
m
1
log10 ( 10
)
For Guass-Seidel, k
m
log10 ((M ))
=m
m
1
log10 ( 100
)
m
2
k0
lim k~v
= ~v lim k
Jm1 (1 )
Jm2 (2 )
J =
..
.
Jms (s )
where
1
i
Jmi (i ) =
1
..
.
..
Mmi mi (C)
1
i
1is
Now, Ak = QJ k Q1 and
k
(1 )
Jm
1
Jk =
k
(2 )
Jm
2
..
.
k
Jm
(s )
s
Also, for k mi 1
ki
k
Jmi (i ) =
k
1
k1
i
ki
k
k2
i
2
k
k1
i
1
..
.
..
.
ki
0
k
i +1
km
i
m
i1
k
i +1
km
i
mi2
..
.
k
k1
i
1
k
i
or
1
1
L + D xk+1 + (U + ( 1) D) xk = b
1
1
k+1
L+ D x
=
D (D + U ) xk + b (SOR)
1
1
L+ D
D (D + U )
a11 x
k+1
+ a12 xk2 + + a1n xkn = b1
k+1
a21 x1 + a22 x
k+1
+ + a2n xkn = f2
2
.
..
an1 xk+1
+ an2 xk+1
+ + ann x
k+1
= fn
n
1
2
for xk+1
= xk1 + x
k+1
xk1
1
1
for xk+1
= xk2 + x
k+1
xk2
2
2
..
.
k+1
k
for xn = xn + x
k+1
xkn
n
1
!
1
1
det
L+
D
D (D + U )
1 !
1
1
det
D
det
DD
1
1
det D
det ((1 ) D)
n
det ((1 ) I) = (1 )
P)
=
=
=
10
Q
Sonce det N 1 P = i i i are eigenvalues of M 1 N
Therefore
Y
n
n
n
(1 )
= det N 1 P =
i max |i | = N 1 P
i
N 1 P
| 1|
Therefore, to find the sufficient condition for SOR method to converges, we need to check the eigenvalues of the
matrix:
1
1
1
L+ D
D (D + U )
10
1
1
10
.
1
100
L+
1
D
1
1
1
1
~b
D (D + U ) ~xk + L + D
So,
=
=
=
=
1
1
D (D + U )
1
1
1
(D + L)
(D (D + U ))
1 1
(D + L)
((1 ) D U )
1
(D + L) ((1 ) D U )
1
L+ D
We examine (M )
10 0
0 1
(1 )
0 10
0 0
10 (1 )
=
and
0
10 (1 )
1
10 0
0
1
10
(D + L) =
(D + L) =
1
10
100
10
1
10
1
2
MSOR = (D + L) ((1 ) D U ) =
(1)
10
100 + 1
Characteristic polynomial of MSOR is:
2
2 (1 )
[(1 ) ]
+1
=0
100
100
(1 ) D U
11
Simplify:
2
2
+ (1 ) = 0
2 (1 ) +
100
2
Then:
2
= (1 ) +
200 20
1
.
When = 1 (Gauss-Seidel method), = 0 or = 100
Changing changes .
Choice of ??
Let us choose such that 4 (1 ) +
So, the equation has equal root :
2
100
r
4 (1 ) +
2
100
=0
2
200
= (1 ) 2 (1 ) = 1
2
4 (1 ) +
100
=
(1 ) +
2
100
= 0 is:
= 1.002512579
(Which is very close to gauss-Seidel)
But !! (MSOR ) = 0.002512579 (Compare to (MGS ) = 0.01, (MJ ) = 0.1)
converges much faster than G-S!!
Remark :
(MSOR ) is very sensitive to . If you can hit the right value of , we can improve the spped of convergence
significantly !!!
One major task in computational math is to find the right parameter !!
How can we choose optimal for simple case??
In general, difficult to choose
is usually chosen as 0 < < 2
But for some special matrix, optimum can be easily found.
Definition: Consider the system A~x = ~b. And let A = D + L + U .
If the eigenvalue of :
1
D1 L + D1 U, 6= 0
2
p
1 + 1 (MJ )2
12
So, satisfies:
det [(1 ) D U L] = 0
Sinbce 6= 0, the non-zero eigenvalue must satisfy:
(1 )
1
det
D U L
1
1 1
( + 1)
det
D L + D U
I
1
D1 L + D1 U
+1
for some
()
r
(1 ) +
2 2
4
()
2
2
p
p
=
2
1 + 1 (BJ )2
1+ 1
10 1
Example: Consider A =
.
1 10
1
0
10
Then: D1 L + 1 D1 U =
2
10
0
1
10
13
10
= 0 2 =
1
100
A is consistently ordered.
Optimal :
=
2
2
p
q
=
1 + 1 (MJ )2
1+ 1
= 1.0025126
(sameasexample1)
1
100
~x
1 D U.
k+1
1
1
1
1
1
k
~b
D+L
1 D U ~x +
D+L
1
1
1
~b
D+L
(D + L) [(1 ) D U ] ~xk +
=
=
Recall:
SOR converges | 1| < 1 or 0 < < 2
1
In general, convergence of SOR (D + L) [(1 ) D U ] < 1
= 1 G-S method
..
.
.. ...
A=
.
n1
u(x+h)2u(x)+u(xh)
,
h2
u(x1 )
..
.
..
.
..
.
~
= b,
1
2
..
.
2
1
where A =
1
..
.
1
u(xn1 )
D1
T21
A=
of the form
T12
D2
..
.
T23
..
.
..
Tp,p1
14
Dp
..
.
2
1
1
2
I
zI
X=
z I
..
.
z p1 I
T1 D12
D21 T2 T23
..
..
A=
.
.
..
.
Dp1,p
Tp
Dp,p1
1 + 12 2 2 +
1+
2 2
4 ,
where
opt =
2
p
1 + 1 2
MSOR = (D + L)
((1 ) D U ) ,
(A = L + D + U )
1
1
= 0
det (D + L)
det
1 (1 ) D + L + U
det (C) = 0
where
C=
1
(1 ) D + L + U
6= 0.
1
1
(1 ) |aii |
|Cii | = 1 (1 ) |aii | 1
||
|aii | >
n
X
|aij |
i1
X
j=1
j=1,j6=1
So C is also SDD.
Thus det(C) 6= 0. (Contradiction)
all eigenvalues of A should satisfy || < 1.
Thus (MSOR ) < 1 and hence SOR converges.
16
|aij | +
n
X
|aij |
|| j=i+1