eciv 301 programming & graphics numerical methods for engineers lecture 17 solution of systems...
Post on 20-Dec-2015
218 views
TRANSCRIPT
ECIV 301
Programming & Graphics
Numerical Methods for Engineers
Lecture 17
Solution of Systems of Equations
23610
3112
835
z
y
x
24
6
10 10
z
y
x
835
6
z
y
x
3112
24
z
y
x
23610
# Equations = # Unknowns = n
Square Matrix n x n
Last Time Solution of Linear Equations
10
7
9
500
310
835
z
y
x
Express In Matrix Form
Upper Triangular
What is the characteristic?
Solution by Back Substitution
Last Time Solution of Linear Equations
Objective
Can we express any system of equations in a form
nnnn
n
n
n
b
b
b
b
x
x
x
x
a
aa
aaa
aaaa
3
2
1
3
2
1
333
22322
1131211
000
00
0
0
Last Time Background
Consider
1035 yx(Eq 1)
5810 yx(Eq 2)
Solution
5.7
5.6
y
x
20610 yx2*(Eq 1)
5810 yx(Eq 2)
Solution
5.7
5.6
y
x!!!!!!
Scaling Does Not Change the SolutionScaling Does Not Change the Solution
Last Time Background
Consider
20610 yx(Eq 1)
152 y(Eq 2)-(Eq 1)
Solution
5.7
5.6
y
x!!!!!!
20610 yx(Eq 1)
5810 yx(Eq 2)
Solution
5.7
5.6
y
x
Operations Do Not Change the SolutionOperations Do Not Change the Solution
Last TimeGauss Elimination
Back Substitution
118.8645.7/064.62 z
0502.26
2.6
118.82.1630
y
6413.0
5
118.880502.26310
x
064.62
30
10
645.700
2.162.60
835
z
y
x
Gauss Elimination – Potential Problem
10830 zyx
2423610 zyx
6312 zyx
0
12 Division By Zero!!Operation Failed
Partial Pivoting
nn
nnnnn
lll
n
n
n
b
b
b
b
x
x
x
x
aaaa
aaaa
aaaaaaaa
aaaa
3
2
1
3
2
1
321
ln321
3333231
2232221
1131211
a32>a22
al2>a22
NO
YES
Partial Pivoting
nn
nnnnn
n
n
lll
n
b
b
b
b
x
x
x
x
aaaa
aaaa
aaaaaaaa
aaaa
3
2
1
3
2
1
321
2232221
3333231
ln321
1131211
Full Pivoting
• In addition to row swaping
• Search columns for max elements
• Swap Columns
• Change the order of xi
• Most cases not necessary
Eliminate Column 2
00333.7
19000.0
PIVOTS
6150.70
5617.19
85.7
0200.1019000.00
29333.000333.70
2.01.03
LU Decomposition
As many as, and in the location of, zeros
UpperTriangular
MatrixU
01200.1000
29333.000333.70
2.01.03
LU DecompositionPIVOTS
Column 1
PIVOTSColumn 2
LowerTriangular
Matrix
1
1
1
0
0
0
L
03333.0
1.0 02713.0
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
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
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
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