Gas Laws Interactive Lab Physics

Pressure: -- atm
Pressure = (nRT) / V ≈ -- atm
(Simulated pressure should match)

What is the Gas Laws Interactive Lab?

Quick Answer: A kinetic theory simulator where you see gas particles bouncing in a container. Change volume, temperature, or particle count and instantly see how pressure changes. The ideal gas law (PV = nRT) is demonstrated live, with a moving pressure gauge and real-time collision physics.

Theory of the Ideal Gas Law

The Ideal Gas Law PV = nRT relates pressure (P), volume (V), number of moles (n), and temperature (T). In this simulation, particles have random speeds proportional to temperature (average kinetic energy = (3/2) kB T). Pressure is computed from the rate of momentum transfer to the walls: P = (m Σ vx2) / V for each wall, averaged over time. Changing volume, temperature, or particle count directly impacts the measured pressure, confirming the law. Boyle's law (P ∝ 1/V), Charles's law (V ∝ T), and Gay-Lussac's law (P ∝ T) are all observable.

Step-by-Step Examples

Example 1: Boyle's Law (P vs V at constant T)

  1. Set temperature to 300 K and particle count to 30. Decrease volume from 10 L to 5 L. Watch the pressure gauge rise; the simulated pressure should roughly double.
  2. Increase volume to 15 L; pressure drops. The product P×V remains approximately constant (shown in the info panel).

Example 2: Charles's Law (V vs T at constant P)

  1. To keep pressure constant, you would need to adjust volume when temperature changes. Try raising temperature from 300 K to 600 K; pressure rises. Now increase volume to bring pressure back to the original value. You'll see V/T roughly constant.

Example 3: Effect of Particle Number

  1. Double the number of particles from 30 to 60. Pressure doubles (at same V and T). This demonstrates Avogadro's principle.

Frequently Asked Questions

How is pressure calculated in the simulation?

Each time a particle hits a vertical wall, its change in x-momentum (2 m vx) is recorded. The force is total momentum transfer per unit time divided by wall area. The gauge shows the average over the last few collisions.

What units are used?

Temperature in Kelvin, volume in liters (container width represents volume because height and depth are fixed). Pressure is scaled to atmospheres using the ideal gas constant for comparison. Particle mass is arbitrary but scaled to match ideal gas behavior.

Why does the simulated pressure not exactly match the ideal gas law?

Fluctuations occur because the number of particles is small. The time-averaged pressure will converge to the theoretical value as you increase particles or run longer. The gauge shows a short-term average.

Can I see the graph of P vs V?

The info panel displays the expected pressure from PV=nRT. You can manually record values. Future updates will include an auto-plotting feature.

Is this a real-time simulation?

Yes, the particles move and collide with walls and each other (simplified elastic collisions) in real time using requestAnimationFrame.