Pages

Jumat, 02 April 2010

Deferensial Euler

hi lagi... ne yg terbaru sourcecode delphi penyelesaian PDB(persamaan deferensial biasa) menggunakan metode euler...

var Form1: TForm1;
implementation
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var I,M,N:Integer;
H,X,Y,Y1,F:Real;

begin
M:=StrToInt(Edit3.Text);
N:=StrToInt(Edit1.Text);
StringGrid1.RowCount:=2*(N-M)+2;
H:=StrToFloat(Edit2.Text);
StringGrid1.Cells[0,0]:='X';
StringGrid1.Cells[1,0]:='Y';
StringGrid1.Cells[2,0]:='F';
StringGrid1.Cells[3,0]:='Y1';
X:=M;
//------definisi persamaan
Y:=-0.5*X*X*X*X+4*X*X*X-10*X*X+8.5*X+1;
Y1:=Y; for I:=0 to 2*(N-M) do
begin
X:=H*I+M;
Y:=Y1;
F:=-2*X*X*X+12*X*X-20*X+8.5;
Y1:=Y+F*H;

//------------menampilkan hasil
StringGrid1.Cells[0,I+1]:=FloatToStr(X);
StringGrid1.Cells[1,I+1]:=FloatToStr(Y);
StringGrid1.Cells[2,I+1]:=FloatToStr(F);
StringGrid1.Cells[3,I+1]:=FloatToStr(Y1);
end;
end;
end.


enjoy the code....

Tidak ada komentar:

Posting Komentar