Upload
others
View
0
Download
0
Embed Size (px)
Citation preview
第三章 线性方程组的数值解法(3)
迭代法
Ax = b x = Bx+d
dBxx kk )()1(
nTn Rxxxx ),,,( )0()0(
2)0(
1)0(
迭代公式
Jacobi 迭代法是最简单的一种迭代法
Jacobi 迭代法
11 1 12 2 1 1
21 1 22 2 2 2
1 1 2 2
n n
n n
n n nn n n
a x a x a x b
a x a x a x b
a x a x a x b
0iia 1,
1 n
i i ij j
ii j j i
x b a xa
11 1 1 12 2 13 3 14 4 1
22 2 2 21 1 23 3 24 4 1
1 1 2 2 3 3 ( 1) 1
( ... )
( ... )
( ... )
n n
n n
nn n n n n n n n n
a x b a x a x a x a x
a x b a x a x a x a x
a x b a x a x a x a x
( 1) ( )
1
1 nk k
i i ij j
ii jj i
x b a xa
Jacobi 迭代公式
( 1) ( ) ( ) ( ) ( )
1 1 12 2 13 3 14 4 1
11
( 1) ( ) ( ) ( ) ( )
2 2 21 1 23 3 24 4 2
22
( 1) ( ) ( )
1 1 2 2
1( ... )
1( ... )
1(
k k k k k
n n
k k k k k
n n
k k k
n n n n
nn
x b a x a x a x a xa
x b a x a x a x a xa
x b a x a xa
( ) ( )
3 3 ( 1) 1... )k k
n n n na x a x
上一步结果
一般地,x(k+1)比 x(k) 更接近准确解
( 1) ( ) ( ) ( ) ( )
1 1 12 2 13 3 14 4 1
11
( 1) ( ) ( ) ( ) ( )
2 2 21 1 23 3 24 4 2
22
( 1) ( ) ( ) ( ) ( )
3 3 31 1 32 2 34 4 3
33
1( ... )
1( ... )
1( ... )
k k k k k
n n
k k k k k
n n
k k k k k
n n
x b a x a x a x a xa
x b a x a x a x a xa
x b a x a x a x a xa
( 1) ( ) ( ) ( ) ( )
1 1 2 2 3 3 ( 1) 1
1( ... )k k k k k
n n n n n n n n
nn
x b a x a x a x a xa
( 1)
1
kx
( 1)
1
kx ( 1)
2
kx
( 1)
1
kx ( 1)
2
kx ( 1)
3
kx ( 1)
4
kx
( 1) ( ) ( ) ( ) ( )
1 1 12 2 13 3 14 4 1
11
( 1) ( 1) ( ) ( ) ( )
2 2 21 1 23 3 24 4 2
22
( 1) ( 1) ( 1) ( ) ( )
3 3 31 1 32 2 34 4 3
33
1( ... )
1( ... )
1( ... )
k k k k k
n n
k k k k k
n n
k k k k k
n n
x b a x a x a x a xa
x b a x a x a x a xa
x b a x a x a x a xa
( 1) ( 1) ( 1) ( 1) ( 1)
1 1 2 2 3 3 ( 1) 1
1( ... )k k k k k
n n n n n n n n
nn
x b a x a x a x a xa
1( 1) ( 1) ( )
1 1
1 i nk k k
i i ij j ij j
ii j j i
x b a x a xa
Gauss-Seidel迭代
德国数学家Philipp Ludwig von
Seidel (1821--1896)
Philipp von Seidel's
Seidel completed his school studies in the autumn of 1839, he did not enter university
immediately but received private coaching in mathematics before beginning his
university career. He was coached by L C Schnürlein who was a mathematics teacher.
This was valuable coaching for Seidel, particularly since Schnürlein was a good
mathematician who had studied under Gauss.
Seidel entered the University of Berlin in 1840 and studied under Dirichlet and Encke.
Seidel moved to Königsberg in 1842 where he studied under Bessel, Jacobi and Franz
Neumann. In the autumn of 1843 Jacobi left Königsberg on the grounds of ill health and
set off for Italy with Borchardt, Dirichlet, Schläfli and Steiner.. He obtained his doctorate
from Munich in 1846. Six months later he submitted his habilitation dissertation
Untersuchungen über die Konvergenz und Divergenz der Kettenbrüche and qualified to
become a lecturer at Munich. It is worth noting that these two theses, submitted only six
months apart, were on two completely different topics - the first was on astronomy while
the second was on mathematical analysis. (将概率论引入天文学研究)
He was appointed as an extraordinary (卓越的) professor in Munich in 1847. He was
elected to the Bavarian Academy of Sciences. Other academies also honoured him, for
example he was elected to the academies of Göttingen and of Berlin.
An interesting aspect of Seidel's astronomical work involved, as we mentioned above,
the use of probability theory. However, he did not restrict his use of this mathematical
discipline to astronomy, for he also applied his skills in this area to study the frequency of
certain diseases and also looked at certain questions relating to the climate. He lectured
on probability theory, and also on the method of least squares.
Problems with his eyesight forced Seidel into early retirement. Since he had never
married he had no immediate family to help him when he became ill, but he had an
unmarried sister Lucie Seidel who looked after him until 1889.
GS迭代方法的矩阵形式
1( 1) ( 1) ( )
1 1
1 i nk k k
i i ij j ij j
ii j j i
x b a x a xa
( 1) ( ) ( ) ( ) ( )
11 1 1 12 2 13 3 14 4 1
( 1) ( 1) ( ) ( ) ( )
21 1 22 2 2 23 3 24 4 2
( 1) ( 1) ( 1) ( ) ( )
31 1 32 2 33 3 3 34 4 3
( ... )
( ... )
( ... )
k k k k k
n n
k k k k k
n n
k k k k k
n n
a x b a x a x a x a x
a x a x b a x a x a x
a x a x a x b a x a x
( 1) ( 1) ( 1) ( 1) ( 1)
1 1 2 2 3 3 ( 1) 1
...k k k k k
n n n n n n nn n na x a x a x a x a x b
A L D U
11 12 13 14
21 22 23 24
31 32 33 34
41 42 43 44
11 12 13 14
21 22 23 24
31 32 33 34
41 42 43 44
0 0 00 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
a a a aa a a aa a a aa a a a
a a a aa a a aa a a aa a a a
L D U
( 1) ( ) ( ) ( ) ( )
11 1 1 12 2 13 3 14 4 1
( 1) ( 1) ( ) ( ) ( )
21 1 22 2 2 23 3 24 4 2
( 1) ( 1) ( 1) ( ) ( )
31 1 32 2 33 3 3 34 4 3
( ... )
( ... )
( ... )
k k k k k
n n
k k k k k
n n
k k k k k
n n
a x b a x a x a x a x
a x a x b a x a x a x
a x a x a x b a x a x
( 1) ( 1) ( 1) ( 1) ( 1)
1 1 2 2 3 3 ( 1) 1
...k k k k k
n n n n n n nn n na x a x a x a x a x b
( 1) ( )( ) k kL D b U x x
( 1) 1 ( ) 1( ) ( )k kL D U L D b x x
迭代矩阵
B
Jacobi迭代矩阵
( 1) 1 ( ) 1( ) ( )k kL D U L D b x x
GS迭代矩阵
( 1) 1 ( ) 1( )k kx D L U x D b
由于利用了最新的信息(或者说,迭代矩阵更接近原矩阵的逆)
GS迭代比Jacobi迭代收敛更快(一般)
• 例T=1000C T=0CT = ?
1 12 0i i iT T T
i i+1i-10 N
( 1) ( ) ( )1 1
1
2
k k ki i iT T T
Jacobi迭代:
i=1, 2, …, N-1
i i+1i-10 N
GS迭代:
( 1) ( 1) ( )1 1
1
2
k k ki i iT T T
i=1, 2, …, N-1
0 1000T 0NT
边界条件
1 12 0i i iT T T
1000 0 0 0 0 0 0 00 0 0 0 0
1000 0 0 0 0 0 0 0500 0 0 0 0
( 1) ( ) ( )1 1
1
2
k k ki i iT T T
1000 0 0 0 0 0 0 0500 250 0 0 0
1000 0 0 0 0 0 0 0625 250 125 0 0
1000 0 0 0 0 0 0 0625 375 125 0 0
1000 0 0 0 0 0 0 00 0 0 0 0
1000 500 250 125 62.5 31.25
( 1) ( 1) ( )1 1
1
2
k k ki i iT T T
1000 625 437.5 250
1000 0718.75 484.375
2 500
3 250
4 125
5 125
6.0000 93.7500
7.0000 78.1250
8.0000 70.3125
9.0000 54.6875
10.0000 54.6875
11.0000 46.8750
12.0000 43.9453
13.0000 40.2832
14.0000 36.2549
15.0000 34.9121
16.0000 30.5481
17.0000 30.5481
18.0000 27.7710
19.0000 26.9775
20.0000 25.2895
21.0000 24.0259
22.0000 23.0937
23.0000 21.5578
24.0000 21.1526
25.0000 19.4696
26.0000 19.4312
27.0000 18.1114
28.0000 17.8969
29.0000 16.9070
30.0000 16.5212
2 500
3 125
4.0000 78.1250
5.0000 54.6875
6.0000 43.9453
7.0000 36.2549
8.0000 30.5481
9.0000 26.9775
10.0000 24.0259
11.0000 21.5578
12.0000 19.4696
13.0000 17.8969
14.0000 16.5212
15.0000 15.2809
16.0000 14.1564
17.0000 13.1323
18.0000 12.1955
19.0000 11.3357
20.0000 10.5442
21.0000 9.8137
22.0000 9.1382
23.0000 8.5125
24.0000 7.9320
25.0000 7.3930
26.0000 6.8921
27.0000 6.4261
28.0000 5.9924
29.0000 5.5886
30.0000 5.2124
迭代法的加速
Jacobi迭代法和G—S迭代法
都涉及到收敛速度问题
如何加快迭代法的速度呢?
)()1()(1
kkk xxrA
加速)()()( kkk xxrA 11
)()(1
)1( kkk xrAx
加速法主要思想
通过加权平均优化 ҧ𝐴
)()*()( )( kkk xxx 111
)()1( )()1()()1( kkkk UxLxbDxDx
bxUDxLD kk )()1( ))1(()(
上式为逐次超松弛法(SOR迭代法)的矩阵形式
))1(()( 1 UDLDB
bLDf 1)(
令
fxBx kk )()1(
法的迭代矩阵为SORB
𝐷 + 𝐿 𝑥 𝑘+1 = 𝐷 + 𝐿 𝑥(𝑘) + (𝑏 − 𝐿 + 𝐷 + 𝑈 𝑥(𝑘))
𝐷𝑥 𝑘+1 = 𝐷𝑥(𝑘) + (𝑏 − 𝐿 + 𝐷 + 𝑈 𝑥(𝑘))
Jacobi
G-S
SOR
𝜔−1𝐷 + 𝐿 𝑥 𝑘+1 = 𝜔−1𝐷 + 𝐿 𝑥(𝑘) + (𝑏 − 𝐿 + 𝐷 + 𝑈 𝑥(𝑘))
残差 𝑟
,1时当 SOR法化为
bLDUxLDx kk 1)(1)1( )()( G-S迭代法
G-S法为SOR法的特例, SOR法为G-S法的加速
例 用G-S法和SOR法求下列方程组的解, 45.1取
321
242
124
3
2
1
x
x
x
3
2
0
要求精度1e-6
解: (1)G-S迭代法
GB ULD 1)(
1
321
042
004
000
200
120
5.03/10
625.025.00
25.05.00
f bLD 1)(
1
321
042
004
3
2
0
3/2
5.0
0
)',0,0()0( 0取初值 x
[x,k]=gauss_seidel(a,b,[1,1,1]',1e-6)
1 1 1
0.7500000 0.3750000 1.5000000
0.5625000 0.5312500 1.5416667
0.6510417 0.5963542 1.6145833
0.7018229 0.6582031 1.6727431
……………………………………….
0.9999933 0.9999923 1.9999926
0.9999943 0.9999935 1.9999937
0.9999952 0.9999944 1.9999946
k = 71
x=
0.999995
0.999994
1.999995
满足精度的解
迭代次数为71次
(1)SOR迭代法
1 1 1
0.6375000 0.0121875 1.3199063
0.2004270 0.3717572 1.3122805
0.6550335 0.5340119 1.6922848
0.7058468 0.7733401 1.7771932
………………………………………..
0.9999990 0.9999976 1.9999991
0.9999984 0.9999993 1.9999989
0.9999998 0.9999994 1.9999998
0.9999996 0.9999998 1.9999997
k = 24
x=
1.000000
1.000000
2.000000
满足精度的解
迭代次数为24次
bLDxUDLDx kk 1)(1)1( )()-)1(()(
SOR法的收敛速度比G-S法要快得多,选取适当的
迭代法的收敛性
1 ( )k kx x | ( ) | 1x L
非线性方程迭代求解的收敛性
线性方程组迭代求解的收敛性?
( 1) ( )k kB f x x || || 1B
向量和矩阵的范数
范数:一种描述向量或矩阵”大小”的度量
• 常用的向量范数
• 常用的矩阵范数
• 矩阵的谱半径
• 例:范数在误差估计中的应用
pxxx pp
n
p
p1
1
1 ,
px
AxA
p
p
p1sup ,
nA ,,max)( 1
• 在数值计算中,常用的向量范数有三种。设 ,规定nT
n Rxxxx ),,( 21
ini
n
i
i
n
i
i
xx
xx
xx
1
2/1
1
2
2
11
max"")3(
)("2")2(
"1")1(
范数向量的
范数向量的
范数向量的
(1)矩阵的列范数:
(2)矩阵的行范数:
(3)矩阵的谱范数:
n
i
ijnj
aA1
11max
n
j
ijni
aA1
1max
𝐴 2 = 𝜌(𝐴𝑇𝐴)
13
12A
5}2,5max{1
A
max{3,4} 4A
25
513
13
12
11
32AAT
)22115(2
1
8643.3)22115(2
1max2
A
例:
• 性质
小 结
• 本章主要介绍了解线性方程组的直接法和迭代法
• 直接法的基础是Gauss消去法及其矩阵形式的LU
分解。
• 选取主元素是保证消去法计算稳定性及提高精度
的有效方法,列主元比较常用。
• 利用对称正定矩阵的矩阵形式的特殊性,可以简
化LU分解,得到追赶法及平方根法,这两个方法
• 对于大型稀疏方程组可采用迭代法求解,
比较简便有效的迭代法是 Jacobi迭代和
Gauss-Seidel方法;
• 当选取合适的松弛因子,SOR方法可获得较
快的收敛速度,被广泛应用.
• Jacobi迭代:Ã = D
定理:A行对角优、或A列对角优,Jacobi迭
代收敛。
• Gauss-Seidel迭代:Ã = D + L
定理:A行对角优、或A列对角优、或A正定,
Gauss-Seidel迭代收敛。
• 松弛迭代: Ã = w-1D + L
定理:松弛迭代收敛 0<w<2
定理:A正定且0<w<2 松弛迭代收敛