I have the following two equations ($a,b,c,d,e,f,g$ are constants)
$$\frac{dx_{1}}{dt}=-a-b\sin(c-x_{2})$$
$$(d+x_{1}^{3})\frac{d^{2}x_{2}}{dt^{2}}+ex_{1}^{2}\frac{dx_{1}}{dt}\frac{dx_{2}}{dt}=f(g-x_{1}^{2})\cos (x_{2})$$
and want to integrate it numerically as an initial value problem.
Is the right way to convert this into a first order system of ordinary differential equations (for Runge Kutta integration say) to have 4 first order equations for $x_{1},dx_{1}/dt,x_{2},dx_{2}/dt$? This would mean having to differentiate the first equation above to generate $d^{2}x_{1}/dt^{2}$.
Or the right way is to have 3 first order equations for $x_{1},x_{2},dx_{2}/dt$?
Let's introduce $$x_3 = \frac{dx_2}{dt}.$$ Then:
$$(d+x_{1}^{3})\frac{d^{2}x_{2}}{dt^{2}}+ex_{1}^{2}\frac{dx_{1}}{dt}\frac{dx_{2}}{dt}=f(g-x_{1}^{2})\cos (x_{2}) = \\ (d+x_{1}^{3})\frac{dx_{3}}{dt}+ex_{1}^{2}\frac{dx_{1}}{dt}x_3=f(g-x_{1}^{2})\cos (x_{2}). $$
Isolating $\frac{dx_{3}}{dt}$ on the left, you get:
$$\frac{dx_{3}}{dt}=\frac{f(g-x_{1}^{2})\cos (x_{2}) - ex_{1}^{2}\frac{dx_{1}}{dt}x_3}{d+x_{1}^{3}} \Rightarrow \\ \frac{dx_{3}}{dt}=\frac{f(g-x_{1}^{2})\cos (x_{2}) - ex_{1}^{2}\left(-a-b\sin(c-x_{2})\right)x_3}{d+x_{1}^{3}}. $$
Finally, your system of first order differential equations is:
$$\begin{cases} \displaystyle\frac{dx_{1}}{dt}=-a-b\sin(c-x_{2})\\ \displaystyle\frac{dx_2}{dt} = x_3\\ \displaystyle\frac{dx_{3}}{dt}=\frac{f(g-x_{1}^{2})\cos (x_{2}) - ex_{1}^{2}\left(-a-b\sin(c-x_{2})\right)x_3}{d+x_{1}^{3}} \end{cases}.$$