Hey guys i had a question on simple harmonic motion. so im dealing with a trivial SHM equation which has a non linear term alpha included to the spring force.
$$\frac{d^2x}{dt^2} = -{\omega_0^2}(1 + \alpha x)x$$
I wrote a simple simulation in python using the leapfrog integration scheme and whenever i choose a value for alpha abover 0.5 the solution blows up. so my question is what is the affect that this non linear term alpha is having on the system that makes it blow up like this when its value is increased above this threshold. any insight would be much appreciated
This is a mechanical problem with no dissipation, so energy is conserved. Writing the energy: $$E=\frac12\left(\frac{dx}{dt}\right)^2+V(x)=\text{cste}\qquad\text{with}\quad V(x)=\omega_0^2\left(\frac{x^2}2+\alpha\frac{x^3}3\right).$$ (If you have forgotten your physics, just take the $t$ derivative of the equation I have written to retrieve yours). I am assuming $\alpha>0$; the potential $V(x)$ has a local minimum at $x=0$ and a local maximum at $x=-1/\alpha$. The value of the maximum is $$V_m=V(-1/\alpha)=\frac{\omega_0^2}{6\alpha^2}$$ Then, writing $V(x)\le E$ you clearly see that if the initial conditions are such that $$E<V_m,\qquad\text{and}\quad x_0>-\frac1\alpha$$ then the trajectory remains bounded between the two values of $x>-1/\alpha$ that solves $E=V(x)$. If the conditions I wrote are not met, then $x(t)$ diverges to $-\infty$.
So, I don't know what initial conditions you took, but $\alpha=0.5$ has nothing special.
And, by the way, from the conservation of energy, you can write $t(x)$ explicitely as an integral. It might help...