Problem 1¶
Consider a mass of 1 Kg on a spring of stiffness of 1 Nm\(^{-1}\) that is displaced by 1 cm and then released. Calculate and then plot on the same graph the kinetic, potential and total energies over a period of several oscillations. Now consider the same spring, but with a damping force of 0.4 N opposing the oscillations. Plot the kinetic, potential and total energies of this system.
Hint
You can calculate the damped oscillator energies explicitly, but an advantage of using python is that you don’t have to. Solutions are provided for both the analytical method and the fourth order Runge-Kutta method, which is a common way of solving systems of equations numerically.