Information Technology Articles :: SEO Tips :: WAP Articles :: Search Engine Marketing :: Internet Tips

Goedangilmu

Source Code Metode Trapesium

Posted on May 9th, 2007 in Programming, 284 views

Berikut ini merupakan source code Metode Trapesium yang saya buat menggunakan Delphi.

var
jumlah1,l,xi1,xi2,fxinext,xi,fxi,jumlah,h,a,b,c:real;
n,i:integer;
begin
b:=10;
a:=2;
n:=1000000;
h:=(b-a)/n;
jumlah:=0;
jumlah1:=0;
c:=0;

for i:=0 to n do
begin
if i=0 then
begin
xi:=a;
end
else
begin
xi:=c+h;
end;

fxi:=(5*(xi*xi*xi))/((2*(xi*xi))+(3*xi));

if i=0 then
begin
xi1:=xi+h;
fxinext:=(5*(xi1*xi1*xi1))/((2*(xi1*xi1))+(3*xi1));
l:=(0.5*h)*(fxi+fxinext);
end
else
begin
xi2:=(c+h)+h;
fxinext:=(5*(xi2*xi2*xi2))/((2*(xi2*xi2))+(3*xi2));
l:=(0.5*h)*(fxi+fxinext);
end;

if i
begin
jumlah:=jumlah+l;
end
else
begin
jumlah1:=jumlah1+l;
end;

c:=xi;

if i
begin
memo1.Lines.add(inttostr(i) + chr(vk_tab) + floattostr(xi) + chr(vk_tab) + floattostr(fxi) + chr(vk_tab) + floattostr(l));
end
else
begin
memo1.Lines.add(inttostr(i) + chr(vk_tab) + floattostr(xi) + chr(vk_tab) + floattostr(fxi));
end;
end;
edit1.Text:=floattostr(jumlah);
end;

Related Posts :

Published by Adith

No Comments

Leave a comment