Simultaneous Linear Equations
Gauss-Seidel Method
Adalah metode ITERASI
Prosedur dasar:
- Menyelesaikan tiap persamaan linier secara aljabar untuk xi - Menyelesaikan tiap persamaan linier secara aljabar untuk xi - Membuat nilai asumsi solusi
- Selesaikan untuk tiap xi dan ulangi
- Gunakan perkiraan kesalahan relatif tiap akhir iterasi untuk mengecek apakah error sudah mencapai angka toleransi.
Gauss-Seidel Method
Kenapa?
Untuk mengatasi round-off error (kesalahan pembulatan).
Metode eliminasi seperti Gaussian Elimination and LU Decomposition(*) rawan terhadap kesalahan pembulatan.
Gauss-Seidel Method
Algorithm
Sistem persamaan linier1 1 3 13 2 12 1 11
x
a
x
a
x
...
a
x
b
a
+
+
+
+
n n=
2 3 23 2 22 1 21x
a
x
a
x
...
a
x
b
a
21x
1+
a
22x
2+
a
23x
3+
...
+
a
2nx
n=
b
2a
+
+
+
+
2n n=
n n nn n n nx
a
x
a
x
a
x
b
a
1 1+
2 2+
3 3+
...
+
=
. . . .. . Kita mengubah sistem
persamaan [A]{X}={B} untuk menyelesaikan x1
dengan persamaan pertama, menyelesaikan x2 dengan persamaan kedua, dan seterusnya.
Gauss-Seidel Method
Algorithm
General Form of each equation
1 1 1
a
x
c
n j j j∑
=−
1 , 1 1 = − −−
∑
n j j j n na
x
c
11 1 1 1a
x
j j∑
≠ ==
22 2 1 2 2 2a
x
a
c
x
j n j j j∑
≠ =−
=
1 , 1 1 1 1 − − − ≠ = −=
n n n j j na
x
nn n n j j j nj n na
x
a
c
x
∑
≠ =−
=
133 2 32 1 31 3 3 22 3 23 1 21 2 2 11 3 13 2 12 1 1
a
x
a
x
a
b
x
a
x
a
x
a
b
x
a
x
a
x
a
b
x
−
−
=
−
−
=
−
−
=
Menjadi:
Untuk sistem
persamaan 3x3
33a
Now we can start the solution process by choosing
guesses for the x’s. A simple way to obtain initial
guesses is to assume that they are zero. These zeros
can be substituted into x
1equation to calculate a new
x
1=b
1/a
11.
New x1 is substituted to calculate x2 and x3. The procedure is repeated until the convergence criterion is satisfied:
Batas akhir iterasi
kan diperkenan baru lama i baru i i a
x
x
x
ε
ε
=
−
×
100
p
baru i ix
=
=
t aε
ε
asebagai galat absolut.pproximation error, sering digunakan, seringkali disebutTrue error, kurang berarti. digunakan Relative error, dalam prosentase
Gauss-Seidel Method: Example 1
Diketahui sistem persamaan
=
2
.
279
2
.
177
8
.
106
1
12
144
1
8
64
1
5
25
3 2 1a
a
a
144
12
1
a
3279
.
2
Initial Guess: asumsi nilai awal,
=
5
2
1
3 2 1a
a
a
Gauss-Seidel Method: Example 1
Tulis ulang untuk aplikasi
Gauss-Seidel
25 5 1 a 106.825
5
8
.
106
2 3 1a
a
a
=
−
−
= 2 . 279 2 . 177 8 . 106 1 12 144 1 8 64 1 5 25 3 2 1 a a a8
64
2
.
177
1 3 2a
a
a
=
−
−
1
12
144
2
.
279
1 2 3a
a
a
=
−
−
Gauss-Seidel Method: Example 1
Masukkan nilai perkiraan awal untuk selesaikan a
i
=
2
1
1a
a
6720
.
3
25
)
5
(
)
2
(
5
8
.
106
a
1=
−
−
=
(
3
.
6720
) ( )
5
64
2
.
177
−
−
=
5
2
3 2a
a
(
) ( )
8510
.
7
8
5
6720
.
3
64
2
.
177
a
2=
−
−
=
−
(
)
(
)
36
.
155
1
8510
.
7
12
6720
.
3
144
2
.
279
a
3=
−
−
−
=
−
Initial GuessGauss-Seidel Method: Example 1
Finding the absolute relative approximate error
100
x
x
x
new i old i new i i a×
−
=
ε
At the end of the first iteration − = 8510 . 7 6720 . 3 1 a a % 76 . 72 100 x 6720 . 3 0000 . 1 6720 . 3 1 = − = εa % 47 . 125 100 x 8510 . 7 0000 . 2 8510 . 7 2 − = − − = εa % 22 . 103 100 x 36 . 155 0000 . 5 36 . 155 3 − = − − = εa
The maximum absolute relative approximate error is 125.47% − − = 155.36 8510 . 7 3 2 a a
Gauss-Seidel Method: Example 1
Iteration #2
Using
−
−
=
36
.
155
8510
.
7
6720
.
3
2 1a
a
a
(
)
056
.
12
25
36
.
155
8510
.
7
5
8
.
106
1=
−
−
−
=
a
the values of ai are found:
−
a
3155
.
36
25
(
)
882 . 54 8 36 . 155 056 . 12 64 2 . 177 2 = − − − = a(
)
(
)
34 . 798 1 882 . 54 12 056 . 12 144 2 . 279 3 = − − − − = a from iteration #1Gauss-Seidel Method: Example 1
Hitung “the absolute relative approximate error”
% 542 . 69 100 x 056 . 12 6720 . 3 056 . 12 1 = − =
∈a Akhir iterasi kedua
−
=
882
.
54
056
.
12
2 1a
a
(
)
% 695 . 85 100 x 882 . 54 8510 . 7 882 . 54 2 − = − − − = ∈a(
)
% 54 . 80 100 x 34 . 798 36 . 155 34 . 798 3 − = − − − = ∈a
−
−
=
798
.
34
882
.
54
3 2a
a
Gauss-Seidel Method: Example 1
Tersukan iterasi, kita dapatkan nilai berikut.
Iteration a 1 a2 a3 1 2 3 3.672 12.056 47.182 72.767 67.542 74.448 -7.8510 -54.882 -255.51 125.47 85.695 78.521 -155.36 -798.34 -3448.9 103.22 80.540 76.852
%
1 a∈
% 2 a ∈%
3 a∈
3 4 5 6 47.182 193.33 800.53 3322.6 74.448 75.595 75.850 75.907 -255.51 -1093.4 -4577.2 -19049 78.521 76.632 76.112 75.971 -3448.9 -14440 -60072 -249580 76.852 76.116 75.962 75.931Gauss-Seidel Method: Pitfall
Salahnya dimana?
Contoh tadi mengilustrasikan kemungkinan kesalahan pada Gauss-Siedel method: tidak semua sistem persamaan akan konvergen.
Is there a fix? Is there a fix?
One class of system of equations always converges: One with a diagonally dominant coefficient matrix.
Diagonally dominant: [A] in [A] [X] = [C] is diagonally dominant if:
∑
≠ =≥
n j j ija
a
i 1 ii∑
≠ =〉
n i j j ij iia
a
1Untuk semua ‘i’ ; DAN Untuk minimal sebuah ‘i’
Gauss-Seidel Method: Pitfall
Diagonally dominant: Koefisien pada diagonal harus sama atau lebih besar dari jumlah semua koefisien pada baris itu, dan minimal satu baris harus
memiliki diagonal yang lebih besar dari jumlah koefisien pada baris itu.
Manakah matriks yang diagonally dominant?
[ ]
= 1 16 123 1 43 45 34 81 . 5 2 A = 129 34 96 5 53 23 56 34 124 ] B [Gauss-Seidel Method: Example 2
Sistem persamaan linier
1 5x -3x 12x 1 + 2 3 =
28
3x
5x
x
1+
2+
3=
76
13x
7x
3x
1+
2+
3=
Matriks Koefisien nya adalah
[ ]
−
=
1
5
3
5
3
12
A
76
13x
7x
3x
1+
2+
3=
=
1
0
1
3 2 1x
x
x
Dengan asumsi nilai awal
3
7
13
Gauss-Seidel Method: Example 2
[ ]
− = 13 7 3 3 5 1 5 3 12 ACek apakah matriks nya diagonally dominant
4
3
1
5
5
21 23 22=
=
≥
a
+
a
=
+
=
a
10
7
3
13
13
=
≥
+
=
+
=
=
a
a
a
8
5
3
12
12
12 13 11=
=
≥
a
+
a
=
+
−
=
a
3 7 1310
7
3
13
13
31 32 33=
=
≥
a
+
a
=
+
=
a
Gauss-Seidel Method: Example 2
= − 76 28 1 13 7 3 3 5 1 5 3 12 3 2 1 a a aTulis ulang
5
3
1
−
x +
x
Asumsi nilai awal
= 1 0 1 3 2 1 x x x
12
5
3
1
2 3 1x
x
x
=
−
+
5
3
28
1 3 2x
x
x
=
−
−
13
7
3
76
1 2 3x
x
x
=
−
−
( ) ( )
50000 . 0 12 1 5 0 3 1 1 = + − = x( ) ( )
9000 . 4 5 1 3 5 . 0 28 2 = − − = x(
) (
)
0923 . 3 13 9000 . 4 7 50000 . 0 3 76 3 = − − = xGauss-Seidel Method: Example 2
The absolute relative approximate error
%
662
.
67
100
50000
.
0
0000
.
1
50000
.
0
1 a×
=
−
=
∈
0
9000
.
4
−
%
00
.
100
100
9000
.
4
0
9000
.
4
2 a×
=
−
=
∈
%
662
.
67
100
0923
.
3
0000
.
1
0923
.
3
3 a×
=
−
=
∈
Gauss-Seidel Method: Example 2
Setelah iterasi #1
Masukkan nilai x pada persamaan
Setelah iterasi #2
= 0923 . 3 9000 . 4 5000 . 0 3 2 1 x x x = 8118 . 3 7153 . 3 14679 . 0 3 2 1 x x x
(
) (
)
14679 . 0 12 0923 . 3 5 9000 . 4 3 1 1 = + − = x(
) (
)
7153 . 3 5 0923 . 3 3 14679 . 0 28 2 = − − = x(
) (
)
8118 . 3 13 900 . 4 7 14679 . 0 3 76 3 = − − = xGauss-Seidel Method: Example 2
Galat absolut dari Iterasi #2
% 62 . 240 100 14679 . 0 50000 . 0 14679 . 0 1 × = − = ∈a
%
887
.
31
100
7153
.
3
9000
.
4
7153
.
3
2×
=
−
=
∈
a100
31
.
887
%
7153
.
3
2=
×
=
∈
a%
876
.
18
100
8118
.
3
0923
.
3
8118
.
3
3×
=
−
=
∈
aGalat absolut maksimum 240.62%
Gauss-Seidel Method: Example 2
Ulangi iterasi, didapatkanK
1 a ε 2 a
ε
3 aε
Iteration a1 a2 a3 1 2 3 0.50000 0.14679 0.74275 67.662 240.62 80.23 4.900 3.7153 3.1644 100.00 31.887 17.409 3.0923 3.8118 3.9708 67.662 18.876 4.0042 3 4 5 6 0.74275 0.94675 0.99177 0.99919 80.23 21.547 4.5394 0.74260 3.1644 3.0281 3.0034 3.0001 17.409 4.5012 0.82240 0.11000 3.9708 3.9971 4.0001 4.0001 4.0042 0.65798 0.07499 0.00000 = 4 3 1 3 2 1 x x x = 0001 . 4 0001 . 3 99919 . 0 3 2 1 x x xLatihan
Sistem persamaan linier
76
13x
7x
3x
1
+
2
+
3
=
=
+
+
5x
3x
28
x
1+
2+
3=
1
5x
-3x
12x
1
+
2
3
=
With an initial guess of
= 1 0 1 2 1 x x x
Gauss-Seidel Method
The Gauss-Seidel Method can still be used
The coefficient matrix is not
diagonally dominant
[ ]
−
=
5
3
12
3
5
1
13
7
3
A
But this is the same set of equations used in example #2, which did
converge.
[ ]
− = 13 7 3 3 5 1 5 3 12 AIf a system of linear equations is not diagonally dominant, check to see if rearranging the equations can form a diagonally dominant matrix.
Gauss-Seidel Method
Not every system of equations can be rearranged to have a diagonally dominant coefficient matrix.
Observe the set of equations
3
3 2 1+
x
+
x
=
x
1+
x
2+
x
3=
3
x
9
4
3
2
x
1+
x
2+
x
3=
9
7
2 3 1+
x
+
x
=
x
Which equation(s) prevents this set of equation from having a diagonally dominant coefficient matrix?
Gauss-Seidel Method
Summary
-Advantages of the Gauss-Seidel Method
-Algorithm for the Gauss-Seidel Method
-Pitfalls of the Gauss-Seidel Method
Gauss-Seidel Method
Questions?
Questions?
Metode Penyelesaian
Metode grafik
Eliminasi Gauss
Metode Gauss – Jourdan
Metode Gauss – Seidel
LU Decomposition
A=LU
Ax=b ⇒LUx=b
Define Ux=y
Ly=b
Solve y by forward substitution
Ux=y
Solve x by backward substitution
LU Decomposition by Gaussian
elimination
) 2 ( ) 2 ( ) 2 ( ) 1 ( 1 ) 1 ( 13 ) 1 ( 12 ) 1 ( 11 0 0 0 0 1 0 0 0 0 1 n a a a a a a a m L L LThere are infinitely many different ways to decompose A.
Most popular one: U=Gaussian eliminated matrix
L=Multipliers used for elimination
= − − − − − − ) ( ) ( 1 ) ( 1 1 ) 3 ( 3 ) 3 ( 33 ) 2 ( 2 ) 2 ( 23 ) 2 ( 22 4 , 3 , 2 , 1 , 3 , 1 2 , 1 1 , 1 2 , 3 1 , 3 1 , 2 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 1 n nn n n n n n n n n n n n n n n n a a a a a a a a m m m m m m m m m m A M O M M M L L L M L M O O M M L L