<s>[INST] Solving ${d^2 x \over dt^2}=-\omega^2x +\alpha x^2,$ On solving a Lagrangian, I obtained the Lagrangian equation of motion as
$${d^2 x \over dt^2}=-\omega^2x +\alpha x^2,$$  Where $\omega$ and $\alpha$ are constants and t is the time.
Could anyone please help me to find an analytic solution to this differential equation?
My attempt
Multiplying both sides with $\dot x$, we get
$$\dot x {d\dot x\over dt}=(\alpha x^2-\omega^2 x){dx\over dt}$$
gives
$${1\over2} {d(\dot x)^2\over dt}=(\alpha x^2-\omega^2 x){dx\over dt}$$
gives
$${1\over2} d(\dot x)^2=(\alpha x^2-\omega^2 x)dx$$
gives
$$(\dot x)^2={2\over 3}\alpha x^3-\omega^2x^2$$
Could anyone please assist me to move further
Thanks in advance
 [/INST] Writing the ode as
\begin{align*}
              x^{\prime \prime}&=\left(\alpha  x-\omega^{2}\right) x
\end{align*}
Multiplying both sides by $x^{\prime}$ gives
\begin{align*}
              x^{\prime} x^{\prime \prime}&=\left(\alpha  x-\omega^{2}\right) x x^{\prime}
\end{align*}
Integrating both sides w.r.t. $t$ gives
\begin{align*}
\int{x^{\prime} x^{\prime \prime}\, \mathrm{d}t}  &=\int{\left(\alpha  x-\omega^{2}\right) x x^{\prime}\, \mathrm{d}t}\\ 
\int{x^{\prime} x^{\prime \prime}\, \mathrm{d}t}  &=\int{\left(\alpha  x-\omega^{2}\right) x\, \mathrm{d}x} \tag{1}                
\end{align*}
But
$$
\int{x^{\prime} x^{\prime \prime}\, \mathrm{d}t} = \frac{1}{2} \left(x^{\prime}\right)^2
$$
Hence equation (1)  becomes
\begin{align*}
            \frac{1}{2} \left(x^{\prime}\right)^2  &=\int{\left(\alpha  x-\omega^{2}\right) x\, \mathrm{d}x} \tag{2}                
\end{align*}
But
$$
              \int{\left(\alpha  x-\omega^{2}\right) x\, \mathrm{d}x} = \frac{1}{3} \alpha  \,x^{3}-\frac{1}{2} \omega^{2} x^{2}
$$
Therefore  equation (2)  becomes
\begin{align*}
               \frac{1}{2} \left(x^{\prime}\right)^2  &=\frac{1}{3} \alpha  \,x^{3}-\frac{1}{2} \omega^{2} x^{2} + c_2
\end{align*}
Where $c_2$ is an arbitrary constant of integration.
This is first order ODE which is now solved for $x$.
Solving for $x^{\prime}$ gives
\begin{align*}
x^{\prime}&=\frac{\sqrt{6 \alpha  x^{3}-9 \omega^{2} x^{2}+18 c_{2}}}{3}\tag{1} \\ 
x^{\prime}&=-\frac{\sqrt{6 \alpha  x^{3}-9 \omega^{2} x^{2}+18 c_{2}}}{3}\tag{2} 
\end{align*}
These are separable. So just need to do integrtion. But there does not
seem to be closed form solution to these elliptical type integrals. At least Maple could not do it. Integrating using Maple gives
$$
x_1(t) = \int_{0}^{x(t)}\frac{3}{\sqrt{6 \textit{_a}^{3} \alpha -9 \textit{_a}^{2} \omega^{2}+18 c_{2}}}d \textit{_a} -t -c_{1} = 0
$$
Similarly to the other ode.
$$
x_2(t) = \int_{0}^{x(t)}-\frac{3}{\sqrt{6 \textit{_a}^{3} \alpha -9 \textit{_a}^{2} \omega^{2}+18 c_{2}}}d \textit{_a} -t -c_{1} = 0
$$
</s>