#include #include #include #include #define NSTEPS 1000000 float r2(float x, float y); float r(float x, float y); int main(int argc, void *argv[]) { int i; float x[2], v[2]; float dt = 1e-4; float a = 1, e = 0.8, M=1, G = 1, Eo, E, Lo, L; float k1x[2], k2x[2], k3x[2], k4x[2]; float k1v[2], k2v[2], k3v[2], k4v[2]; float xnew[2], f[2], vnew[2]; FILE *out, *outrk4; outrk4 = fopen("outrk4.dat", "w"); out = fopen("out.dat", "w"); x[0] = a*(1+e); x[1] = 0; v[0] = 0; v[1] = sqrt((G*M/a)*(1-e)/(1+e)); Eo = 0.5 * fabs(v[1]); Lo = x[0] * v[1]; for(i=0; i