#include <stdio.h>
#include <string.h>
#include <math.h>
#define r 1e+3
#define m0 100e+3
#define g 9.81
main()
{
double m();
double p();
double k;
double dt=1;
double t;
double T;
double x0,x1,x2;
T=1.1*m0*g;
k=m0*g/1000;
x0=0;
x1=1;
printf("0.0000 %f\n", x0);
printf("%f %f\n", dt, x1);
for (t=dt; t<90; t+=dt)
{
x2=(4*m(t)*x1-(2*m(t)-dt*(-r+k*p(x1)))*x0-2*dt*(m(t)*g-T))/(2*m(t)+dt*(-r+k*p(x1)));
x0=x1
x1=x2
print f("%f %f\n", t+dt, x2);
}
}
float m(t)
float t;
{
return(m0-r*t);
}
float p(x)
float x;
{
return(exp(-x/1000));
}
thank you. it calculates rocket launch trajectory