From Path Continuations to the Inviscid Burgers Equation

How averaging random continuations of a binary word reveals a PDE from fluid dynamics  ·  v9
Take a sequence of binary words {Ap} with kp/p → α ∈ (0,1). Average over all monotone continuations to 1p−k0k. As p → ∞, the density profile converges to the entropy solution of us + ∂x[u(1−u)] = 0, provided the empirical density converges to u₀(x) with ∫u₀ = 1 − α.

① Select binary word A

(4–500)
(1–199)
Start=wordA; End=1p−k0k Font size Smoothing r = ⌊p/divisor⌋:
Choose A:
word A Density u₀(x)
📐 Formulation
Exact Solution
⭐ Explorer
🎬 Emergence
Monte Carlo
Convergence
Why Burgers?
How to Use

Precise Problem Formulation

Before solving, we must state the problem carefully. The key subtlety is how to take the limit p → ∞.

THE SETUP — Binary word as lattice path

A binary word A of length p with k zeros and (p−k) ones is a lattice path in the rectangle k × (p−k): each zero is a ↑ step, each one is a → step. The evolution (random 01 → 10 swaps) moves this path toward the sorted word 1p−k0k.

THE SCALING — Both species must grow
kp / p → α ∈ (0, 1)    as p → ∞

If k stayed fixed while p → ∞, the density of zeros k/p → 0 gives a trivial limit (all ones, no dynamics). Both the number of zeros (kp) and ones (p − kp) must grow proportionally with p. Geometrically, the rectangle k × (p−k) inflates in both dimensions; in macroscopic coordinates (rescaled by p), it converges to an α × (1−α) rectangle.

PROFILE CONVERGENCE — Empirical → macroscopic
u₀(p)(x) → u₀(x)    as p → ∞

The empirical density of ones near position x in Ap must converge to a fixed macroscopic initial profile u₀ : [0,1] → [0,1].

Bits → x: The word has p sites indexed i = 0, …, p−1, with bit wi ∈ {0,1} at each site. We map site index i to macroscopic position x = i/p ∈ [0,1]. So the discrete lattice {0, 1/p, 2/p, …, 1} becomes the continuum [0,1] as p → ∞. Each bit contributes a point mass: wi at x = i/p.

Role of smoothing radius r: Raw bits give a spiky profile (0 or 1 at each site). To obtain a smooth density u₀(x), we average over a symmetric window of radius r = ⌊p/divisor⌋ sites centered at each position. r is mesoscopic: large enough (r ≫ 1) to average out bit-level noise, small enough (r ≪ p) to resolve macroscopic features. In rescaled units, 1/p ≪ r/p ≪ 1. Any such window yields the same macroscopic limit; the app uses r = ⌊p/15⌋ by default.

GLOBAL CONSTRAINT — Total fraction of ones
∫₀¹ u₀(x) dx = 1 − α

The total fraction of ones is (p − kp)/p → 1 − α. This is checked in the stats panel: compare ∫u₀ with 1 − α.

THE THEOREM (Rost 1981, Rezakhanlou 1991, Seppäläinen 1999)

Under the above scaling, the averaged density of ones at macroscopic position x and time s converges to the entropy solution of the inviscid Burgers equation:

us + ∂x[u(1 − u)] = 0,    u(x, 0) = u₀(x)

The macroscopic time is s = steps / k(p−k) ∈ [0, 1]. The stochastic averaging IS the entropy condition: it selects compression shocks, forbids expansion shocks.

From u at s to u at s+Δs: Discrete: Each micro-step performs one random 01→10 swap (TASEP). After one swap, s increases by 1/k(p−k); the density profile changes locally. Average over many realizations → u(x,s). Continuum: The PDE gives ∂u/∂s = −∂x[u(1−u)]. The implicit formula u(x,s) = f(ξ) with x = ξ + (1−2f(ξ))·s propagates u forward: for s+Δs, solve x = ξ + (1−2f(ξ))(s+Δs) for ξ, then u(x,s+Δs) = f(ξ). Characteristics carry values unchanged until they cross (shock).

What is u(x, s)? The fraction of ones near rescaled position x ∈ [0,1] at macroscopic time s ∈ [0,1]. It ranges from 0 (all zeros) to 1 (all ones).
What is J(u) = u(1−u)? The flux — the rate of 01 → 10 swaps. You need both ones and zeros for a swap, so flow peaks at u = ½ (the 50/50 mix) and is zero at both extremes.
What is c(u) = 1−2u? The characteristic speed. Regions with many ones (u > ½) drift left; few ones (u < ½) drift right; the balance point u = ½ is stationary.
What is v = u − ½? The excess density above equilibrium. Substituting u = v + ½ reveals the Hopf equation vτ + v·vx = 0 — the canonical nonlinear wave in every PDE textbook.
What is f(ξ)? Just a shorthand for the initial data: f(ξ) ≡ u₀(ξ). Whenever you see f in the formulas (e.g. "u = f(ξ)" or "tb_anal = 1/(2·max f′)"), read it as "the initial density profile evaluated at ξ." The PDE textbook convention uses f for the initial condition; our u₀ is the same function.
Breaking time — two definitions: tb_anal = 1/(2·maxξ f′(ξ)) — the continuum formula from the idealized u₀. tb_disc = same formula applied to the smoothed discrete word in the app. At finite p, the discrete word can have steeper effective gradients than the continuum, so tb_disc may differ from tb_anal (e.g. Analytical u₀: tb_anal = 0.4, tb_disc ≈ 0.05). Both are shown in the Explorer when they differ.

🔬 What does "density of ones near position x" actually mean? In the app, getSmoothedU0 uses a symmetric moving-average window of radius r = ⌊p/15⌋ sites centered at each position. This is a mesoscopic scale: 1/p ≪ r/p ≪ 1 (each window contains many bits, but is still small relative to [0,1]). Any window satisfying this constraint gives the same macroscopic profile as p→∞. Rigorously, no window is needed: the requirement is weak convergence of the empirical measure (1/p)∑ wi δi/p to u₀(x)dx, meaning ∑ wi φ(i/p) / p → ∫u₀ φ dx for all continuous test functions φ.

💡 Traffic analogy: Think of ones as cars on a highway and zeros as empty spaces. Density u = fraction of road occupied. When traffic is heavy (u near 1), cars jam; when light (u near 0), few cars = little flow. Maximum throughput at u = ½. The conservation law says no cars are created or destroyed — the total ∫u₀ = 1 − α is conserved for all time.

Summary table of key quantities:

Symbol Meaning Example
xPosition in word (rescaled to [0,1])x = i/p
sMacroscopic time (fraction completed)s = steps/k(p−k)
αLimiting zero fraction k/p → αα = 0.4 → 40% zeros
u(x,s)Density of ones at (x, s)u = 0.8 → 80% ones
f(ξ)Shorthand for initial data: f(ξ) ≡ u₀(ξ)f(0.3) = u₀(0.3)
J(u)Flux = u(1−u) (swap rate)J(0.5) = 0.25 (max)
c(u)Characteristic speed = 1−2uc(0.8) = −0.6 (left)
vExcess density = u − ½v = 0.3 when u = 0.8
ξOrigin of characteristic reaching (x,s)Solve implicit eq.
tb_analBreaking time (continuum) = 1/(2·max f′)tb_anal = 0.5 for f = x
tb_discBreaking time (discrete) = from smoothed word in apptb_disc ≈ 0.05 for Analytical u₀
shockShock speed = 1 − uL − uR1−0.9−0.3 = −0.2

The Exact Solution via Method of Characteristics

Our conservation law can be solved exactly. Here is the complete analytical chain — from the equation to the implicit solution to the breaking time.

STEP 1 — Our equation
us + ∂x[u(1 − u)] = 0  ⟹  us + (1 − 2u) ux = 0

Conservation law with flux J(u) = u(1−u). Characteristic speed c(u) = 1 − 2u.

STEP 2 — Substitution u = v + ½
vs − 2v · vx = 0   →  with τ = −2s:   vτ + v · vx = 0   (Hopf equation)

Centering around v = 0 (the 50/50 mix). v > 0 = excess ones (moves left), v < 0 = deficit (moves right).

STEP 3 — Characteristics (straight lines)
dx/ds = 1 − 2u,   du/ds = 0  ⟹  u = const along x(s) = ξ + (1 − 2f(ξ))·s

Each point ξ on the x-axis sends a straight-line characteristic carrying u = f(ξ) = u₀(ξ).

STEP 4 — Implicit solution
u(x, s) = f(ξ),    where   x = ξ + (1 − 2f(ξ)) · s

For each (x,s), invert to find ξ, then u = f(ξ). This is exact — valid until characteristics cross.

STEP 5 — Breaking time (shock formation)
tb = −1 / infξ [(1 − 2f(ξ))′] = 1 / (2 · supξ f′(ξ))

Fastest characteristics catch slower ones at time tb. After tb: entropy condition (Rankine–Hugoniot) selects the shock solution. Shock speed: ẋ = 1 − uL − uR.

Why u = v + ½ matters: The variable v = u − ½ is the excess density above equilibrium. The Hopf equation vτ + v·vx = 0 is the canonical form in every PDE textbook. It reveals the symmetry: positive excess compresses (shock), negative excess rarefies (fan). The equilibrium v = 0 is a standing wave — neither advancing nor retreating.
After the shock: When characteristics cross, the implicit formula gives multiple values. The entropy solution picks the one consistent with stochastic averaging: compression shocks (uL > uR) propagate, expansion shocks are forbidden (replaced by rarefaction fans).

Worked Examples (Paths 1–9)

tb_anal = continuum formula (1/(2·max f′)). tb_disc = from smoothed discrete word in app. For steps: tb = 0. For rarefaction: tb = ∞.

Path tb_anal tb_disc
1. 0ᵏ1ᵖ⁻ᵏ0.00≈ 0.07
2. ½-evolvedN/Afrom app (varies)
3. Shock (uL>uR)0.00≈ 0.00
4. Rarefaction (uL<uR)typically ∞
5. Ramp ↑ u₀=x0.50≈ 0.50
6. Ramp ↓ u₀=1−xtypically ∞
7. Analytical u₀0.40often ≈ 0.05
8. ScatteredN/Afrom app (varies)
9. RandomN/Afrom app (varies)
PATH 1 — 0ᵏ1ᵖ⁻ᵏ (initial sorted)

Step: u₀ = 0 for x < 0, u₀ = 1 for x ≥ 0. Discontinuity ⇒ tb_anal = 0.00, tb_disc ≈ 0.07. Shock exists from s = 0. The high-density side (ones) and low-density side (zeros) meet at a sharp interface that propagates rightward as the word evolves toward the sorted state.

PATH 2 — ½-evolved

Random mix of swaps from initial — roughly halfway to sorted. No closed-form u₀. tb_anal: N/A. tb_disc: from app (varies). The profile is typically smooth with moderate gradients; whether a shock forms depends on the particular realization. Run the app to see the characteristics and shock trajectory.

PATH 3 — Shock (uL>uR)

Step uL ≈ 0.8, uR ≈ 0.2 at x₀ ≈ 0.5. Since uL > uR (compression), shock exists from s = 0 ⇒ tb_anal = 0.00, tb_disc ≈ 0.00. Shock speed: 1 − 0.8 − 0.2 = 0 (stationary!). Symmetric case uL + uR = 1: flux is equal on both sides, so the shock doesn't move. u(x,s) = 0.8 for x < 0.5, 0.2 for x > 0.5 (all s).

PATH 4 — Rarefaction (uL<uR)

Step uL ≈ 0.2, uR ≈ 0.8. Expansion (uL < uR) is forbidden by the entropy condition → replaced by a rarefaction fan. tb_anal = ∞, tb_disc: typically ∞. No shock ever forms — characteristics diverge. The profile spreads out smoothly; density decreases on the left and increases on the right as the fan develops.

PATH 5 — Ramp ↑ u₀ = x

f(ξ) = ξ, so f′ = +1 everywhere ⇒ tb_anal = 0.50, tb_disc ≈ 0.50. Profile steepens, then breaks. u(x,s) = (x−s)/(1−2s), valid for s < 0.50. At s = 0.25: u = 2x − 0.5 (twice as steep). At s = 0.50: denominator → 0 (vertical cliff → shock forms). After tb, a shock emerges and propagates.

PATH 6 — Ramp ↓ u₀ = 1 − x

f(ξ) = 1−ξ, so f′ = −1 < 0 everywhere ⇒ tb_anal = ∞, tb_disc: typically ∞. No shock ever forms — characteristics diverge. u(x,s) = (1+s−x)/(1+2s). At s = 0: u = 1−x ✓. Slope flattens from −1 to −1/(1+2s). As s → ∞: u → ½ everywhere (complete mixing).

PATH 7 — Analytical u₀

u₀ = 0 (x≤0), x/a (0<x<a), 1 (x≥a), a = 0.80. Ramp slope 1/a = 1.25 ⇒ tb_anal = 0.40. tb_disc: often ≈ 0.05 (discrete artifacts at ramp boundaries). Before shock: u = 0 (x≤s), (x−s)/(a−2s) (s<x<a−s), 1 (x≥a−s). After shock: u = 1 (x<0.40), 0 (x>0.40). Shock forms at s = 0.40, then stays at x = 0.40 (stationary: uL=1, uR=0 ⇒ speed = 0).

PATH 8 — Scattered

Random permutation of the sorted word — zeros and ones thoroughly mixed. No closed-form u₀. tb_anal: N/A. tb_disc: from app (varies). The profile is typically noisy; local steep gradients may produce an early tb_disc. Run the app to observe the evolution and shock formation (if any).

PATH 9 — Random

Random number of swaps from initial — each realization differs. No closed-form u₀. tb_anal: N/A. tb_disc: from app (varies). The profile can resemble ½-evolved (smooth) or develop steep regions; tb_disc depends on the random path chosen. Try multiple runs to see the variability.

Interactive Characteristics & Profile Explorer

Drag the time slider. Left: characteristics in the (x,s) plane. Right: exact density profile u(x,s) via the implicit formula. Optional MC overlay.

0.00 tb = —
0.000
Characteristics in (x, s) plane · A=(0ᵏ1ᵖ⁻ᵏ)
Density Profile u(x, s) · A=(0ᵏ1ᵖ⁻ᵏ)
samples
Color code: Blue = low u (speed > 0, moves right). Red = high u (speed < 0, moves left). Where lines converge → shock. The green line = current time s. The dashed red curve = shock trajectory after tb. The gray curve on the right panel = initial profile u₀. Breaking-time lines (when both shown): t_b_disc = from smoothed discrete word; t_b_anal = continuum formula (e.g. a/2 for Analytical u₀).
What are characteristics? Each straight line on the left panel is a characteristic: a trajectory x(s) = ξ + (1−2f(ξ))·s starting from position ξ at time s = 0 and carrying the constant value u = f(ξ) = u₀(ξ). The slope (speed) of each line depends on the density it carries: high density (red) → moves left; low density (blue) → moves right. When characteristics from different origins would occupy the same point in space-time, the smooth solution "breaks" and a shock forms — a sharp jump in density. The breaking time tb is when the first crossing occurs. After tb, the dashed red curve shows the shock path determined by the Rankine–Hugoniot condition: ẋ = 1 − uL − uR.
Smoothing window: The density profile u₀(x) is computed from the binary word using a symmetric moving-average of radius r = ⌊p/15⌋ sites (currently r = 2). This is a mesoscopic window: large enough to average out bit-level noise (r ≫ 1), small enough to resolve macroscopic features (r ≪ p). The exact Burgers solver then uses this smoothed u₀ as input. The same window is used in the density panel, Explorer, MC comparison, and Convergence tabs.
Why L² may not drop much with larger p: Smoothing uses r = ⌊p/15⌋, so the macroscopic resolution r/p ≈ 1/15 is fixed. At this scale, L² is dominated by the shock transition; the discrete improvement from p=200→500 is largely smoothed out. Use 5000–10000 samples to reduce MC noise. For clear p-dependence, run Convergence (p=10…1000).
tb in Explorer: The displayed breaking time tb is computed from the smoothed discrete word via tb = 1/(2·max u₀′). For the idealized "Analytical u₀" (ramp with slope 1/a), the continuum gives tb = a/2 = 0.4. The discrete word can have steeper effective gradients at ramp boundaries, so Explorer may show a smaller tb (e.g. ≈0.05). See Worked Example 5 in the Exact Solution tab.

🎬 Watching the PDE Emerge from Randomness

Each colored trace is a single random realization — one possible sequence of 01→10 swaps. They jitter wildly. Yet their average (white) locks onto the exact Burgers solution (gold). This is the hydrodynamic limit — a deterministic PDE materializing from microscopic noise.

Density: 5 individual traces · MC average · exact Burgers · A=(0ᵏ1ᵖ⁻ᵏ)
s = 0.00

Individual paths (5 faint colored traces): each is one random sequence of swaps from A. They fluctuate because each chooses different random swaps.

MC average (white bold line): at each time step s, we run nAvg independent random TASEP realizations from A (each does s random 01→10 swaps). The average at site i is (1/nAvg)∑ wn[i] over realizations. The displayed line is this raw average smoothed with radius r = ⌊p/divisor⌋ for fair comparison with Burgers. As nAvg grows, the white line converges to the true expectation.

Exact Burgers (gold dashed): the PDE solution. As p → ∞, the average must converge to this. Watch it happen.

Monte Carlo Averaged Continuations

Sample random continuations from A. Compare with the exact Burgers solution at 4 time slices.

s(x)≈0.1925+2.9359x−2.6694x²
Heatmap p(position, time) · A=(0ᵏ1ᵖ⁻ᵏ)
Exact Burgers (lines) vs MC (dots) · A=(0ᵏ1ᵖ⁻ᵏ)

Convergence as p → ∞ (Hydrodynamic Scaling)

Fix macroscopic shape u₀, embed in words of increasing p with kp/p → α. Watch MC → Burgers. L² error ∝ 1/√p.

Profiles at s = α = 0.40 · A=(0ᵏ1ᵖ⁻ᵏ)
L² Error vs p (log-log) · A=(0ᵏ1ᵖ⁻ᵏ)

Why Burgers?

Binary words
{Ap} with kp/p → α
TASEP
ones=particles, zeros=holes
Hydro scaling
p→∞, k/p→α, u₀(p)→u₀
Burgers
us+∂x[u(1−u)]=0
Entropy sol.
Lax–Oleinik
TASEP: Ones are particles jumping left past zeros (holes). At each step one random available 01→10 swap fires. The current J(ρ) = ρ(1−ρ). Flux peaks at ρ = ½.
Hydrodynamic scaling: As p → ∞ with kp/p → α ∈ (0,1) and empirical density u₀(p) → u₀ with ∫u₀ = 1−α, the averaged density → entropy solution of ∂su + ∂xJ(u) = 0 (Rost 1981, Rezakhanlou 1991, Seppäläinen 1999).
⚠ Why α matters: Fixed k, growing p → zero density k/p → 0 → trivial (all ones). Both species must grow: k ~ αp. The rectangle k×(p−k) → α(1−α)p² in area. The global constraint ∫₀¹u₀(x)dx = 1−α ties the density profile to α.
Speed c(u) = 1−2u. u > ½ → moves left (compression). u < ½ → moves right (expansion). Characteristics converge → shock. Diverge → rarefaction fan.
Entropy = averaging: The stochastic averaging IS the entropy condition. It selects compression shocks, forbids expansion shocks. The microscopic noise vanishes but its memory persists in the shock selection rule.
The substitution u = v + ½ yields the Hopf equation vτ + v·vx = 0 — the canonical nonlinear wave. Same equation for traffic flow, gas dynamics, shallow water waves. v = excess density above the 50/50 equilibrium.

Practical Predictions from the PDE

1. Where zeros cluster: At shocks. Solve Rankine–Hugoniot for the shock trajectory: ẋshock = 1 − uL − uR.
2. Zero trajectories: Follow characteristics x(s) = ξ + (1−2f(ξ))·s until hitting a shock.
3. Counting evolutions: S = −∫∫[u log u + (1−u)log(1−u)] dx ds. The Burgers solution maximizes S — it's the most probable macroscopic evolution.
4. Breaking time: tb = 1/(2·max f′(ξ)) gives the exact moment the smooth solution first develops a shock — computable from u₀ alone.
5. Global constraint: Check ∫u₀ = 1−α in the stats panel. This is conserved: ∫u(x,s)dx = 1−α for all s. If ∫u₀ ≠ 1−α, the word doesn't represent the claimed profile at this α.

Getting started: Read 📐 Formulation for the precise setup. Then Exact Solution for the analytical chain and worked examples. Then ⭐ Explorer to see it in action — drag the time slider and watch shocks form and propagate.

📘 Quick Guide

word A

Set p (4–200) and k (1 to p−1). The ratio α = k/p is the limiting zero fraction. New presets: Ramp ↑ builds u₀(x) ≈ x (shock at tb=0.5); Ramp ↓ builds u₀(x) ≈ 1−x (no shock). Shock (uL>uR), Rarefaction (uL<uR). Click bits to swap. Check that ∫u₀ ≈ 1−α in the stats panel.

📐 Formulation

The precise mathematical statement: a sequence {Ap} with kp/p → α, empirical density converging to u₀(x) with ∫u₀ = 1−α. Includes definitions of all symbols including f(ξ) ≡ u₀(ξ) (shorthand for initial data) and the smoothing window explanation.

Exact Solution

Full derivation chain: conservation law → u=v+½ → Hopf equation → characteristics → implicit formula → breaking time. Now includes four worked examples: decreasing ramp (no shock), increasing ramp (shock at tb=0.5), symmetric step (stationary shock), asymmetric step (moving shock).

⭐ Explorer

Drag the time slider for synchronized characteristics + profile. Click Animate for auto-play. Overlay MC to verify.

🎬 Emergence

The signature visualization: 5 individual random realizations (colored traces) jitter wildly, but their average (white) locks onto the exact Burgers solution (gold dashed). This is the law of large numbers meeting the hydrodynamic limit — a deterministic PDE materializing from microscopic noise. Use the scrubber to freeze any frame. Try different sample counts (100 vs 2000) to see the average tighten.

3D MC and 3D Burgers (blue buttons): show u(x,s) as a 3D surface. Axis up selector: choose x, s, or u to be vertical — rotation is around that axis. Drag or ←→ keys to rotate. Autorotate = continuous spin. Run Emergence first for 3D MC.

Monte Carlo

Heatmap + 4-slice comparison with L² error for each slice.

Key Definitions

  • u(x,s) — fraction of ones near position x at time s
  • x = i/p — rescaled position in [0,1]
  • s = steps/k(p−k) — macroscopic time in [0,1]
  • α = k/p — zero fraction, must converge as p → ∞
  • f(ξ) ≡ u₀(ξ) — initial data evaluated at ξ (textbook shorthand)
  • J(u) = u(1−u) — flux (swap rate), peaks at u = ½
  • c(u) = 1−2u — characteristic speed
  • v = u − ½ — excess density above equilibrium
  • tb = 1/(2·max f′) — breaking time
  • ∫u₀ = 1−α — global constraint (conservation of ones)
  • Window — smoothing radius r = ⌊p/15⌋ (mesoscopic: 1 ≪ r ≪ p)

Tips

Try Shock preset → Explorer → drag past tb. Use p=30–50 for speed. 5000 MC samples for accuracy. Check that ∫u₀ ≈ 1−α in the stats panel.

📐 Analytical Solution (Piecewise-Linear u₀)

Boundary conditions: u(0,s) = 0,   u(1,s) = 1   (constant Dirichlet, zero flux at boundaries)

Initial condition: u₀(x) = 0 for x ≤ 0;   u₀(x) = x/a for 0 < x < a;   u₀(x) = 1 for x ≥ a   (a = 0.8). Breaking time tb = a/2 = 0.4.

Before shock (s < 0.4):
u(x,s) = 0 for x ≤ s;   (x−s)/(0.8−2s) for s < x < 0.8−s;   1 for x ≥ 0.8−s.

After shock (s ≥ 0.4):
u(x,s) = 1 for x < 0.4;   0 for x > 0.4   (stationary shock at x = 0.4).
u(x,s) heatmap — x horizontal, s vertical (s=0 at bottom)

Heatmap: blue = low u, red = high u. White dashed line = shock at x = 0.4 after tb.

To compare MC with analytical: Use the Analytical u₀ preset (in Choose a word A), then run MC in the Monte Carlo tab. The MC average should match this analytical solution.

This is the exact entropy solution for us + ∂x[u(1−u)] = 0 with the above BC/IC.

u(x,s) 3D Surface — Burgers Solution

Choose Axis up (x, s, or u) — that axis stays vertical. Rotation is around it (drag, ←→ keys).

u(x,s) 3D Surface — MC Average

Choose Axis up (x, s, or u) — that axis stays vertical. Rotation is around it (drag, ←→ keys).