Molecule 2

previous next

This simulation shows 2 masses connected by a spring and free to move in 2 dimensions.

You can change parameters in the simulation such as gravity, mass, spring stiffness, and friction (damping). You can drag any mass with your mouse to change the starting position.

The math and physics used in this simulation are similar to the 2-D Spring and Double 2-D Spring simulations. However the masses can also collide with the walls; the collision handling is similar to the Colliding Blocks simulation. The only novel bit of math occurs when a mass is pinned against a wall: in that case we add up the net forces on the mass and set the acceleration to zero if necessary.

Also available are: open source code, documentation and a simple-compiled version which is more customizable.

This web page was first published September 2001.

previous next Valid HTML 4.01