As a little summer project I have tried to make a ballistic calculator for when I play football, (following an example from a book), just to learn some numerical methods while doing so. My problem is that I cant seem to find much on the Runge-Kutta 5 method (method recommended) for systems of second order differential equations.

My equations (simplified a bit) is

$ \cfrac{d^2x}{dt^2} = K_x(y) \cdot \sqrt{\dot{x}^2+\dot{y}^2+\dot{z}^2} \cdot \dot{x} + C_x(y) $

$ \cfrac{d^2y}{dt^2} = K_y(y) \cdot \sqrt{\dot{x}^2+\dot{y}^2+\dot{z}^2} \cdot \dot{y} + C_y(y) $

$ \cfrac{d^2z}{dt^2} = K_z(y) \cdot \sqrt{\dot{x}^2+\dot{y}^2+\dot{z}^2} \cdot \dot{z} + C_z(y) $

With the initial conditions being



So far I have proceeded as I usually do when implementing the Runge-Kutta method up to this point (which is just the first step)

$ \cfrac{d^2x}{dt^2} = f(t, x, y, z, \dot{x}, \dot{y}, \dot{z}) $

$ \cfrac{d^2x}{dt^2} = f(t, x, y, z, \dot{x}, \dot{y}, \dot{z}) $

$ \cfrac{d^2x}{dt^2} = f(t, x, y, z, \dot{x}, \dot{y}, \dot{z}) $

How can I proceed from this point? Bonus if someone knows some good literature on the subject.

  • $\begingroup$ Crucial edit made $K (y)$ $\endgroup$
    – Peter
    Aug 17, 2020 at 9:36

1 Answer 1


The reason you don't find something on integrators of higher order ODEs is that you can always convert them to first order ODEs with auxiliary variables.

A equation like $$ \frac{d^2x}{dt^2} = f(t, x, \dot{x}) $$ and $\dot{x}(0)=\dot{x}_0, x(0)=x_0$ can be converted to with an auxiliary variable $\xi$ $$ \frac{dx}{dt} = \xi \\ \frac{d\xi}{dt} = f(t, x, \xi) $$ with initial conditions $\xi(0)=\dot{x}_0$ and $x(0)=x_0$. Now, each equation is first order but you have two equations.

If you write this as a vector this leads to $$ \frac{d}{dt}\left(\begin{array}{c}x\\\xi\end{array}\right) = \left(\begin{array}{c}\xi\\ f(t,x,\xi)\end{array}\right)\\ $$ and you can pass this to your first order ODE integrator of your choice.

  • $\begingroup$ So I will get something like $ \dot{x} = \xi$ $ \dot{y} = \zeta$ $ \dot{z} = \phi$ $ \cfrac{d\xi}{dt} = f1(t, x, y, z, \xi, \zeta, \phi) $ $ \cfrac{d\zeta}{dt} = f2(t, x, y, z, \xi, \zeta, \phi) $ $ \cfrac{d\phi}{dt} = f3(t, x, y, z, \xi, \zeta, \phi) $ $\cfrac{d}{dt} [x, y, z, \xi, \zeta, \phi]^T = [\xi, \zeta, \phi, f1(t, x, y, z, \xi, \zeta, \phi), f1(t....), f1(t....)]^T$ $\endgroup$
    – Peter
    Aug 17, 2020 at 10:31
  • $\begingroup$ yes, you need an auxiliary variable for $\dot{x}$, $\dot{y}$ and $\dot{z}$ in your case. So you end up with a system of 6 equations, which three are trivial. Though your rhs will probably have three different $f_i$. $\endgroup$
    – Bort
    Aug 17, 2020 at 10:33
  • $\begingroup$ As for literature, this is, I believe, in every introductory numerical course / book. $\endgroup$
    – Bort
    Aug 17, 2020 at 10:39
  • 1
    $\begingroup$ There exist dedicated second order solvers, such as the Verlet and higher order symplectic methods, the Beeman methods, the Numerov method. But most of them apply properly only to conservative systems, for instance in molecular dynamics. $\endgroup$ Oct 6, 2020 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.