#include #include #include #include "rk4.h" int deriv(double, int, double *, double *, void *); /*------------------------------------------------------------------------------ Main routine to test Runge-Kutta integrator. */ int main(int argc, char *argv[]) { int istep, nstep, ny; double x0, x1; double *y0, *y1; /* length of y vector */ ny = 1; y0 = malloc(ny * sizeof(double)); y1 = malloc(ny * sizeof(double)); /* loop calls to RK routine */ for (istep = 0; istep < nstep; istep++) { /* Runge-Kutta step */ rk4(&deriv, x0, x1, ny, y0, y1, 0x0); } return(0); } /*------------------------------------------------------------------------------ dydx = - y */ int deriv(double x, int ny, double *y, double *dydx, void *pass) { }