uconn codeGas law piston
Gas law piston
A 2002 Java applet idea, rebuilt for the modern web in 2026
Molecules bounce around a cylinder, and the pressure is measured the way a gauge would: from how hard they hit the walls. Change the volume, the temperature, or the number of molecules and watch the measurement track the ideal gas law, PV = NkT.
Simulation
- Measured pressure
- …
- Ideal gas law predicts
- …
Pressure is measured from the molecules' hits on the walls, averaged over about a second.
Things to try
- Boyle's law: halve the volume to 50%. The molecules hit the walls twice as often, and the pressure doubles.
- Gay-Lussac's law: raise the temperature from 300 K to 600 K. Faster molecules hit harder and more often, and the pressure doubles.
- Avogadro's law: double the molecules and the pressure doubles too.
Molecule colors show speed: blue is slower than typical for the temperature, violet is typical, red is faster. Like an ideal gas, the molecules never collide with each other. The simulation is two-dimensional, so the law here is P × area = N × k × T, in arbitrary units.
Where it came from
My college files from 2002 include a copy of the “Bouncing Molecules” gas law applet from the BETHA project, written in 1997 by Midori Kitagawa DeLeon at the Advanced Computing Center for the Arts and Design, The Ohio State University. Java applets no longer run in browsers, so this page is a new simulation written from scratch in TypeScript. None of the original code is used, but the piston, the thermometer, and the bouncing molecules are a tribute to it.