Harmonic motion

←Previous

Dealing with the instability

As a first step towards a solution of the instability problem let us analyse the evolution of energy with time:

\[ E=E_\mathrm{kin}+E_\mathrm{pot}\,=\, \frac{m}{2}l^2\omega^2(t)+mgl[1-\cos\theta(t)] \approx\frac{m}{2}l^2\omega^2(t)+\frac{m}{2}gl\theta^2(t) \, . \]
Let us rewrite this equation in terms of the angles and velocities at a time step labelled with i+1:
\[\begin{eqnarray*} E_{i+1} \,&=&\, \frac{ml^2}{2} \left[ \omega_{i+1}^2+ \frac{g}{l} \theta_{i+1}^2 \right] \,=\, \frac{ml^2}{2} \left[ \left( \omega_i-\frac{g}{l} \theta_i\Delta t \right)^2+ \frac{g}{l}(\theta_i+\omega_i\Delta t)^2\right] \\ &=&\, \frac{ml^2}{2} \left[ \omega_i^2 + \frac{g}{l} \theta_i^2 \right] + \frac{mgl}{2}\left( \frac{g}{l} \theta_i^2 + \omega_i^2 \right)(\Delta t)^2 \\ &=&\, E_i + \frac{mgl}{2} \left( \frac{g}{l} \theta_i^2 + \omega_i^2 \right) (\Delta t)^2 \,\, . \end{eqnarray*} \]

This explains why the Euler method is bound to fail, irrespective of the size of the time step Δ t. At each iteration, the total energy increases by a positive amount. But, if the method is unstable here, how was it possible to have seemingly stable and sane results in the two previous lectures? The answer is that in general there is not such a thing as "the perfect method" - methods are more or less suitable for different problems. In fact, looking a bit more closely would reveal that the Euler method also led to violations of conserved quantities in those two first examples. But, in contrast to the example here, this was insignificant and could be controlled by choosing the time step small enough. In oscillatory motion, on the other hand, it is often important to discuss many cycles - we will see that later on - and in those cases energy non-conservation, however small per cycle it may be, can accumulate to a larger scale problem. Therefore, since the Euler method fails to conserve energy over the long haul, it must be concluded that in cases like the one at hand it is unsuitable.

So what's the alternative? Of course, the Runge-Kutta method encountered before does a much better job, and this is the kind of method that is typically used.
However, instead, let's consider a small deviation of the Euler method, namely the Euler-Cromer algorithm, which gives surprisingly good results despite its simplicity. Compared with the original Euler method,

\[\begin{eqnarray*} \theta_{i+1}\,&=&\, \theta_i+\omega_i\Delta t\\ \omega_{i+1}\,&=&\, \omega_i-\frac{g}{l}\theta_i\Delta t\, , \end{eqnarray*} \]
it offers just a slight change, namely replacing ωi with ωi+1:
\[\begin{eqnarray*} \omega_{i+1}\,&=&\,\omega_i- \frac{g}{l}\theta_i\Delta t \\ \theta_{i+1}\,&=&\,\theta_i+\omega_{i+1}\Delta t\, . \end{eqnarray*} \]
This seemingly minor change, has a huge effect:
Theta as a function of time for the simple pendulum with the Euler method
The size of energy non-conservation in the Euler-Cromer method cancels out over one whole oscillation period, avoiding the accumulation of error we saw earlier.

Next→





Frank Krauss and Daniel Maitre
Last modified: Tue Oct 3 14:43:58 BST 2017