Blogger news

News Update :
Home » , , » Contoh Program Biseksi (MetNum)

Contoh Program Biseksi (MetNum)


Berikut adalah contoh program Biseksi Metode Numerik dengan menggunakan bahasa pemrograman pascal :
Program Biseksi. koding program, 
program biseksi;

uses crt;
label ulang;
var
x1, x2, x3, y1, y2, y3 : real;
i : integer;
ab : char;
begin
ulang:
clrscr;
writeln (‘Tentukan nilai akar dari persamaan f(x)=x^3+x^2-3x-3=0 dengn Metode biseksi’);
write (‘Masukan nilai x1= ‘);
readln (x1);
y1 := x1*x1*x1+x1*x1-3*x1-3;
writeln (‘Nilai f(x1)= ‘, y1:0:4);
repeat
begin
write (‘masukan nilai x2 = ‘);
readln (x2);
y2 := x2*x2*x2+x2*x2-3*x2-3;
write (‘Nilai f(x2) = ‘, y2:0:4);
end;
if (y1*y2) < 0 then
writeln (‘Syarat Nilai ok’)
else
writeln(‘Nilai x2 Belum Sesuai’);
until (y1*y2) <0;
i := 2;
writeln;
writeln(‘ Penyelesaian Persamaan 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,’ ::’,y3,’ :: ‘,abs( y3 ),’ ::’)
else writeln(i,’ :: ‘,x3,’ :: ‘,y3,’ :: ‘,abs( y3 ),’ ::’);
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);
writeln(‘errornya = ‘,abs( y3 ));
writeln(‘——————————————————————–’);
write(‘Apakah anda ingin mengulanginya (y/t): ‘);
readln(ab);
if (ab=’y') or (ab=’Y') then
begin
goto ulang;
end
else
end.

Program matlab
Share this article :

+ komentar + 2 komentar

19 April 2012 pukul 18.02

Thanks. Tugas qu slesai :-)

29 Maret 2013 pukul 18.35

thanks gan, semoga bermanfaat :)

Posting Komentar

Blogger templates

 
Company Info | Contact Us | Privacy policy | Term of use | Widget | Advertise with Us | Site map
Copyright © 2011. note . All Rights Reserved.
Design Template by panjz-online | Support by creating website | Powered by Blogger