# Stability of Euler-Cromer method

Euler method doesn't perform well in the context of oscillatory problems like the harmonic oscillator; the amplitude of the oscillation gets bigger with time, which clearly contradicts theory as no energy is being added into the system.

For instance, consider a simple pendulum of length $$l$$ and mass $$m$$. It can be proven that given the following difference equations

$$\begin{cases} \omega_{i+1} = \omega_{i}-\frac{g}{l}\theta_i \Delta t \\ \theta_{i+1} = \theta_i+\omega_i\Delta t \end{cases}$$

where $$\theta$$ is the angle, $$\omega = \dot{\theta}$$ the angular velocity and $$\Delta t$$ the time-step, the mechanical energy of the system is

$$$$E_{i+1} = E_{i} + \frac{1}{2}mgl(\omega_i^2+\frac{g}{l} \theta_i^2) \Delta t^2$$$$

The energy increases at every iteration, since the second term is strictly positive. Therefore, my textbook (Giordano-Hisao) suggests to use Euler-Cromer method, slightly modifying the previous system

$$\begin{cases} \omega_{i+1} = \omega_{i}-\frac{g}{l}\theta_i \Delta t \\ \theta_{i+1} = \theta_i+\omega_{i+1}\Delta t \end{cases}$$

This algorithm does work better, as not only the amplitude of the oscillation is constant, but also the energy no longer blows up. Numerically simulating the system above

In the figure we see that energy is periodic, but is there a way to prove that a priori? Will this method always be stable for oscillatory problems? Also, what's the period of the energy? Is it the same as the period of the system?

Such a nice behavior, as compared with the explicit Euler method, could be anticipated by the symplectic nature of the Euler-Cromer method. Symplectic methods preserve the symplectic structure of the phase space of Hamiltonian systems. This is a property with deep consequences. The most important for the present questions is that a symplectic method provides an approximate integration of the Hamiltonian of interest (say $$H$$) but, for every choice of the time steep ($$\Delta t$$), provides an exact integration of a different Hamiltonian, say $$H'(\Delta t)$$. Differences between $$H$$ and $$H'$$ go to zero, generally with the same power of the time step as the global error of the method.
Moreover, long-time behavior can also be controlled theoretically by using asymptotic results for Hamiltonian systems. In particular, Nekhoroshev estimate allows us to predict that numerical and theoretical evolutions will remain close for times exponentially increasing with decreasing $$\Delta t$$.