Projectile Motion with System of Masses and Spring

This is the simulation of the motion of two masses m and m1 situated at the ends of a spring of length L0 and negligible mass. The motion is restricted to two spatial dimensions, with the y-axis representing the vertical (if gravity is switched on).

We use Hooke's law for the spring force, and include a damping term that is proportional to the difference of the velocities of the masses on both ends of the spring.

Applying Newton's Second Law yields a second-order ordinary differential equation, which we solve numerically in the simulation and visualise the results.