Energy balance for the weakly perturbed double-well oscillator (source code)

= Energy balance for the weakly perturbed double-well oscillator
{title2=$\dot x=y,\quad\dot y=x-x^3+\varepsilon(1-\alpha x^2)y$}

For
$$
H=\frac12y^2-\frac12x^2+\frac14x^4,
$$
the perturbation gives $\dot H=\varepsilon(1-\alpha x^2)y^2$. Along an unperturbed orbit $H=H_0$ with turning points $x_1,x_2$,
$$
\Delta H=2\varepsilon\int_{x_1}^{x_2}
(1-\alpha x^2)
\sqrt{2H_0+x^2-\frac12x^4}dx+O(\varepsilon^2).
$$