Solve oscillation equation numerically. Here x is a complex number.
The analyric solution of this equation is as follows.
git clone https://github.com/takiwaki/OSCODE.git
cd OSCODE
make
./ode.x
gnuplot t-x.plt
The Euler method diverge and backward Euler method diminishes.
The RK4 and Crank Nicolson method is consistent with the analytic one.
The error of Crank Nicolson method is smaller than that of RK4 in this time range. Note that the error of RK4 can be smaller than Crank Nicolson at later time.
http://cms.phys.s.u-tokyo.ac.jp/~naoki/CIPINTRO/CIP/wave.html