Entropy box: the maths
240 soft discs under Newton's laws, integrated in exact integer arithmetic so reversing every velocity retraces the past exactly. Entropy is counted on a coarse 8 × 4 grid. Computed live.
Equations
- S = ln W, W = N! / (n₁! n₂! … n₃₂!)
- Boltzmann's entropy (in units of k): W counts the ways to put N discs into the 32 cells with these counts.
- Sshown = (S − Spacked) / (Seven − Spacked)
- The 0–100 scale: from all discs evenly in the left half to evenly everywhere.
- complexity = runs of equal density along each row (16 × 8 grid, smoothed, 3 levels)
- A simple stand-in for the compressed size of the coarse-grained picture (Aaronson, Carroll & Ouellette 2014).
- ai = Σj G m (rj − ri) / (|rj − ri|² + ε²)3/2
- Add gravity: Newton's inverse-square pull between every pair, softened at short range (ε) so close passes stay finite. Leapfrog steps; walls reflect.
- Stotal = ln W + N ln T + Σ (4/3) ΔE / T
- Add gravity's three ledgers, in units of k: arrangement (as above), heat of a two-dimensional gas with T its mean kinetic energy per disc, and the entropy carried off by black-body light.
Constants
| N | 240 discs | |
| cells | 8 × 4 = 32 | the coarse-graining |
Worked examples ✓ checked on every change
| All 240 discs in one cell: ln W | 0 | only one way: W = 1 |
| Evenly spread (7 or 8 per cell): ln W | 772.9 | ln 240! − 16 ln 7! − 16 ln 8! |
| Evenly in the left half (15 per cell there): ln W | 632.6 | ln 240! − 16 ln 15! |
| Add gravity · heat ledger when the gas's temperature doubles | +166.4 | N ln 2, for N = 240 |
| Add gravity · light ledger: energy 0.03 sent out at temperature 0.01 | +4.0 | (4/3) × 0.03 ÷ 0.01 |
What's simplified
- Two dimensions, soft discs, a small N — so fluctuations show (they shrink as 1/√N).
- How to measure complexity isn't settled; this is one simple choice.
- Add gravity: point masses in a plane with no pressure, fusion or dark matter; gas at least twice the average density radiates a fixed share of its heat per step; all motion is counted as heat, including infall. The lines wobble as clumps bounce.
Where it breaks
Never for the reversibility — the integer arithmetic is exact. The entropy value depends on the grid chosen, as coarse-grained entropy always does.
Sources: L. Boltzmann (1877); S. Aaronson, S. M. Carroll & L. Ouellette, arXiv:1405.6903 (2014).