Review Operasi Matrikskuliah.ftsl.itb.ac.id/wp-content/uploads/2016/10/kuliah-minggu-2.pdf · Jika...
-
Upload
phungquynh -
Category
Documents
-
view
258 -
download
0
Transcript of Review Operasi Matrikskuliah.ftsl.itb.ac.id/wp-content/uploads/2016/10/kuliah-minggu-2.pdf · Jika...
Review Operasi Matriks
Menghitung invers matriks?
Determinan?
Matriks Singular?
Menghitung invers matriks
=
10
01
2221
1211
2221
1211
aa
aa
cc
cc
1acac
=
1
0
0
1
22221221
21221121
22121211
21121111
acac
acac
acac
acac
Determinan
� Hanya untuk square matrices
bcaddc
ba
dc
ba−≡≡
det
aaa
Jika determinan = 0 � matriks singular, tidak
punya invers
123213312132231321
321
321
321
det
cbacbacbacbacbacba
ccc
bbb
aaa
−+−+−≡
Cari invers nya"
52
42
42
21
Sistem Persamaan Linear
Simultaneous Linear Equations
Metode Penyelesaian
• Metode grafik
• Eliminasi Gauss
• Metode Gauss – Jourdan
• Metode Gauss – Seidel• Metode Gauss – Seidel
• LU decomposition
Metode Grafik
2
=
− 2
4
11
21
2
1
x
x
-2
Det{A} ≠ 0 ⇒ A is
nonsingular so
invertible
Unique
solution
Sistem persamaan yang tak
terselesaikan
=
5
4
42
21
2
1
x
x
No solutionNo solutionDet [A] = 0, but system is inconsistent
Then this system of equations is not solvable
Sistem dengan solusi tak terbatas
Det{A} = 0 ⇒ A is singular
infinite number of solutions
421 x
=
8
4
42
21
2
1
x
x
Consistent so solvable
Ill-conditioned system of equations
A linear system of
equations is said
to be “ill-
conditioned” if the
coefficient matrix
tends to be
singular
Ill-conditioned system of equations
• A small deviation in the entries of A matrix,
causes a large deviation in the solution.
=
321 1x
=
11x
⇒
=
47.1
3
99.048.0
21
2
1
x
x
=
47.1
3
99.049.0
21
2
1
x
x
=
1
1
2
1
x
x⇒
=
0
3
2
1
x
x⇒
Gaussian Elimination
Merupakan salah satu teknik paling populer
dalam menyelesaikan sistem persamaan linear
dalam bentuk:
[ ][ ] [ ]CXA =
Terdiri dari dua step
1. Forward Elimination of Unknowns.
2. Back Substitution
[ ][ ] [ ]CXA =
Forward Elimination
Tujuan Forward Elimination adalah untuk membentuk
matriks koefisien menjadi Upper Triangular Matrix
1525 1525
7.000
56.18.40
1525
−−→
112144
1864
1525
Forward Elimination
Persamaan linear
n persamaan dengan n variabel yang tak diketahui
11313212111 ... bxaxaxaxa nn =++++ 11313212111 nn
22323222121 ... bxaxaxaxa nn =++++
nnnnnnn bxaxaxaxa =++++ ...332211
. .
. .
. .
Contoh
8325
1232
7352
2232
4321
4321
4321
4321
=+−+−
=−++−
=+−+
−=−−+
xxxx
xxxx
xxxx
xxxx
matriks input
83125
12312
71352
21232
−
−−
−
−−−
8325 4321 =+−+− xxxx
Forward Elimination
83125
12312
71352
21232
−
−−
−
−−−
3216
2190
13140
92120
1211
231
−
−−
−
−−−
'
14
'
4
'
13
'
3
'
12
'
2
1'
1
5
2
2
2
RRR
RRR
RRR
RR
−=
−=
−=
=
83125 − 32
62
0 −144
5RRR −=
3216
2190
13140
92120
1211
231
−
−−
−
−−−
41599
4500
197300291
2110
1211
231
−−−−−
−
−−−
'
14
'
4
'
23
'
3
2'
2
1
'
1
219
4
2
RRR
RRR
RR
RR
+=
+=
=
=
Forward Elimination
12572
12143000
319
37100
291
2110
1211
231
−−
−−
−
−−−
'
34
'
4
3'
3
2
'
2
1
'
1
45
3
RRR
RR
RR
RR
+=
=
=
=
41599
4500
197300291
2110
1211
231
−−−−−
−
−−−
344 4RRR +=
12572
12143000
319
37100
291
2110
1211
231
−−
−−
−
−−−
1435721000
319
37100
291
2110
1211
231
−−
−
−−−
121434'
4
3
'
3
2
'
2
1
'
1
−=
=
=
=
RR
RR
RR
RR
Back substitution
29
21
121
23
432
4321
=+−
−=−−+
xxx
xxxx
4
143572
319
37
22
4
4
43
432
=
=
−=−
=+−
x
x
xx
xxx
Gauss - Jourdan
39743
22342
15231
6150
8120
15231
−−
−−−'
13
'
3
'
12
'
2
1
'
1
3
2
RRR
RRR
RR
−=
−=
=
152101
'
21
'
13RRR −=15231
142700
42110
152101
'
23
'
3
2
'
2
211
5
2
3
RRR
RR
RRR
−=
−=
−=
6150
8120
15231
−−
−−−
142700
42110
152101
4100
2010
1001
273'
3
'
32
'
2
'
31
'
1
21
21
−=
−=
−=
RR
RRR
RRR
Warning..
Dua kemungkinan kesalahan-Pembagian dengan nol mungkin terjadi pada langkah forward
elimination. Misalkan:
771021=− xx
655
901.33099.26
7710
321
123
21
=+−
=−+
=−
xxx
xxx
xx
- Kemungkinan error karena round-off (kesalahan pembulatan)
Contoh
Dari sistem persamaan linear
−
−
−
515
6099.23
0710
2
1
x
x
x
6
901.3
7
=
−
−
−
6
901.3
7
515
6099.23
0710
− 515 3x 6
Akhir dari Forward Elimination
−
−
1500500
6001.00
0710
3
2
1
x
x
x
15004
001.6
7
=
− 6515
−
−
15004
001.6
7
1500500
6001.00
0710
Kesalahan yang mungkin terjadi
Back Substitution
99993.015005
150043 ==x
=
−
−
001.6
7
6001.00
0710 1
x
x
5.1 001.0
6001.63
2−=
−
−=
xx
3500.010
07732
1−=
−+=
xxx
=
−
15004
001.6
1500500
6001.00
3
2
x
x
Contoh kesalahan
Bandung-kan solusi exact dengan hasil perhitungan
[ ]
−=
= 1
0
2
1
x
x
X exact
[ ]
−
−
=
=
99993.0
5.1
35.0
3
2
1
x
x
x
X calculated
[ ]
−=
=
1
1
3
2
x
xX exact
Improvements
Menambah jumlah angka penting
Mengurangi round-off error (kesalahan pembulatan)
Tidak menghindarkan pembagian dengan nol
Gaussian Elimination with Partial Pivoting
Menghindarkan pembagian dengan nol
Mengurangi round-off error
Pivoting
Eliminasi Gauss dengan partial pivoting mengubah tata urutan baris
untuk bisa mengaplikasikan Eliminasi Gauss secara Normal
How?
Di awal sebelum langkah ke-k pada forward elimination, temukan angka
pka
Di awal sebelum langkah ke-k pada forward elimination, temukan angka
maksimum dari:
nkkkkk aaa .......,,........., ,1+
Jika nilai maksimumnya Pada baris ke p, ,npk ≤≤
Maka tukar baris p dan k.
Partial Pivoting
What does it Mean?
Gaussian Elimination with Partial Pivoting ensures that each
step of Forward Elimination is performed with the pivoting
element |akk| having the largest absolute value.
Jadi,
Kita mengecek pada setiap langkah apakah angka paling
atas (pivoting element) adalah selalu paling besar
Partial Pivoting: Example
Consider the system of equations
655
901.36099.23
7710
321
21
=+−
=++−
=−
xxx
xxx
xx
655 321 =+− xxx
In matrix form
−
−
−
515
6099.23
0710
3
2
1
x
x
x
6
901.3
7
=
Solve using Gaussian Elimination with Partial Pivoting using five significant
digits with chopping
Partial Pivoting: Example
Forward Elimination: Step 1
Examining the values of the first column
|10|, |-3|, and |5| or 10, 3, and 5
The largest absolute value is 10, which means, to follow the rules
of Partial Pivoting, we don’t need to switch the rows
=
−
−
−
6
901.3
7
515
6099.23
0710
3
2
1
x
x
x
=
−
−
5.2
001.6
7
55.20
6001.00
0710
3
2
1
x
x
x
⇒
Performing Forward Elimination
Partial Pivoting: Example
Forward Elimination: Step 2
Examining the values of the first column
|-0.001| and |2.5| or 0.0001 and 2.5
The largest absolute value is 2.5, so row 2 is switched with row 3
=
−
−
5.2
001.6
7
55.20
6001.00
0710
3
2
1
x
x
x
⇒
=
−
−
001.6
5.2
7
6001.00
55.20
0710
3
2
1
x
x
x
Performing the row swap
Partial Pivoting: Example
Forward Elimination: Step 2
Performing the Forward Elimination results in:
=
−
002.6
5.2
7
002.600
55.20
0710
3
2
1
x
x
x
Partial Pivoting: Example
Back Substitution
Solving the equations through back substitution
1002.6
002.63 ==x
=
−
5.2
7
55.20
0710 1
x
x
002.6
15.2
55.2 2
2 =−
=x
x
010
077 32
1 =−+
=xx
x
=
002.6
5.2
002.600
55.20
3
2
x
x
Partial Pivoting: Example
Compare the calculated and exact solution
The fact that they are equal is coincidence, but it does illustrate
the advantage of Partial Pivoting
[ ]
−=
=
1
1
0
3
2
1
x
x
x
X exact[ ]
−=
=
1
1
0
3
2
1
x
x
x
X calculated
Summary
-Forward Elimination
-Back Substitution
-Pitfalls
-Improvements
-Partial Pivoting