Python-Examples/runge-kutta-method.py at master · twright ...
https://github.com/twright/Python-Examples/blob/master/runge-kutta-method.pydef runge_kutta ( f, t0, y0, h ): ''' Classical Runge-Kutta method for dy/dt = f (t, y), y (t0) = y0, with step h, and the specified tolerance and max_steps. This function is a generator which can give infinitely many points of the estimated solution, in pairs (t [n], y [n]). To get only finitely many values of the solution we can for example do,