The motion of an object with mass [math]m[/math] at the end of a spring is governed by the second-order differential equation [math]m\frac{d^2x}{dt^2}+kx=0[/math], where [math]k[/math] is a spring constant. The initial position is [math]x(0)=x_0[/math] and the initial velocity is [math]x'(0)=x_1[/math]. Then the solution is [math]x(t)=x_0\cos(\omega t)+\frac{x_1}{\omega}\sin(\omega t)[/math], where [math]\omega=\sqrt{\frac{k}{m}}[/math].