In-class exercise 6.1

Consider the long-term behavior of the energy error in the two second-order schemes we have studied. For

    (1) the analytic second-order scheme and

    (2) the predictor-corrector scheme,

consider the nonlinear oscillator with

        acc = -K x3
and K = 4, starting with x = 0 and v = 1 at time t = 0.

Plot the trajectory x(t) and the energy error dE = E(t) - E(0) as functions of time for  dt = 0.1,  for  0 <= t <= t_max = 10, 100, 1000.   What do you notice about the long-term growth of the error in each scheme?