This gem includes a framework for numerical integrators, both fixed-step and
adaptive, and includes an excellent sample integrator of each type to get
you started.

It's faster to write such things in C or C++, but better for
portability to keep it in Ruby. I'm using Ruby vector operations
rather than iterating manually so that at least the scalability isn't
too bad...

The Cash-Karp embedded Runge-Kutta 4/5 integrator's code is adapted
from the code in chapter 16 of "Numerical Recipes in C", second
edition. Adapting this stuff to Ruby and to OO operation is all done
ad-hoc and by me.