• Tidak ada hasil yang ditemukan

Simultaneous Linear Equations

N/A
N/A
Protected

Academic year: 2021

Membagikan "Simultaneous Linear Equations"

Copied!
36
0
0

Teks penuh

(1)

Simultaneous Linear Equations

(2)

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.

(3)

Gauss-Seidel Method

Kenapa?

Untuk mengatasi round-off error (kesalahan pembulatan).

Metode eliminasi seperti Gaussian Elimination and LU Decomposition(*) rawan terhadap kesalahan pembulatan.

(4)

Gauss-Seidel Method

Algorithm

Sistem persamaan linier

1 1 3 13 2 12 1 11

x

a

x

a

x

...

a

x

b

a

+

+

+

+

n n

=

2 3 23 2 22 1 21

x

a

x

a

x

...

a

x

b

a

21

x

1

+

a

22

x

2

+

a

23

x

3

+

...

+

a

2n

x

n

=

b

2

a

+

+

+

+

2n n

=

n n nn n n n

x

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.

(5)

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 n

a

x

c

11 1 1 1

a

x

j j

≠ =

=

22 2 1 2 2 2

a

x

a

c

x

j n j j j

≠ =

=

1 , 1 1 1 1 − − − ≠ = −

=

n n n j j n

a

x

nn n n j j j nj n n

a

x

a

c

x

≠ =

=

1

(6)

33 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

33

a

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

1

equation to calculate a new

x

1

=b

1

/a

11

.

(7)
(8)

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 i

x

=

=

t a

ε

ε

asebagai galat absolut.pproximation error, sering digunakan, seringkali disebut

True error, kurang berarti.  digunakan Relative error, dalam prosentase

(9)

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 1

a

a

a













144

12

1

a

3

279

.

2

Initial Guess: asumsi nilai awal,

=

5

2

1

3 2 1

a

a

a

(10)

Gauss-Seidel Method: Example 1

Tulis ulang untuk aplikasi

Gauss-Seidel

      25 5 1 a 106.8

25

5

8

.

106

2 3 1

a

a

a

=

          =                     2 . 279 2 . 177 8 . 106 1 12 144 1 8 64 1 5 25 3 2 1 a a a

8

64

2

.

177

1 3 2

a

a

a

=

1

12

144

2

.

279

1 2 3

a

a

a

=

(11)

Gauss-Seidel Method: Example 1

Masukkan nilai perkiraan awal untuk selesaikan a

i

=

2

1

1

a

a

6720

.

3

25

)

5

(

)

2

(

5

8

.

106

a

1

=

=

(

3

.

6720

) ( )

5

64

2

.

177

=

5

2

3 2

a

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 Guess

(12)

Gauss-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

(13)

Gauss-Seidel Method: Example 1

Iteration #2

Using

=

36

.

155

8510

.

7

6720

.

3

2 1

a

a

a

(

)

056

.

12

25

36

.

155

8510

.

7

5

8

.

106

1

=

=

a

the values of ai are found:



−





a

3

155

.

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 #1

(14)

Gauss-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 1

a

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 2

a

a

(15)

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.931

(16)

Gauss-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 ij

a

a

i 1 ii

≠ =

n i j j ij ii

a

a

1

Untuk semua ‘i’ ; DAN Untuk minimal sebuah ‘i’

(17)

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 [

(18)

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 1

x

x

x

Dengan asumsi nilai awal

3

7

13

(19)

Gauss-Seidel Method: Example 2

[ ]

          − = 13 7 3 3 5 1 5 3 12 A

Cek 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 13

10

7

3

13

13

31 32 33

=

=

a

+

a

=

+

=

a

(20)

Gauss-Seidel Method: Example 2

          =                     − 76 28 1 13 7 3 3 5 1 5 3 12 3 2 1 a a a

Tulis ulang

5

3

1

x +

x

Asumsi nilai awal

          =           1 0 1 3 2 1 x x x

12

5

3

1

2 3 1

x

x

x

=

+

5

3

28

1 3 2

x

x

x

=

13

7

3

76

1 2 3

x

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 = − − = x

(21)

Gauss-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

×

=

=

(22)

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 = − − = x

(23)

Gauss-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

×

=

=

a

100

31

.

887

%

7153

.

3

2

=

×

=

a

%

876

.

18

100

8118

.

3

0923

.

3

8118

.

3

3

×

=

=

a

Galat absolut maksimum 240.62%

(24)

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 x

(25)

Latihan

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

(26)

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 A

If a system of linear equations is not diagonally dominant, check to see if rearranging the equations can form a diagonally dominant matrix.

(27)

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?

(28)

Gauss-Seidel Method

Summary

-Advantages of the Gauss-Seidel Method

-Algorithm for the Gauss-Seidel Method

-Pitfalls of the Gauss-Seidel Method

(29)

Gauss-Seidel Method

Questions?

Questions?

(30)

Metode Penyelesaian



Metode grafik



Eliminasi Gauss



Metode Gauss – Jourdan



Metode Gauss – Seidel

(31)

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

(32)

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 L

There 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

Compact storage:

The diagonal entries of L matrix are all 1’s,

they don’t need to be stored. LU is stored in a single matrix.

(33)

NEXT: Solusi persamaan Non Linier



Persamaan matematis yang sulit diselesaikan

dengan “tangan”  analitis, sehingga diperlukan

penyelesaian pendekatan  numerik



Metode Numerik: Teknik menyelesaikan masalah

matematika dengan pengoperasian hitungan,

matematika dengan pengoperasian hitungan,

umumnya mencakup sejumlah besar kalkulasi

aritmetika yang sangat banyak dan menjenuhkan



Diselesaikan dengan algoritma (serangkaian

perintah untuk menyelesaikan masalah), sehingga

diperlukan bantuan komputer untuk

(34)

Sumber Galat / Error



Kesalahan pemodelan

contoh: penggunaan hukum Newton

asumsi benda adalah partikel



Kesalahan bawaan



Kesalahan bawaan

contoh: kekeliruan dlm menyalin data

salah membaca skala



Ketidaktepatan data



Kesalahan pemotongan / penyederhanaan

persamaan(truncation error)

(35)

Solusi Persamaan Non Linear

1)Metode Akolade (bracketing method)

/ Closed method

• Metode Bagi dua (Bisection Method)

• Metode Regula Falsi (False Position

Method)

• Metode Grafik

Keuntungan: selalu konvergen

(36)

Solusi Persamaan Non Linear

2) Metode Terbuka

Contoh:

• Iterasi Titik-Tetap (Fix Point Iteration)

• Metode Newton-Raphson

• Metode Newton-Raphson

• Metode Secant

Keuntungan: cepat konvergen

Referensi

Dokumen terkait

Kemudian hitunglah lagi nilai akar kuadrat dari 10Cos(2NK/100) dengan menggunakan metode Tabel.. Gunakan toleransi kesalahan sebesar 10 -3 dan angka

Metode biseksi dengan tolerasi error 0.001 dibutuhkan 10 iterasi, semakin teliti (kecil toleransi errornya) maka semakin besar jumlah iterasinya.. Metode

The proposed Jacobi-SR based uniform adaptive hybrid algorithm, inherently, can be implemented in parallel processing environment efficiently.. Whereas Gauss-Seidel-SR based hybrid

To solve the large system of linear equation, the solutions can be obtained by three iterative methods which are Jacobi‐Davidson JD method, Gauss‐Seidel GS method and Successive