Ideal Gas

Interactive simulation — adjust parameters and watch the visualization update in real time.

How it works

Hard disks in a 2D box with elastic wall bounces and pairwise collisions. Temperature is identified with mean kinetic energy per particle (k = 1 in model units). For a dilute 2D ideal gas, pressure should track P ≈ NkT/A where A is the area — compare the smoothed wall impulse estimate to NkT/A. Increasing N or T at fixed volume raises pressure; expanding the box lowers it — a qualitative PV ∝ NT demo.

Key equations

⟨KE⟩ = ½m⟨v²⟩ ··· T ≡ ⟨KE⟩/k (2D model)
PV = NkT  (ideal gas, area V in 2D)