Kinetic Theory of Gases Simulator: Maxwell-Boltzmann Distribution
Simulate a two-dimensional hard-disk gas with exact event-driven collisions. The speed histogram is built from the collisions and converges onto the 2-D Maxwell-Boltzmann (Rayleigh) curve.
At a glance
- Computes
- Speed distribution, temperature, and pressure of a 2-D gas from collisions
- You supply
- Particle count, temperature, disk radius, box side, and random seed
- Use when
- You want Maxwell-Boltzmann derived from collisions or pressure checked
- Not for
- Solving PV = nRT for a laboratory gas Ideal Gas Law and Boyle's Law Calculator
Relative energy change since reset
-1.28e-15
Exact event-driven hard-disk dynamics after 200 reduced time units.
Probability density against Particle speed
Probability density against Particle speed
Boltzmann H (nats) against Simulated time; reference at Analytic grid equilibrium floor
Paused at the build-time reference state.
- Total kinetic energy
- 200.0000
- Relative energy change since reset
- -1.28e-15
- Temperature from kinetic energy
- 1.00000
- Pressure from wall impulse
- 2.1071
- Ideal-gas pressure
- 2.0202
- Physical whole-wall pressure
- 2.0860
- Compressibility Z
- 1.0326 plus or minus 0.0010
- Packing fraction
- 0.01603
- Henderson bulk prediction
- 1.0329
- Bias-corrected H excess
- 0.26 plus or minus 0.04
- Relative entropy D_grid
- 0.3198
- H convergence threshold
- 0.08 nats
| Quantity | Measured value |
|---|---|
| Total kinetic energy | 200.0000 |
| Relative energy change since reset | -1.28e-15 |
| Temperature from kinetic energy | 1.00000 |
| Pressure from wall impulse | 2.1071 |
| Ideal-gas pressure | 2.0202 |
| Physical whole-wall pressure | 2.0860 |
| Compressibility Z | 1.0326 plus or minus 0.0010 |
| Packing fraction | 0.01603 |
| Henderson bulk prediction | 1.0329 |
| Bias-corrected H excess | 0.26 plus or minus 0.04 |
| Relative entropy D_grid | 0.3198 |
| H convergence threshold | 0.08 nats |
| Species | Count | Accessible perimeter | Pressure | Compressibility Z |
|---|---|---|---|---|
| Light | 200 | 39.6000 | 2.107099 | 1.032584 |
| Time | Bias-corrected H | Grid floor | Excess | sigma_H | D_grid |
|---|---|---|---|---|---|
| 200.00 | -2.60115 | -2.85808 | 0.25693 | 0.04125 | 0.31981 |
The H trace uses accumulated velocity samples and the Miller-Madow correction. Its excess fluctuates about the grid floor; D_grid is the exactly non-negative companion. Convergence means entering two live sigma_H of the floor.
The predicted 2-D speed moments are 1.00000, 1.25331, and 1.41421.
How this simulation works
Hard disks move in straight lines between closed-form collision times. A deterministic calendar resolves elastic disk and wall collisions without overlap correction.
The Maxwell-Boltzmann distribution in two dimensions
A two-dimensional box produces the Rayleigh speed density, with a linear factor in speed. The familiar three-dimensional Maxwell form has a quadratic factor and is only a contrast here.
Mean, most probable, and root-mean-square speed
At scale s the ratios are 1 : 1.2533 : 1.4142.
Equipartition and temperature
With two translational degrees of freedom, mean kinetic energy is kBT per particle, not 1.5 kBT.
Pressure, and where the ideal gas law comes from
Pressure is measured from wall impulse. The five-unit window fluctuates by about four percent. Cumulative uncertainty falls as 1 / window, not as its square root.
Henderson describes the bulk limit. This simulation is a finite box with hard walls, so the wall-layer density differs slightly from the bulk density and the measured compressibility can sit just below the bulk prediction.
This page derives what the ideal gas law calculator assumes. It has no solve-for-the-unknown mode. Velocity components are Gaussian; areas under that curve belong on the normal distribution page.
Relaxation to equilibrium
Collisions redistribute velocity while total kinetic energy remains fixed to floating-point roundoff. The accumulated H trace uses a Miller-Madow bias correction and compares against the analytic floor on the same grid. Its corrected excess fluctuates about that floor; D_grid remains non-negative.
What this model assumes
Hard disks in two dimensions, fixed hard walls, elastic collisions, and no force between events.
P = wall impulse / (perimeter x window); Z = P A / (N kB T)
How?
How this is calculated
The center-accessible side is S = L - 2r, with A = S squared. Finite disks lift Z above 1 through excluded area.
Formula: P = wall impulse / (perimeter x window); Z = P A / (N kB T)
Performance and scope caps
- Particle count is capped at 400.
- Packing fraction is capped at 0.25.
- The event budget slows simulated time rather than skipping physics.
Sources
- Algorithms, 4th edition, 6.1 Event-Driven Simulation. Princeton University. Retrieved .
- OpenStax University Physics Volume 2, 2.4 Distribution of Molecular Speeds. OpenStax. Retrieved .
- Henderson, A simple equation of state for hard discs. Molecular Physics. Retrieved .
- Rapaport, The event scheduling problem in molecular dynamic simulation. Journal of Computational Physics. Retrieved .