Metode Numerik & FORTRAN Mata Praktikum: Metode Numerik & FORTRAN Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Pertemuan 5 Metode Sekan … … 2008 Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Daftar Isi I II V VII VI III IV Pendahuluan Metode Sekan Algoritma Sekan Contoh Soal Contoh Program Laporan Akhir Laporan Pendahuluan Pertemuan 6 I II V VII VI III IV Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
PENDAHULUAN I Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
I PENDAHULUAN II Dalam komputasi terkadang sering dihadapkan dengan permasalahan yang berkaiatan dengan analisa terhadap numeril. Salah satunya mencari nilai akar sautu persamaan. Dan untuk mencari akar dari suatu persamaan nonlinier dapat digunakan beberapa metode. Secara metode numerik, dapat digunakan 2 cara : Tanpa menggunakan derivatif (turunan) - Metode Biseksi - Metode Regulafalsi - Metode Sekan - Metode Iterasi titik tetap Menggunakan derivatif (turunan) - Metode Newton-Raphson III IV V VI VII Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
METODE SEKAN II Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
METODE SEKAN II I Metoda Sekan disebut juga metoda interpolasi linier. Dalam prosesnya tidak dilakukan penjepitan akar sehingga [x0,x1] tidak harus mengandung akar, serta f(x0) dan f(x1) bisa bertanda sama. Tarik garis lurus melalui (x0, f(x0)) dan (x1, f(x1)) dan memotong sumbu x di (x2,0) III IV f(x) V x0 x1 x2 x VI VII Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
METODE SEKAN II I Iterasi berikutnya dengan pergeseran : x0 x1 Iterasi berlangsung sampai batas maksimum iterasi atau sampai III IV V VI VII Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
ALGORITMA SEKAN III Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Algoritma Sekan III I II Tentukan x0, x1, T, iterasi maksimum dan F(x) Hitung x2 = x1 – f(x1) (x1 - x0) / [f(x1) – f(x0)] Jika nilai |(x1-x2) / x1| < T, tulis x2 sebagai akar dan akhiri program. Jika tidak, lanjutkan ke langkah berikutnya. Jika jumlah iterasi > iterasi maksimum, akhiri program. x0 = x1 x1 = x2 Kembali ke b III IV V VI VII Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
CONTOH SOAL IV Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Contoh Soal IV I II III V VI VII 1 / 4 1. Cari akar dari f(x) = x3 – 2x – 5, dimana : - x0 = 1 - x1 = 2 - Toleransi (T) = 0,001 atau 10-3 Jawab : Iterasi 1 : III IV V VI VII Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Contoh Soal IV I II III V VI VII 2 / 4 Iterasi 2 : Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Contoh Soal IV I II III V VI VII 3 / 4 Iterasi 3 : Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Contoh Soal IV I II III V VI VII 4 / 4 Iterasi 4 : Karena Tolerasi (T) yang didapat = 0,0005 < 10-3 Jadi, akarnya adalah = 2,095 VII Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Representasi dalam bentuk tabel II Iterasi x0 x1 x2 |(x1-x2) / x1| 1 2 2,2 0,1 2,089 0,051 3 2,094 0,002 4 2,095 0,0005 III IV V VI VII Karena Tolerasi (T) yang didapat = 0,0005 < 10-3 Jadi, akarnya adalah = 2,095 Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
CONTOH PROGRAM V Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Bersambung ke slide berikutnya CONTOH PROGRAM II $ title: Sekan c Contoh program Sekan REAL X0,X1,X2,T INTEGER ORDO, ITER DIMENSION KOEF(20) WRITE (*,’(24(/))’) WRITE (*,’(30X,A)’) ‘Input Persamaan’ WRITE (*,’(30X,A)’) ‘===============’ WRITE (*,*) WRITE (*,’(a,\)’) ‘Orde/Derajat : ’ READ (*,’(I2)’) ORDO III IV V VI VII 1/11 Bersambung ke slide berikutnya Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Bersambung ke slide berikutnya CONTOH PROGRAM II WRITE (*,*) DO 10 I=ORDO+1, 1, -1 WRITE (*,’(A,I2,A,\)’) ‘Koefisien X^’,I-1,‘ = ’ READ (*,’(I3)’) KOEF(I) 10 CONTINUE WRITE (*,*) ‘Persamaan yang diinput : ’ CALL OUTPUT (ORDO,KOEF) PAUSE III IV V VI VII 2/11 Bersambung ke slide berikutnya Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Bersambung ke slide berikutnya CONTOH PROGRAM II WRITE (*,’(24(/))’) WRITE (*,’(20X,A)’) ‘Pencarian Akar Menggunakan Metode Sekan’ WRITE (*,’(20X,A)’) ‘==========================’ WRITE (*,*) CALL OUTPUT(ORDE,KOEF) WRITE (*,’(A,\)’) ‘X0(Batas Bawah) = ’ READ (*,*) X0 WRITE (*,’(A,\)’) ‘X1(Batas Atas) = ’ READ (*,*) X1 III IV V VI VII 3/11 Bersambung ke slide berikutnya Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Bersambung ke slide berikutnya CONTOH PROGRAM II WRITE (*,’(A,\)’) ‘Toleransi Kesalahan = ’ READ (*,*) T WRITE (*,*) X2 = X1 – (FNG(ORDO,KOEF,X1)*(X1-X0))/ - (FNG(ORDO,KOEF,X1)-FNG(ORDO,KOEF,X0)) ITER = 1 WRITE (*,*) ‘ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄ - ÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿’ WRITE (*,'(2(A,3X),7(A,6X),A,3X,A)') '³', - ' ITERASI','³','X0','³','X1','³','X2','³', - 'F(X2)','³’ WRITE (*,*) ‘ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄ - ÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´’ III IV V VI VII 4/11 Bersambung ke slide berikutnya Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Bersambung ke slide berikutnya CONTOH PROGRAM II WHILE (( ABS((X1-X2)/X1) .GT. T) .AND. - ( FNG(ORDO,KOEF,X2) .NE. 0 )) DO WRITE (*,'(A,5X,I3,6X,A,4(1X,F12.7,1X,A))') - '³',ITER,'³',X0,'³',X1,'³',X2,'³', - FNG(ORDO,KOEF,X2),'³' X0 = X1 X1 = X2 X2 = X1 - (FNG(ORDO,KOEF,X1)*(X1-X0))/ - (FNG(ORDO,KOEF,X1)-FNG(ORDO,KOEF,X0)) ITER = ITER + 1 PAUSE ENDWHILE III IV V VI VII 5/11 Bersambung ke slide berikutnya Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Bersambung ke slide berikutnya CONTOH PROGRAM II WRITE (*,'(A,5X,I3,6X,A,4(1X,F12.7,1X,A))') - '³',ITER,'³',X0,'³',X1,'³',X2,'³', - FNG(ORDO,KOEF,X2),'³' WRITE (*,*) 'ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄ - ÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ' WRITE (*,*) WRITE (*,*) 'SOLUSINYA = ',X2 END SUBROUTINE OUTPUT (ORDO,KOEF) DIMENSION KOEF(20) INTEGER ORDO WRITE (*,'(A,\)') 'F(X) = ' III IV V VI VII 6/11 Bersambung ke slide berikutnya Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Bersambung ke slide berikutnya CONTOH PROGRAM II DO 20 I = ORDO + 1, 1, -1 IF (I .GT. 2) THEN IF (KOEF(I) .EQ. (-1)) THEN WRITE (*,'(A,I2,\)') '- X^',I – 1 ELSEIF ((KOEF(I) .NE. 1) .AND. - (KOEF(I) .NE. 0)) THEN WRITE (*,'(I3,A,I2,\)') KOEF(I),'X^',I – 1 ELSEIF (KOEF(I) .NE. 0) THEN WRITE (*,'(A,I2,\)') 'X^',I – 1 ENDIF IF (KOEF(I-1) .GT. 0) THEN WRITE (*,'(A,\)') ' + ‘ III IV V VI VII 7/11 Bersambung ke slide berikutnya Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Bersambung ke slide berikutnya CONTOH PROGRAM II ELSEIF (I .EQ. 2) THEN IF (KOEF(I) .EQ. (-1)) THEN WRITE (*,'(A,\)') '-X ‘ ELSEIF ((KOEF(I) .NE. 1) .AND. - (KOEF(I) .NE. 0)) THEN WRITE (*,'(I3,A,\)') KOEF(I),' X ‘ ELSEIF (KOEF(I) .NE. 0) THEN WRITE (*,'(A,\)') ' X ‘ ENDIF IF (KOEF(I-1) .GT. 0) THEN WRITE (*,'(A,\)') ' + ‘ III IV V VI VII 8/11 Bersambung ke slide berikutnya Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
CONTOH PROGRAM V I II III IV VI VII WRITE (*,'(I3)') KOEF(I) ENDIF 20 CONTINUE END REAL FUNCTION FNG(ORDO,KOEF,MX) INTEGER ORDO DIMENSION KOEF(20) REAL MX FNG = 0 DO 30 I = ORDO + 1, 1, -1 IF (MX .NE. 0) FNG = FNG + (KOEF(I)*MX**(I-1)) 30 CONTINUE RETURN III IV V VI VII 9/11 Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Bersambung ke slide berikutnya CONTOH OUTPUT PROGRAM II Input Persamaan =============== Orde/Derajat : 3 Koefisien X^ 3 = 1 Koefisien X^ 2 = 0 Koefisien X^ 1 = -2 Koefisien X^ 0 = -5 Persamaan yang diinput : F(X) = X^ 3 -2 X -5 III IV V VI VII 10/11 Bersambung ke slide berikutnya Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
CONTOH OUTPUT PROGRAM V I II III IV VI VII 11/11 Pencarian Akar menggunakan Metode Sekan ======================================= F(X) = X^ 3 -2 X -5 X0(Batas Bawah) = 1 X1(Batas Atas) = 2 Toleransi Kesalahan = 0.001 ┌──────────┬───────────┬───────────┬───────────┬───────────────┐ │ ITERASI │ X0 │ X1 │ X2 │ F(X2) │ ├──────────┼───────────┼───────────┼───────────┼───────────────┤ │ 1 │ 1.0000000 │ 2.0000000 │ 2.2000000 │ 1.2480010 │ │ 2 │ 2.0000000 │ 2.2000000 │ 2.0889680 │ -0.0621233 │ │ 3 │ 2.2000000 │ 2.0889680 │ 2.0942330 │ -0.0035534 │ │ 4 │ 2.0889680 │ 2.0942330 │ 2.0945530 │ 0.0000114 │ └──────────┴───────────┴───────────┴───────────┴───────────────┘ Solusinya = 2.0945530 III IV V VI VII 11/11 Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
LAPORAN AKHIR VI Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
I LAPORAN AKHIR II 1. Tuliskan Logika untuk program yang telah ditulis. 2. Logika tidak boleh sama. III IV V VI VII Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
LAPORAN PENDAHULUAN PERTEMUAN 6 Daftar Isi VII LAPORAN PENDAHULUAN PERTEMUAN 6 Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
LAPORAN PENDAHULUAN PERTEMUAN 6 I LAPORAN PENDAHULUAN PERTEMUAN 6 II Sebutkan dan jelaskan metode yang dapat digunakan untuk mencari invers suatu matriks ! Diketahui sebuah matriks : │ 2 3 4 5 6 │ │ 4 6 8 10 12 │ │ 8 12 16 20 24 │ │ 16 24 32 40 48 │ │ 32 48 64 80 96 │ Tentukan : a. Matriks adjoin ? b. Eliminasi Gauus Jordan ? III IV V VI VII Daftar Isi Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.
Sampai bertemu lagi di Pertemuan ke 6 Daftar Isi Sampai bertemu lagi di Pertemuan ke 6 Copyright © 2008. This presentation is dedicated to Laboratorium Informatika Universitas Gunadarma. This presentation is for education purpose only.