Tulis aja dulu, siapa tahu orang lain butuh :-)

PROGRAM BISECTION MENGGUNAKAN PASCAL 1.5

    Bahasa Madura (Beri', engkok e soroh gebei program bisection angguy Delphi. Yee sah-sosah gempang gebeina, ngerjaagih bi' cakancah medhureh, dapat kodingna, mareh lah. Ambu geluh, cakancah se porron program bisectionna, toreh download e bebeh ria..).


uses wincrt;

label ulang;

var
   x1, x2, x3, y1, y2, y3 : real;
   i : integer;
   pas : char;

begin
    
     ulang :
    
       clrscr;
       writeln('.:: PROGRAM BISECTION ::.');
       writeln('1. Nurul Hidayat     (110411100055)');
       writeln('2. M. Anang Setiawan (110411100060)');
       writeln('3. Ahmad Hidayat     (110411100062)');
       writeln;
       writeln;
       writeln ('Penyelesaian persamaan f(x)=x^3+x^2-3x-3 dengan metode bisection');
      
     repeat
       begin
         writeln ('Masukkan nilai x1: '); readln(x1);
         y1 := x1 * x1 * x1 + x1 * x1 - 3 * x1 - 3;
         writeln('Nilai f(x1)= ',y1:0:7);

         writeln('Masukkan nilai x2: '); readln(x2);
         y2 :=  x2 * x2 * x2 + x2 * x2 - 3 * x2 - 3;
         writeln('nilai f(x2): ', y2:0:7);
       end;

     if (y1 * y2) < 0 then
       writeln ('Syarat nilai OK')
     else
       writeln('Nilai X belum sesuai');
     until (y1 * y2) < 0;

     i := 2;
     writeln;
     writeln('Penyelesaian dengan metode biseksi, Nilai x1= ',x1:0:2, ' & x2= ',x2:0:2);
     writeln('__________________________________________________');
     writeln(' n         x           f(x)            error     ');
     writeln('__________________________________________________');

     repeat
       begin
         i := i + 1;
         x3 := (x1 + x2) / 2;
         y3 := x3 * x3 * x3 + x3 * x3 - 3 * x3 - 3;
         if (i mod 10) = 0 then readln;
         if i < 10 then
           writeln(' ',i,' :: ',x3:0:8,' :: ',y3:0:8,'  ::  ',abs(y3):0:8)
         else
           writeln(i, ' :: ',x3:0:8,' :: ',y3:0:8,'  ::  ',abs(y3):0:8);
         if (y1 * y3) < 0 then
       begin
         x2 := x3;
       end
       else
       begin
         x1 := x3;
       end;
       end;
       until abs(y3) < 1E-07;

       writeln('____________________________');
       writeln('Akar persamaannya = ',x3:0:8);
       writeln('Errornya = ', abs(y3):0:9);
       writeln('____________________________');
       write('Ulangi lagi (y/t): ');
       readln(pas);
       if (pas = 'y') or (pas='Y') then
       begin
         goto ulang;
       end
       else
         write('exit');

end.

Share:

0 komentar:

Post a Comment

ARCHIEV

VISITORS

free counters

FRIENDS

Blog Archive