Review Operasi Matriks Menghitung invers matriks? Determinan? Matriks Singular? Menghitung invers matriks c11 c12 a11 a12 c 21 c22 a21
Download
Report
Transcript Review Operasi Matriks Menghitung invers matriks? Determinan? Matriks Singular? Menghitung invers matriks c11 c12 a11 a12 c 21 c22 a21
Review Operasi Matriks
Menghitung invers matriks?
Determinan?
Matriks Singular?
Menghitung invers matriks
c11 c12 a11 a12
c
21 c22 a21 a22
c11a11
c a
11 12
c12 a21
c12 a22
c21a11
c21a12
1 0
0 1
c22 a21
c22 a22
1
0
0
1
Determinan
Hanya untuk square matrices
a b a b
det
ad bc
c d c d
a1 a2 a3
det b1 b2 b3
c1 c2 c3
a1b 2 c3 a1b 3 c2 a2b 3 c1 a2b1 c3 a3b1 c2 a3b 2 c1
Jika determinan = 0 matriks singular,
tidak punya invers
Cari invers nya…
2 4
2 5
1 2
2 4
Sistem Persamaan Linear
Simultaneous Linear Equations
Metode Penyelesaian
•
•
•
•
•
Metode grafik
Eliminasi Gauss
Metode Gauss – Jourdan
Metode Gauss – Seidel
LU decomposition
Metode Grafik
1 2 x1 4
1 1 x 2
2
Det{A} 0 A
is nonsingular
so invertible
Unique
solution
2
-2
Sistem persamaan yang tak
terselesaikan
1 2 x1 4
2 4 x 5
2
No solution
Det [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
1 2 x1 4
2 4 x 8
2
Consistent so solvable
Ill-conditioned system of equations
A linear system
of equations is
said to be “illconditioned” 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.
2 x1 3
x1 1
1
0.48 0.99 x 1.47 x 1
2
2
x1 3
2 x1 3
1
0.49 0.99 x 1.47
x2 0
2
Gaussian Elimination
Merupakan salah satu teknik paling populer
dalam menyelesaikan sistem persamaan
linear dalam bentuk:
AX C
Terdiri dari dua step
1. Forward Elimination of Unknowns.
2. Back Substitution
Forward Elimination
Tujuan Forward Elimination adalah untuk
membentuk matriks koefisien menjadi Upper
Triangular Matrix
5
1
25 5 1 25
64 8 1 0 4.8 1.56
144 12 1 0
0
0.7
Forward Elimination
Persamaan linear
n persamaan dengan n variabel yang tak diketahui
a11x1 a12 x2 a13 x3 ... a1n xn b1
a21x1 a22 x2 a23 x3 ... a2n xn b2
.
.
.
.
.
.
an1x1 an2 x2 an3 x3 ... ann xn bn
Contoh
2 x1 3x2 2 x3 x4 2
2 x1 5 x2 3x3 x4 7
2 x1 x2 3x3 2 x4 1
matriks input
5 x1 2 x2 x3 3x4 8
2
2
2
5
3 2 1 2
5 3 1
7
1 3 2 1
2 1
3
8
Forward Elimination
2
2
2
5
3 2 1 2
5 3 1
7
1 3 2 1
2 1
3
8
1 3
1 1
1
2
2
1
2
9
0 2
0 4
1
3 1
19
1
6
3
0
2
2
R1' R1
2
R2' R2 2 R1'
R3' R3 2 R1'
R4' R4 5 R1'
R1' R1
R2' R2
2
R3' R3 4 R2'
R4' R4 19 R1'
2
1 3
1 1
1
2
2
1
2
9
0 2
0 4
1
3 1
19
1
6
3
0
2
2
1
0
0
0
1 1
1
2
2
9
1
1
1
2
2
0
3
7
19
0 5
9 159
4
4
3
Forward Elimination
1
0
0
0
1
2
1 1
2
0
3
0 5
4
3
1
2
9
1
2
7
19
9 159
4
1
R1' R1
R2' R2
R3'
R3
3
R4' R4 5 R3'
4
1 3
1
1
1
2
2
9
1
1
0 1
2
2
7
19
1
0 0
3
3
143
572
0
0
0
12
12
R1' R1
R2' R2
R3' R3
R4'
R4
143 12
1 3
1
1
1
2
2
9
1
0 1 1 2
2
7
19
1
0 0
3
3
143
572
0
0
0
12
12
1 3
1 1
1
2
2
9
1
1
0 1
2
2
7
19
0
0
1
3
3
572
0
0
0
1
143
Back substitution
x1
x4 4
3 x
2 2
x2
x3
1 x3
2
x3
1 x4
2
x4
7 x4
3
x4
1
9
2
19
3
572
143
Gauss - Jourdan
1 3 2 15
2 4 3 22
3 4 7 39
2 15
1 3
0 2 1 8
0 5 1 6
1 0 1 2 15
0 1 1 2 4
0 0 7 2 14
R1' R1
R2' R2 2 R1'
R3' R3 3R1'
R1' R1 3R2'
R2' R2 2
R3' R3 5 R2'
R1' R1 1 R3'
2
R2' R2 1 R3'
2
R
R3' 3 7 2
2 15
1 3
0 2 1 8
0 5 1 6
1 0 1 2 15
0 1 1 2 4
0 0 7 2 14
1 0 0 1
0 1 0 2
0 0 1 4
Warning..
Dua kemungkinan kesalahan
-Pembagian dengan nol mungkin terjadi pada langkah
forward elimination. Misalkan:
10x1 7 x2 7
6 x3 2.099x2 3x1 3.901
5x1 x2 5x3 6
- Kemungkinan error karena round-off (kesalahan pembulatan)
Contoh
Dari sistem persamaan linear
7 0 x1 7
10
3 2.099 6
x
3
.
901
=
2
5
1 5 x3 6
7 0 7
10
3 2.099 6 3.901
5
1 5 6
Akhir dari Forward Elimination
7
0 x1 7
10
0 0.001
6.001
6
x2 =
0
0
15005 x3 15004
7
0
7
10
0 0.001
6
6
.
001
0
0
15005 15004
Kesalahan yang mungkin terjadi
Back Substitution
7
0 x1 7
10
0 0.001
x 6.001
6
2
0
0
15005 x3 15004
x3
15004
0.99993
15005
6.001 6 x3
x2
1.5
0.001
7 7 x 2 0 x3
x1
0.3500
10
Contoh kesalahan
Bandung-kan solusi exact dengan hasil perhitungan
X exact
X calculated
x1 0
x 2 1
x3 1
x1 0.35
x 2 1.5
x3 0.99993
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
maksimum dari:
akk , ak 1,k ,................, ank
Jika nilai maksimumnya
Maka tukar baris p dan k.
a pk
Pada baris ke p,
k p n,
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
10x1 7 x2 7
3x1 2.099x2 6 x3 3.901
5x1 x2 5x3 6
In matrix form
7 0 x1
7
10
3.901
3 2.099 6 x
2 =
6
5
1 5 x 3
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
Performing Forward Elimination
7 0 x1 7
10
3 2.099 6 x 3.901
2
5
1 5 x3 6
7
0 x1 7
10
0 0.001 6 x 6.001
2
0
2.5
5 x3 2.5
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
Performing the row swap
7
0 x1 7
10
0 0.001 6 x 6.001
2
0
2.5
5 x3 2.5
7
0 x1 7
10
0
x 2.5
2
.
5
5
2
0 0.001 6 x3 6.001
Partial Pivoting: Example
Forward Elimination: Step 2
Performing the Forward Elimination results in:
0 x1 7
10 7
0 2. 5
x 2.5
5
2
0
0 6.002 x3 6.002
Partial Pivoting: Example
Back Substitution
Solving the equations through back substitution
0 x1 7
10 7
0 2. 5
x 2.5
5
2
0
0 6.002 x3 6.002
6.002
x3
1
6.002
2.5 5 x 2
x2
1
2.5
7 7 x 2 0 x3
x1
0
10
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
x1 0
X calculated x2 1
x3 1
X exact
x1 0
x 2 1
x3 1
Summary
-Forward Elimination
-Back Substitution
-Pitfalls
-Improvements
-Partial Pivoting