This is an example of a mass spring system using Lagrangian dynamics. Instead of considering the positions, velocities, and accelerations of each mass individually we use generalized forces to compute acceleration of the system.
Eberly, David H., and Ken Shoemake. "Chapter 3.2.4: Lagrangian Dynamics." Game Physics. Amsterdam: Elsevier/Morgan Kaufmann, 2004. N. pag. Print.