// This is intended to be the general N-body problem with prespecified time duration. // It reports ke, pe & te. // This includes a variable dt. // This version is for the 64 sig bit Pentium (depending on the def of R). // The Runge Kutta scheme. // It is for D dimensions. // This code has the dubious ability to track masses in 4D thru // an inverse square law field. // All of these tests report 0 as momentum, center of mass and angular momentum, // bacause each point is either at the origin, or of negligible mass. #include "h.h" void prx(char * m, pt z[N]){ R E(pt* j){R S=0; for(int m=0; mdv[m].xd); return j->m*S/2;} R e(pt* j, pt* k){R S=0; for(int m=0; mdv[m].x - k->dv[m].x); return - j->m*k->m/sqrtl(S);} {R pe = 0, ke = 0; for(int j=0; jtlim; if (done) dt = tlim-t; kt f(kt y) {kt nv; for(int n=0; n0) printf("qt %d\n", q); if(draw) fclose(out); if(phop>0) {pr("fin"); ri();}} if(!out && draw) qt(6); pr("init"); if(phop>0) ri(); {/*ML*/ typedef struct{short x, y;} px; int nct = -1; R tretic = 0; px v[N]; int ol=200000; R fst = 8; short pc(R x) {if(x<-2.5) return 0; if(x<17.5) return 100*x + 250; return 999;} int cx(px w, int j){px a = v[j]; v[j] = w; return a.x != w.x || a.y != w.y;} do {/* Loop */ if(n>nct) {pr(">"); nct += phop;} if(draw) {void ph(short s){putc(255&(s>>8), out); putc(255&s, out);} if(t > fst) {fclose(out); ++nm[5]; out = fopen (nm, "wb"); if(!out) qt(5); fst += 8;} for(int k=0; ktretic) {for(int k=0; k