Delphi Code

procedure TForm1.BtnCalcClick(Sender: TObject);
var
mass1, mass2, g, A, Cdrag, rho, t, thrust, impulse, vel, altburn, altcoast, alt, coasttime : Real;
k, q, holder, qa, qb : Real;
in1, in2, in3, in4 : Real;
begin
in1 := strtofloat(EdtMr.Text);
in2 := strtofloat(EdtMrb.Text);
in3 := strtofloat(EdtMra.Text);
in4 := strtofloat(EdtRad.Text);

thrust := strtofloat(EdtT.Text);
impulse := strtofloat(EdtI.Text);

mass1 := (in2 + in3)/2;
mass2 := in3;
A := 3.14159*in4*in4;

g := 9.81;
Cdrag := 0.75;
rho := 1.22;

k := 0.5*rho*Cdrag*A;
q := sqrt((thrust - mass1*g)/k);
holder := (2*k*q)/mass1;
t := impulse/thrust;
vel := q*((1 - power(2.71828183, (-holder*t)))/(1 + power(2.71828183, (-holder*t))));
altburn := (-mass1/(2*k))*ln((thrust - mass1*g - k*vel*vel)/(thrust - mass1*g));

altcoast := (mass2/(2*k))*ln((mass2*g + k*vel*vel)/(mass2*g));
qa := sqrt((mass2*g)/k);
qb := sqrt((g*k)/mass2);
coasttime := (arctan(vel/qa))/qb;

alt := altburn + altcoast;

MemAnswer.Text := '';

MemAnswer.Lines.Add('average mass during boost: ' + floattostr(mass1));
MemAnswer.Lines.Add('mass during coast: ' + floattostr(mass2));
MemAnswer.Lines.Add('rocket cross section area: ' + floattostr(A));
MemAnswer.Lines.Add('motor burn time: ' + floattostr(t));
MemAnswer.Lines.Add('burnout velocity: ' + floattostr(vel));
MemAnswer.Lines.Add('altitude at burnout: ' + floattostr(altburn));
MemAnswer.Lines.Add('coasting distance: ' + floattostr(altcoast));
MemAnswer.Lines.Add('peak altitude: ' + floattostr(alt));
MemAnswer.Lines.Add('coasting time: ' + floattostr(coasttime));

MemAnswer.Lines.Add('other info below');
MemAnswer.Lines.Add('k: ' + floattostr(k));
MemAnswer.Lines.Add('q: ' + floattostr(q));
MemAnswer.Lines.Add('x: ' + floattostr(holder));
MemAnswer.Lines.Add('q(a): ' + floattostr(qa));
MemAnswer.Lines.Add('q(b): ' + floattostr(qb));

end;