A cup of coffee with a splash of cream is the most-cited everyday illustration of the second law of thermodynamics. Stir it and the cream disperses; the cup never spontaneously unmixes. But the cup tells a second, subtler story that the bare second law does not. Entropy increases monotonically from the moment the cream lands until the cup is uniform, yet the visible structure does not. It is dull at the start (cream sitting on coffee), intricate in the middle (filaments and tendrils), and dull again at the end (a flat milky brown). This playground simulates the cup with an incompressible Navier-Stokes solver running on the GPU, measures coarse-grained Shannon entropy and Lempel-Ziv apparent complexity from the live concentration field, and plots both on one fixed axis. The point is the contrast: entropy rises and stays risen; apparent complexity rises and then falls.
The version of entropy that increases in the second law is not a property of the exact microstate. The exact microstate of the cup, the position and velocity of every molecule, carries the same information-theoretic entropy at every instant if you could track it perfectly; microscopic dynamics are reversible and information-preserving. The entropy that increases is a coarse-grained entropy: you partition the system into macroscopically distinguishable cells and count how many microstates are compatible with what you can actually see. Boltzmann's S = k log W and Gibbs's ensemble entropy are both coarse-grained in this sense.
This is why entropy here is computed by binning the cup into boxes and asking, per box, what fraction of the fluid is cream. A box that is pure coffee or pure cream is informative and low-entropy; a box that is a fifty-fifty mix is maximally uncertain and high-entropy. The box size is a modelling choice, and the entropy depends on it. That dependence is not a defect: it is the content of the claim that entropy is relative to a level of description, made operational. In this playground the box size is a slider, so the claim can be tested by hand.
Scott Aaronson, Sean Carroll and Lauren Ouellette made this precise in Quantifying the Rise and Fall of Complexity in Closed Systems (2014). They modelled a two-dimensional fluid of two interacting species, a "coffee automaton", and asked how a measure of apparent complexity behaves over time while entropy increases. Their measure was concrete and unromantic: take a frame, coarse-grain it, and compress it. The compressed size of the coarse-grained image is the apparent complexity. The compressed size of the fine-grained image tracks the entropy.
The finding: with realistic interactions, apparent complexity rises from near zero, reaches an interior maximum, and falls back, while entropy increases monotonically throughout. Without interactions the bump is much weaker. Interactions are what let tendrils form, and tendrils are where the apparent complexity lives.
Carroll has popularised the same picture in From Eternity to Here (2010): the universe began in a low-entropy state and is heading toward high-entropy heat death, and the interesting complex structures, galaxies, stars, planets, life, are a transient feature of the middle of that history rather than its endpoint.
The cup is a two-dimensional cross-section, gravity downward, solved with Jos Stam's stable-fluids scheme (Stable Fluids, SIGGRAPH 1999) on a 128 by 128 velocity grid with the cream concentration carried at 256 by 256. Each frame runs, in order:
(I - nu dt laplacian) u = u0, so the viscosity is unconditionally stable at any value.The walls are sealed on all four sides. That is a modelling choice with a numerical motive: semi-Lagrangian transport with clamped sampling manufactures dye wherever flow crosses an open boundary, and the total cream in the cup is exactly what sets the ceiling of the entropy curve.
Roughly five times a second the concentration field is box-averaged down to a 64 by 64 grid and read back. From that field:
H(c) = -[c log2 c + (1 - c) log2 (1 - c)] over coarse-graining boxes, in bits, between 0 and 1;1 - |2c - 1|, which is 1 at a fifty-fifty mix and 0 at a pure box;n / log_a(n), the value a random sequence of the same length over the same alphabet would give.The Lempel-Ziv parse stands in for the paper's gzip. It is deterministic, needs no compression library, and has exact known values on degenerate inputs, which is what lets it be checked rather than trusted: the LZ76 parse of any constant sequence has exactly two phrases and of any alternating sequence exactly three, results that come from Lempel and Ziv (1976) and not from this codebase.
Both quantities are dimensionless and bounded in [0, 1], and both are plotted on one fixed axis with no rescaling.
A CPU reference implementation of the same scheme runs headlessly, which makes the solver checkable against closed-form fluid dynamics. The calibration panel reports:
u = sin(2 pi m x / n) is pure divergence and carries no rotation, so an exact projection removes all of it. About seven percent survives, which is the error of the discrete Poisson solve: Jacobi converges geometrically and is slowest on the longest wavelengths, and the collocated central-difference gradient and divergence operators are not exact inverses.u t. The solver gets this to within a tenth of a percent.u = (sin kx cos ky, -cos kx sin ky) is a Laplacian eigenmode, so Navier-Stokes decays its amplitude as exp(-2 nu k^2 t) (Taylor and Green 1937). The solver reproduces this to about one percent.Alongside these, the measurement pipeline is checked against H(1/2) = 1, H(0) = 0, the closed-form mean of the binary entropy over an eight-level ramp, and the two Lempel-Ziv identities.
Three regimes recur, and they are the three moments in the analogy.
The ceiling deserves a note. Binary entropy is maximal at c = 1/2, so the cup can only reach a full bit if it is half cream. The cream slider sets that directly, and watching the entropy plateau move as you change it is the clearest way to see that the axis is measuring something real rather than being normalised into place.
The presets move the peak around, and not always in the direction intuition suggests. A thin, low-viscosity fluid with strong vorticity confinement keeps small eddies alive and produces the tallest peak. A thick, high-viscosity fluid couples the whole cup so that it overturns as a single roll: the mixing is fast but coarse, and the complexity peak is early, and collapses hard, because there are no small eddies to sustain fine filaments. Diffusion-only settling never forms strong filaments at all, and its peak has not arrived by the end of the run.
The cup is a small lesson about the arrow of time. The second law guarantees that disorder, properly coarse-grained, increases. It does not guarantee that anything interesting happens along the way, and it certainly does not guarantee that the interesting things last. Complex structure is a feature of the journey between a low-entropy past and a high-entropy future, sustained, where it persists, by a flow of low-entropy energy through an open system. The cup closes and goes uniform. The Earth stays interesting only because the Sun keeps pouring.