Poligon Integral

Senin, 12 April 2010


function fungsi(x,y:real):real;

begin

//result:=4*exp(0.8*x)-0.5*y;

result:=(500-4*y)/(300-2*x)

end;

//BUTTON BERISI METODE POLIGON MODIFIKASI

procedure TForm1.Button1Click(Sender: TObject);

var

x0,xt,n,i:integer;

x,y,xstngah,ystngah,xYstngah:array [1..100] of real;

h:real;

begin

x0:=strtoint(edit1.text);

xt:=strtoint(edit2.text);

x[1]:=strtofloat(edit3.text);

x[2]:=0;

y[1]:=strtofloat(edit4.text);

n:=strtoint(edit5.text);

h:=(xt-x0)/n;

for i:=1 to n do

begin

ystngah[i]:=y[i]+(fungsi(x[i],y[i])*h)/2;

xstngah[i]:=(x[i+1]+x[i])/2;

xYstngah[i]:=fungsi(xstngah[i],ystngah[i]); //Yi+stngah aksen

y[i+1]:=y[i]+xYstngah[i]*h;

x[i+1]:=x[i]+h;

//mengeluarkan pada stringgrid

stringgrid1.cells[0,i]:=inttostr(i);

stringgrid1.cells[1,i]:=floattostr(x[i]);

stringgrid1.cells[2,i]:=floattostr(y[i]);

stringgrid1.Cells[3,i]:=floattostr(fungsi(x[i],y[i]));

stringgrid1.cells[4,i]:=floattostr(ystngah[i]);

stringgrid1.cells[5,i]:=floattostr(xYstngah[i]);

stringgrid1.cells[6,i]:=floattostr(y[i+1]);

label8.caption:='nilai h sebesar '+floattostr(h)+

' dan hasil integral sebesar = ' + floattostr(y[i+1]);

end;

stringgrid1.cells[0,n+1]:=inttostr(n+1);

stringgrid1.cells[1,n+1]:=floattostr(x[n]+h);

stringgrid1.cells[2,n+1]:=floattostr(y[n+1]);

stringgrid1.rowcount:= n+2;

end;

Share this Article on :

0 komentar:

Posting Komentar

LinkWithin

Related Posts Plugin for WordPress, Blogger...
 

© Copyright Ngidup Buat Ngakhirat 2010 -2011 | Design by Herdiansyah Hamzah | Published by Borneo Templates | Powered by Blogger.com.