← ali@localhost ~/ simulations / maxwell

Maxwell's demon

The second law is a counting argument. A small door with a preference is enough to make the counting look reversible, until you count the door.

maxwell's demon S · ΔT · bits

Equal-mass hard disks in a box, split by a wall with one door. Between collisions there is no force: each disk drifts in a straight line. That drift is a semi-implicit Euler step. When two disks overlap and are approaching, they trade the component of velocity along the contact, which is the exact elastic collision for equal masses, and a few relaxation passes keep a fast disk from tunneling through a neighbor.

$$ S = -\sum_i p_i \ln p_i $$

S on the readout is the Shannon entropy, in nats, of a joint histogram: which side of the box, and which speed bin. With the demon off, the door is just a hole, both sides carry every speed, and S stays high. With the demon on, a fast disk may cross only toward the right, and a slow disk only toward the left. The right side heats, the left side cools, ΔT grows, and S falls. Total energy does not. The demon never touches a speed. It only refuses some crossings.

Each refusal or permission is one bit on the readout. That counter is the memory. The gas looks more ordered. The record of the decisions does not. Turn the demon off and the door forgets its job; the two temperatures wander back toward each other.

Field note: Maxwell's demon, in draft. Draft for Ali to write. It is not published yet.