c3_l3 special matrices and gauss seidal (1)
TRANSCRIPT
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
1/24
CHAPTER 3
Special Matrices
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
2/24
SPECIAL MATRICESBanded Matrix:
A banded matrix is a square matrix that has all elements equal to zero, with the exception of a band centered on the main diagonal.
The dimensions of a banded system can be quantified by two
parameters:
a) The bandwidth BW, and
b) The half bandwidth HBW.
These two values are related by
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
3/24
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
4/24
A banded matrix with a bandwidth of 3 is called a tridiagonal
system. It can be expressed generally as
TRIDIAGONAL SYSTEM
n
n
n
n
nn
nnn
r
r
r
r
r
x
x
x
x
x
f e
g f e
g f e
g f e
g f
1
3
2
1
1
3
2
1
111
333
222
11
Notice that we have changed our notation for the
coefficients from a and b to e, f , g and r .
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
5/24
By LU decomposition, the tridiagonal system is transformed to
TRIDIAGONAL SYSTEM
n
nn
n
n
nn
nnn
f
g f
g f
g f
g f
e
e
e
e
f e
g f e
g f e
g f e
g f
~
~
~
~
1~1~
1~1~
1
11
33
22
11
1
2
2
111
333
222
11
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
6/24
A tridiagonal system can be solved efficiently by using Thomas
algorithm. The algorithm consists of three steps:
1. Decomposition:
where k = 2,3,.,n
THOMAS ALGORITHM
1
1
~~~
k k k k
k
k k
g e f f
f e
e
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
7/24
2. Forward Substitution:
where k = 2,3 ,.,n
3. Back Substitution:
where k = n- 1 ,n- 2,..,2,1
THOMAS ALGORITHM
1~~
k k k k r er r
k
k k k k
n
nn
f x g r x
f
r x
~~
~~
1
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
8/24
Solve the following tridiagonal system:
EXAMPLE 1
8.200
8.0
8.0
8.40
04.2100
104.210
0104.21
00104.2
4
3
2
1
x
x
x
x
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
9/24
LU decomposition
SOLUTION
323.1000
1395.100
01550.10
00104.2)(04.2100
1395.100
01550.10
00104.2
)(04.2100104.210
01550.10
00104.2
)(
04.2100
104.210
0104.21
00104.2
3395.1
1
4
2550.1 13
104.21
2
R R
R R
R R
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
10/24
The factors employed to obtain the upper triangular matrix are
LU decomposition
SOLUTION
323.1000
1395.100
01550.10
00104.2
1717.000
01645.00
00149.0
0001
]][[][ U L A
717.0~
645.0~
49.0~
395.11
4
550.11
3
04.21
2
f
f
f
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
11/24
Forward decomposition
Thus, the right-hand-side vector has been modified to
SOLUTION
996.210)221.14)(717.0(8.200
221.14)8.20)(645.0(8.0
8.20)8.40)(49.0(8.0
4
3
2
r
r
r
996.210
221.14
8.20
8.40
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
12/24
Back decomposition
SOLUTION
970.65
778.93
538.124
480.159
04.2)778.93)(1(8.40
1
550.1)538.124)(1(.20
2
395.1)480.159)(1(221.14
3
323.1996.210
4
1
211
2
322
3
433
4
4
f T g r
f T g r
f T g r
f r
x
x
x
x
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
13/24
a) Solve the following tridiagonal system with the Thomas algorithm
b) Determine the matrix inverse for [A] based on the LU
decomposition and unit vectors.
EXAMPLE 2
105
25
41
8.04.00
4.08.04.0
04.08.0
3
2
1
x
x
x
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
14/24
a)
We have
Decomposition:
For k = 2,
SOLUTION
10525
41
8.04.004.08.04.0
04.08.0
3
2
1
x x
x
105,8.0,4.0
25,4.0,8.0,4.0
41,4.0,8.0
333
2222
111
r f e
r g f e
r g f
6.0)4.0)(5.0(8.0~~
5.08.04.0~
1222
1
22
g e f f
f e
e
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
15/24
For k = 3,
Thus, the LU decomposition is
SOLUTION
53333.0)4.0)(66667.0(8.0~~
66667.0
6.0
4.0~
~
2333
2
33
g e f f f
ee
53333.000
4.06.00
04.08.0
166667.00
015.0
001
]][[][ U L A
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
16/24
Forward substitution:
For k = 2,
For k = 3,
Thus, the right-hand-side becomes
SOLUTION
5.45)41)(5.0(25~ 1222 r er r
53333.000
4.06.00
04.08.0
166667.00
015.0
001
]][[][ U L A
3333.135)5.45)(66667.0(105~~ 2333 r er r
3333.135
5.45
41
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
17/24
Back substitution:
For k = 3,
For k = 2,
For k = 1,
Thus, the required solution is
SOLUTION
53333.000
4.06.00
04.08.0
166667.00
015.0
001
]][[][ U L A
75.25353333.0
3333.135
3
33
f
r x
2456.0
)]75.253)(4.0(5.45[
2
3222
f
x g r x
75.1738.0)]245)(4.0(41[
1
2111 f
x g r x
75.253,245,75.173 321 x x x
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
18/24
b) The LU decomposition is
To compute the first column of the inverse,
SOLUTION
53333.000
4.06.00
04.08.0
][,
166667.00
015.0
001
][ U L
333335.0,5.0,1
066667.0
05.0
1
0
0
1
166667.00
015.0
001
}{ where ,
0
01
}]{[
321
32
21
1
3
2
1
3
2
1
d d d
d d
d d
d
d
d
d
d
d d
D D L
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
19/24
And
By back substitution, we have
The first column of the inverse is
SOLUTION
333335.053333.0
5.04.06.0
14.08.0
333335.0
5.01
53333.000
4.06.0004.08.0
}{}]{[
31
3121
2111
31
21
11
1
A
A A
A A
A
A A
D AU
875.1,25.1,625.0 112131 A A A
625.0
25.1
875.1
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
20/24
For the second column,
SOLUTION
66667.0,1,0
066667.0
15.0
00
1
0
166667.00
015.0
001
}{ where ,
0
10
}]{[
321
32
21
1
3
2
1
3
2
1
d d d
d d
d d
d d
d
d
d
d d
D D L
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
21/24
And
By back substitution, we have
The second column of the inverse is
SOLUTION
66667.053333.0
14.06.0
04.08.0
66667.0
10
53333.000
4.06.0004.08.0
}{}]{[
32
3222
2212
32
22
12
1
A
A A
A A
A
A A
D AU
25.1,5.2,25.1 122232 A A A
25.1
5.2
25.1
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
22/24
For the third column,
SOLUTION
1,0,0
166667.0
05.0
0
1
0
0
166667.00
015.0
001
,
1
0
0
}]{[
321
32
21
1
3
2
1
d d d
d d
d d
d
d
d
d
D L
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
23/24
And
By back substitution, we have
The third column of the inverse is
SOLUTION
153333.0
04.06.0
04.08.0
1
00
53333.000
4.06.0004.08.0
}{}]{[
33
3323
2313
33
23
13
1
A
A A
A A
A
A A
D AU
625.0,25.1,875.1 132333 A A A
875.1
25.1
625.0
-
8/12/2019 C3_L3 Special Matrices and Gauss Seidal (1)
24/24
The matrix inverse is
SOLUTION
875.125.1625.0
25.15.225.1
625.025.1875.1
][ 1 A