TNK LAB

Gas Expansion & Entropy

100 particles start packed into one corner of a box. Each step, every particle takes one random move (up/down/left/right, equal probability) and bounces off the walls. Watch the gas spread out — and entropy climb — even though every single move is just a coin flip with no preferred direction.

State

Step Count: 0
Particles in Corner: 100 / 100

Entropy

Whole System (Shannon): -
Corner Box (relative): -

How These Are Calculated

Whole-System Entropy
$$H_{\text{whole}} = -\sum_{i=1}^{100} p_i \ln p_i, \qquad p_i = \dfrac{n_i}{N}$$
The box is binned into a 10×10 grid; ni is the particle count in bin i, N=100.

Corner-Box Entropy
$$S_{\text{corner}}(n) = \underbrace{\ln\dbinom{N}{n}}_{S_{\text{assign}}} + \underbrace{n\ln V_1}_{S_{\text{in}}} + \underbrace{(N-n)\ln V_2}_{S_{\text{out}}}$$
n = particles in the corner; V1, V2 = corner / rest-of-box area (in cells). Sassign counts the ways to choose which n particles are inside; Sin and Sout count arrangements within each region. The value shown above is Scorner(n) − Scorner(N), relative to the fully-concentrated start.
Sassign = ln C(N,n): -
Sin = n·ln(V1): -
Sout = (N−n)·ln(V2): -
Stotal = sum: -

Particle Box

In original corner
Elsewhere in box

Entropy vs. Steps

Whole-system entropy (fraction of max)
Corner-box entropy (fraction of max)