Maxwell’s demon
Compare a speed-selective membrane with free mixing in a reproducible gas model.
About this tool
Compare sorting and free mixing
Set a speed cutoff v*, then run. Orange particles have speed v ≥ v*; blue ones are slower. With sorting enabled, the membrane passes fast particles left to right and slow particles right to left. Other crossings reflect elastically. Turning sorting off opens the whole partition. You can change the cutoff or switch sorting during a run without changing particle speeds. Restart with the same seed repeats the initial state. Pause and Step 0.1 allow inspection; a hidden view suspends playback without catching up.
Model and measurements
Point particles move without collisions with one another in a 2 × 1 rectangle. The selective membrane spans the entire height at x = 1; there is no small aperture. Wall and membrane events use exact travel times, including the remaining motion after a bounce. Canvas size does not change the physical coordinates or speeds. The display uses relative units with m = kB = 1, not SI units.
Each velocity component is drawn from a zero-mean Gaussian of variance 1 using a seeded generator. Mirrored particle pairs have equal initial speed distributions in both chambers. For odd N, one unpaired particle starts on the left. There is no thermostat or later equilibration. Kinetic T = Σ(vx² + vy²)/(2N) is a kinetic-temperature indicator including bulk motion, not a guarantee of thermodynamic equilibrium. An empty chamber has no defined T and shows —. Particle number and total kinetic energy E = Σ(vx² + vy²)/2 are conserved. Model time advances at one unit per real second, with slow frames capped at 0.05; it may run slower under load.
Information is not a total entropy balance
The sorted percentage counts slow particles on the left plus fast particles on the right, divided by all particles. It is an indicator of this rule, not a thermodynamic efficiency. A zero or very high cutoff can empty one chamber.
The optional diagnostics use 12 fixed speed classes: width 0.5 from 0 to 5.5, with all higher speeds in the last class. H(B) = −Σp ln p in natural units (nat). H(B|side) weights each chamber’s class entropy by its particle fraction. I(B;side) = H(B) − H(B|side), between 0 and ln 2, describes association between class and chamber. These finite-sample, bin-dependent quantities exclude spatial and other microscopic information; they are not the gas’s total physical entropy. Measurement, information storage and erasure are not modelled. This ideal membrane therefore provides no complete demonstration or violation of the second law, and does not compute Landauer’s erasure cost.
Source: Bennett: Landauer’s principle and Maxwell’s demon. The two-dimensional kinetic indicator follows from two quadratic translational degrees of freedom; see OpenStax: equipartition.
Reset restores default inputs. Exact input text is retained even while unfinished; particles, results and playback are not saved. Seed and particle-number changes need a fresh run. Cutoff and sorting act directly on an existing run. Particle dots grow with display size for visibility; particles remain mathematical points.