# Tag Info

The total energy as a function of time is a constant and it is always equal to the potential energy in the point where $x=x_{max}$ and $v = 0$. The total energy is the work done to bring the free end of the spring from $0$ to $x_{max}$. So $E(t) = E = Work = kx_{max}^2/2 + ax_{max}^4/4$ You simply integrate $f(x)$ from $0$ to $x_{max}$
Hint: Use $$m\ddot{x}=-kx-x^3 \\\ddot{x}=v\frac{dv}{dx} \\-\frac{kx^2}{2}-\frac{ax^4}{4}=\frac{m}{2}\left(\frac{dx}{dt}\right)^2$$ It will reduce to a form $$\frac{dx}{dt}=ix\sqrt{c^2+x^2}$$ This is a standard integral, and can be solved, then use $$U=-\int f(x) dx \\T=\frac{1}{2}m\dot{x}^2$$ Total energy $E=T+U\; .$