RK4 code from Nonlinear Dynamics class