вот код:
Код
procedure TForm2.Button2Click(Sender: TObject);
var
x:array [1..1000] of real;
y:array [1..1000] of real;
z:array [1..1000] of real;
stop:boolean;
i,n:integer;
r,p1,p0,m1,m0,M,Cd,Dt,U,W,V,sx,sy,sz:real;
scalex, scaley, ymin, ymax, xmin, xmax: double;
begin
r:=StrToInt(edit1.text);
p1:=strtoint(edit7.text);
p0:=strtoint(edit6.text);
m1:=p1*(4/3)*3.14*(sqr(r)*r);
m0:=p0*(2/3)*3.14*(sqr(r)*r);
M:=m0+m1;
Cd:=strtoint(edit8.Text);
Dt:=strtoint(edit9.Text);
x[1]:=strtoint(edit3.Text);
y[1]:=strtoint(edit4.Text);
z[1]:=strtoint(edit5.Text);
n:=5;
stop:=false;
While not stop do
begin
for i:=1 to n do
begin
u:=x[i]/(dt/n);
v:=y[i]/(dt/n);
w:=z[i]/(dt/n);
x[i+1]:=((p0*Cd)/M)*sqr(U-(x[i]-x[i-1])/dt)*(U-(x[i]-x[i-1])/dt)-2*x[i]+x[i-1];
y[i+1]:=((p0*Cd)/M)*sqr(v-(y[i]-y[i-1])/dt)*(v-(y[i]-y[i-1])/dt)-2*y[i]+y[i-1];
z[i+1]:=((p0*Cd)/M)*sqr(w-(z[i]-z[i-1])/dt)*(w-(z[i]-z[i-1])/dt)-2*z[i]+z[i-1];
paintbox1.Canvas.Pixels[round(x[i]),round(z[i])]:=clBlack;
paintbox2.Canvas.Pixels[round(x[i]),round(y[i])]:=clBlack;
paintbox3.Canvas.Pixels[round(y[i]),round(z[i])]:=clBlack;
sx:=sx+u;
sy:=sy+v;
sz:=sz+w;
end;
if n=4 then stop:=true;
end;
label14.Caption:=inttostr(round(sx/n));
label15.Caption:=inttostr(round(sy/n));
label16.Caption:=inttostr(round(sx/n));
end;