#include #include "rk4.h" /*------------------------------------------------------------------------------ One step of 4th order Runge-Kutta integrator. Integrates a set of ny equations dy -- = f[x, y] dx from x0 to x1. */ int rk4(derivf deriv, double x0, double x1, int ny, double *y0, double *y1, void *pass) { double dx; double *f0, *f1, *f2, *f3; f0 = (double *) malloc(ny * sizeof(double)); f1 = (double *) malloc(ny * sizeof(double)); f2 = (double *) malloc(ny * sizeof(double)); f3 = (double *) malloc(ny * sizeof(double)); dx = x1 - x0; free(f0); free(f1); free(f2); free(f3); }