Professional Documents
Culture Documents
1 0 0 0 9 6 2 13
0 0 0 1 4 2 8 1
P1 , A
0 0 1 0 0 7 1 9
0 1 0 0 3 2 6 8
9 6 2 13 9 13 2 6
3 2 6 8 4 8 8 2
P1 A AP1
0 7 1 9 0 9 1 7
4 2 8 11 3 11 6 2
4 x1 2 x2 x3 15
10 x2 19 x3 77
72 x3 216
4 x1 2 x2 x3 15 4 x1 2 x2 x3 15 4 x1 2 x2 x3 15
3x1 x2 4 x3 8 10 x2 19 x3 77 10 x2 19 x3 77
x1 x2 3x3 13 x2 11x3 37 72 x3 216
4 2 1 x1 15
3 1 4 x 8
2
1 1 3 x3 13
4 2 1 15 3 R 4 R 4 2 1 15
3 1 4 8 1 2
0 10 19 77
( 1) R1 4 R3
1 1 2 13 0 2 11 37
4 2 1 15
0 10 19 77
2 R2 10 R3
0 0 72 216
4 2 1 15 R ( 3 / 4 ) R 4 2 1 15
3 1 4 8 2 1 0 2.5 4.75 19.25
R3 (1/ 4 ) R1
1 1 2 13 0 0.5 2.75 9.25
4 2 1 15
0 2.5 4.75 19.25
R3 ( 0.5 / 2.5 ) R2
0 0.0 1.80 5.40
No pivoting is required here!
4 2 1 15
(0.75) 2.5 4.75 19.25
(0.25) (0.20) 1.80 5.40
1 0 0 4 2 1
L 0.75 1 0 U 0 2.5 4.75
0.25 0.20 1 0 0 1.80
We can easily var ify that
A LU (when no pivoting is done) WHY??
Numerical Method, Chap 2 2022 16 Jung Hong Chuang, CS Dept., NCTU
Gaussian elimination
LU decomposition
• If row interchange is performed,
A’ =LU, where
A’ is a permutation of the rows of A due to
row interchange from pivoting
0 2 0 1 0 6 1 6 5 6
2 2 3 2 2 row 1 row 4 2 2 3 2 2
4 3 0 1 7 4 3 0 1 7
6 1 6 5 6 0 2 0 1 0
6 1 6 5 6 6 1 6 5 6
G . E . 0 1 .6667 5 3 .6667 4 row 2 row 30 3.6667 4 4.3333 11
0 3.6667 4 4.3333 11 0 1.6667 5 3.6667 4
0 2 0 1 0 0 2 0 1 0
Numerical Method, Chap 2 2022 20 Jung Hong Chuang, CS Dept., NCTU
Gaussian elimination
LU decomposition
6 1 6 5 6 6 1 6 5 6
G.E . 0 3.6667 4 4.3333 11
G.E . 0 3. 6667 4 4.3333 11
0 0 6.8182 5.6364 9.0001 0 0 6.8182 5.6364 9.0001
0 0 2.1818 3.3636 5.9999 0 0 0 1.5600 3.1199
1 0 0 0 6 1 6 5
0.66667 1 0
0 0 3. 6667 4 4.3333
L U
0.33333 0.45454 1 0 0 0 6.8182 5.6364
0.0 0.54545 0.32 1 0 0 0 1.5600
6 1 6 5
4 3 0 1
LU A' det( A) (1) 2 6 3.6667 6.8182 1.5600 234.0028 ~ 234(exact)
2 2 3 2
0 2 0 1
0 2 0 1 0 1 0 0 0 0.5
2 2 3 2 2 0 1 0 0 1.0001
4 3 0 1 7 0 0 1 0 0.3333
6 1 6 5 6 0 0 0 1 2
Let' s consider another small change to b Note that we cannot test for the
b2 [1.61, 7.22, 3.38]T , accuracy of the computed solution
Solution x2 [1.07271, 4.6826, 0.0265]T , merely by substituti ng it into the
which differs much from the true solution! equation to see if the right -hand
sides are reproduced.
When A[1,1] is changed from 3.02 to 3.00,
Solution t o Ax b is Ax b
x [1.1277, 6.5221, 0.7333]T . Ax1 b1 b
The system is also sensitive to the error in Ax2 b2 b
coeeficien t matrix. Check!
Why? See pages on condition number.
n
A 1 max aij
1 j n
i 1
n
A max aij
1i n
j 1
Note that :
A 2 A1
A2 A
Numerical Method, Chap 2 2022 46 Jung Hong Chuang, CS Dept., NCTU
Errors in the solution
• How large is the errors in the solution?
– Substituting solution to the equation…
• Not good for ill-conditioned systems – can not tell how
large the error is
– Use norms to define “condition number”
Condition number
Numerical Method, Chap 2 2022 48 Jung Hong Chuang, CS Dept., NCTU
Condition number of a matrix
Exact solution :
x [1.000, 1.000, 1.000]T . We solve Ae r and get
e [0.00822, 0.00300, 0.00000757 ]T .
Using 3-digit precision Finally,
Computed solution : x e [0.999, 1.000, 1.000]T
x [0.991, 0.997, 1.000]T . gives almost exactly the correct solution.
Suppose F D E and C B.
With pivoting, we reduce
Dx Ey D E So that
x By B ( BD E ) / D
y 1,
to ( BD E ) / D
Dx Ey D E DEE
( B ( / D) E ) y x 1
D
B ( / D)( D E )
D BD D E BD E
D D
Iterative form :
x ( k 1) ( L D) 1Ux ( k ) ( L D) 1 b
j i
j i
aii
This implies that ik 1 is smaller
a ij
than i by a factor of at least .
j i k
i max i max
k k
max
aii
The convergenc e will therefore be
ensured if 1,
i.e., if A is diagonally dominant.
1 i 1 n aii j 1 j i
bi aij x j aij x j
( k 1) (k )
aii j 1 j i
w : the overrelaxation factor,
1 w 2.
Numerical Method, Chap 2 2022 70 Jung Hong Chuang, CS Dept., NCTU
Iterative methods
Accelerating convergence
4 1 1 1 1
1 4 1 1 1
x
1 1 4 1 1
1 1 1 4 1
The exact solution is (-1, -1, -1, -1)