eciv 301 programming & graphics numerical methods for engineers lecture 18 lu decomposition and...
Post on 22-Dec-2015
219 views
TRANSCRIPT
![Page 1: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/1.jpg)
ECIV 301
Programming & Graphics
Numerical Methods for Engineers
Lecture 18
LU Decomposition and Matrix Inversion
![Page 2: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/2.jpg)
EXAMPLE
4.71
3.19
85.7
102.03.0
3.071.0
2.01.03
3
2
1
x
x
x
![Page 3: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/3.jpg)
Eliminate Column 1
3
1.0
PIVOTS
4.71
3.19
85.7
102.03.0
3.071.0
2.01.03
3
3.0
1,11
11 ia
apivot i
i
njapivotaa jiijij ,,2,1,11
![Page 4: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/4.jpg)
Eliminate Column 1
6150.70
5617.19
85.7
0200.1019000.00
29333.000333.70
2.01.03
![Page 5: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/5.jpg)
Eliminate Column 2
00333.7
19000.0
PIVOTS
6150.70
5617.19
85.7
0200.1019000.00
29333.000333.70
2.01.03
2,22
22 ia
apivot i
i
njapivotaa jiijij ,,2,1,22
![Page 6: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/6.jpg)
Eliminate Column 2
0843.70
5617.19
85.7
01200.1000
29333.000333.70
2.01.03
UpperTriangular
Matrix[ U ]
ModifiedRHS
{ b }
![Page 7: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/7.jpg)
LU DecompositionPIVOTS
Column 1PIVOTS
Column 2
03333.0
1.0 02713.0
![Page 8: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/8.jpg)
LU Decomposition
As many as, and in the location of, zeros
UpperTriangular
MatrixU
01200.1000
29333.000333.70
2.01.03
![Page 9: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/9.jpg)
LU DecompositionPIVOTS
Column 1
PIVOTSColumn 2
LowerTriangular
Matrix
1
1
1
0
0
0
L
03333.0
1.0 02713.0
![Page 10: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/10.jpg)
LU Decomposition
102713.01.0
0103333.0
001
=
This is the original matrix!!!!!!!!!!
01200.1000
29333.000333.70
2.01.03
102.03.0
3.071.0
2.01.03
![Page 11: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/11.jpg)
LU Decomposition
4.71
3.19
85.7
102713.01.0
0103333.0
001
3
2
1
y
y
y
4.71
3.19
85.7
102.03.0
3.071.0
2.01.03
3
2
1
x
x
x
[ L ] { y } { b }
[ A ] { x } { b }
![Page 12: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/12.jpg)
LU Decomposition
4.71
3.19
85.7
102713.01.0
0103333.0
001
3
2
1
y
y
y
L y b
85.71 y
5617.190333.03.19 12 yy
0843.70)02713.0(1.04.71 213 yyy
![Page 13: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/13.jpg)
LU Decomposition85.71 y
5617.190333.03.19 12 yy
0843.70)02713.0(1.04.71 213 yyy
0843.70
5617.19
85.7
01200.1000
29333.000333.70
2.01.03
ModifiedRHS
{ b }
![Page 14: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/14.jpg)
LU Decomposition
• Ax=b
• A=LU - LU Decomposition
• Ly=b- Solve for y
• Ux=y - Solve for x
![Page 15: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/15.jpg)
Matrix Inversion
4.71
3.19
85.7
102.03.0
3.071.0
2.01.03
3
2
1
x
x
x
bxA
![Page 16: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/16.jpg)
Matrix Inversion
[A] [A]-1
[A] [A]-1=[I]
If [A]-1 does not exist[A] is singular
![Page 17: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/17.jpg)
Matrix Inversion
b xA bxA 1A 1A
I
![Page 18: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/18.jpg)
Matrix Inversion
bAx 1
Solution
![Page 19: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/19.jpg)
Matrix Inversion
[A] [A]-1=[I]
100
010
001
aaa
aaa
aaa
aaa
aaa
aaa
nnn2n1
2n2221
1n1211
nnn2n1
2n2221
1n1211
![Page 20: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/20.jpg)
Matrix Inversion
100
010
001
aaa
aaa
aaa
aaa
aaa
aaa
nnn2n1
2n2221
1n1211
nnn2n1
2n2221
1n1211
![Page 21: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/21.jpg)
Matrix Inversion
100
010
001
aaa
aaa
aaa
aaa
aaa
aaa
nnn2n1
2n2221
1n1211
nnn2n1
2n2221
1n1211
![Page 22: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/22.jpg)
Matrix Inversion
100
010
001
aaa
aaa
aaa
aaa
aaa
aaa
nnn2n1
2n2221
1n1211
nnn2n1
2n2221
1n1211
![Page 23: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/23.jpg)
Matrix Inversion
• To calculate the invert of a nxn matrix solve n times :
nj
2j
1j
nj
2j
1j
nnn2n1
2n2221
1n1211
a
a
a
aaa
aaa
aaa
nj ,,2,1
otherwise
ji if
0
1ij
![Page 24: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/24.jpg)
Matrix Inversion
• For example in order to calculate the inverse of:
102.03.0
3.071.0
2.01.03
![Page 25: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/25.jpg)
Matrix Inversion
• First Column of Inverse is solution of
0
0
1
a
a
a
102.03.0
3.071.0
2.01.03
31
21
11
![Page 26: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/26.jpg)
Matrix Inversion
0
1
0
a
a
a
102.03.0
3.071.0
2.01.03
32
22
12
• Second Column of Inverse is solution of
![Page 27: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/27.jpg)
Matrix Inversion
• Third Column of Inverse is solution of:
1
0
0
a
a
a
102.03.0
3.071.0
2.01.03
33
23
13
![Page 28: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/28.jpg)
Use LU Decomposition
102713.01.0
0103333.0
001
01200.1000
29333.000333.70
2.01.03
102.03.0
3.071.0
2.01.03
A
![Page 29: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/29.jpg)
Use LU Decomposition – 1st column
• Forward SUBSTITUTION
0
0
1
y
y
y
102713.01.0
0103333.0
001
31
21
11
111 y
03333.00333.00 1121 yy
1009.002713.01.00 211131 yyy
![Page 30: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/30.jpg)
Use LU Decomposition – 1st column
• Back SUBSTITUTION
1009.0
0333.0
1
a
a
a
01200.1000
29333.000333.70
2.01.03
31
21
11
010078.0012.10/1009.0a31
00518.000333.7/a2933.00333.0a 3121
332489.03/a2.0a1.01a 312111
![Page 31: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/31.jpg)
Use LU Decomposition – 2nd Column
• Forward SUBSTITUTION
0
1
0
y
y
y
102713.01.0
0103333.0
001
32
22
12
012 y
122 y
02713.002713.01.00 221232 yyy
![Page 32: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/32.jpg)
Use LU Decomposition – 2nd Column
• Back SUBSTITUTION
02713.0
1
0
a
a
a
01200.1000
29333.000333.70
2.01.03
32
22
12
002709.0012.10/02713.0a32
1429.000333.7/a2933.01a 3222
004944.03/a2.0a1.00a 322212
![Page 33: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/33.jpg)
Use LU Decomposition – 3rd Column
• Forward SUBSTITUTION
1
0
0
y
y
y
102713.01.0
0103333.0
001
33
23
13
013 y
023 y
102713.01.01 231333 yyy
![Page 34: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/34.jpg)
Use LU Decomposition – 3rd Column
• Back SUBSTITUTION
1
0
0
a
a
a
01200.1000
29333.000333.70
2.01.03
33
23
13
09988.0012.10/1a33
004183.000333.7/a2933.00a 3323
006798.03/a2.0a1.00a 332313
![Page 35: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/35.jpg)
Result
102.03.0
3.071.0
2.01.03
A
09988.000271.001008.0
004183.0142903.000518.0
006798.0004944.0332489.0
A 1
![Page 36: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion](https://reader036.vdocuments.us/reader036/viewer/2022062516/56649d795503460f94a5ca8f/html5/thumbnails/36.jpg)
Test It
09988.000271.001008.0
004183.0142903.000518.0
006798.0004944.0332489.0
102.03.0
3.071.0
2.01.03
11046.30
1047.31106736.8
0108.11
18
1818
18