I have this system of two differential equations of a second order. I got them from the Euler-Lagrange equations of double pendulum. I need to solve this using the Runge-Kutta numerical method, but my problem is to transform this system to a system of first-order equations.
\begin{align}\ \ddot x_1 (m_1l_1^2+m_2(l_1^2+2l_1l_2\cos(x_2)+l_2^2)) + \ddot x_2 (m_2(l_1l_2\cos(x_2)+l_2^2)) - (2 \dot x_1 \dot x_2+ \dot x_2^2) m_2l_1l_2\sin(x_2) + g(m_1+m_2)l_1\cos(x_1) + gm_2l_2\cos(x_1+x_2) = f_1,\end{align}
$$\ \ddot x_1 (m_2l_1l_2\cos(x_2) + m_2l_2^2) + \ddot x_2 m_2l_2^2 + m_2l_1l_2 \dot x_1^2 \sin(x_2) + gm_2l_2\cos(x_1+x_2) = f_2.$$
I will be glad of your help.