Runge-Kutta Integrator

November 24, 2016

When I was an undergrad student, I’ve always been fascinated by ODE (Ordinary Differential Equation) numerical integrators. These algorithms are able to solve complex ODE, which can be used to describe - among many other things - the motion of body in space.

Among the various algorythms, I had my favourite: Runge-Kutta. Even though is not symplectic (the preservation of the constants of motions is not guaranteed by contruction), it offers very precise results.

To honour this algorithm, I’ve decided to create a simple webapp to solve second order ODEs using this algorithm. It uses scipy to solve the equation and flask to expose an endpoint. The source code of the webapp can be found here.

Equation

\(\ddot{x} = f(x,\dot{x})\)
\(x(t_0) = x_0\)
\(\dot{x}(t_0) = \dot{x}_0\)

\(f\): \(x_0\): \(\dot{x}_0\):

\(t_0\): \(t_1\): \(dt\):

Note: In the definition of the function, please denote \(\dot{x}\) with x1