runge-kutta 4-stage implementation for n dimensions
