Devlog #71 – Wave 51: Truchet Tiles, Benford’s Law & Pipe Flow

Wave 51 spans three very different domains — generative art, mathematical statistics, and fluid dynamics — united by the theme of hidden order: fractal-like mosaics from four simple tile rotations; digit-distribution anomalies that expose fraud in financial data; and a parabolic velocity profile that emerges from viscous resistance alone. Platform total reaches 526 live simulations.

Wave 51 at a Glance

3
New simulations
6
HTML files (EN+UK)
526
Total simulations
1
Blog posts
🔷

Truchet Tiles

Seeded LCG random-tile mosaic with four tile types (diagonal arcs, straight diagonal, quarter-circle corners, cross), four colour themes, adjustable grid density, and PNG export.

Launch →
🔢

Benford’s Law

Seven empirical datasets (population, rivers, stock prices, tax returns, earthquakes, street addresses, Fibonacci) with bar chart overlay, χ² conformity test, and fraud-alert indicator.

Launch →
🚿

Pipe Flow Profiles

Hagen-Poiseuille parabolic velocity profile with animated streamline particles, Reynolds-number regime indicator (laminar / transitional / turbulent), and five fluid presets including blood and honey.

Launch →

Truchet Tiles — Seeded Mosaics from Four Rotations

Sébastien Truchet described in 1704 how a single square tile bearing a diagonal line, when placed in four orientations, can tile the plane in an enormous variety of visually distinct patterns. The modern generalisation allows multiple tile types to coexist, each selected independently per cell.

The simulator uses a lightweight Linear Congruential Generator (LCG) seeded by a user-adjustable integer, ensuring every mosaic is perfectly reproducible:

xn+1 = (1664525 × xn + 1013904223) mod 232

Four tile designs are available: smooth diagonal arcs that form connected curves across the grid; straight diagonals that produce sharp zigzag lines; quarter-circle corners that tessellate into flowing loops; and crosses that punctuate with four-way junctions. All four can be active simultaneously within a single mosaic; each is drawn with Canvas 2D arc and lineTo calls inside an save()/rotate()/restore() transformation block.

Colour Themes

Four themes ship with the simulator: Classic (cream arcs on off-black), Ocean (teal to coral gradient), Forest (muted greens), and Neon (high-saturation fluorescent on near-black). Each theme defines both a background fill and a stroke colour, so swapping the theme completely transforms the visual character of an identical seed—making it clear that aesthetic variation and procedural structure are orthogonal.

Try it: set the seed to 42, enable only Arc tiles, and switch between themes. The same underlying random sequence produces radically different moods from monochrome to neon.

Benford’s Law — The First-Digit Anomaly

Benford’s Law states that in many naturally occurring numerical datasets the leading digit d (1–9) appears with probability:

P(d) = log10(1 + 1/d)

The result is counter-intuitive: digit 1 leads about 30.1% of the time while digit 9 leads only 4.6%. The law arises whenever a dataset spans several orders of magnitude and is scale-invariant— switching between currencies, units of length, or population scales leaves the distribution unchanged.

Fraud Detection via χ² Test

The χ² goodness-of-fit statistic compares the observed digit frequency Od against the Benford expected count Ed = N × P(d):

χ² = Σd=19 (Od − Ed)2 / Ed

With 8 degrees of freedom, the critical value at α = 0.05 is 15.51. Real datasets (city populations, river lengths, earthquake magnitudes, Fibonacci numbers) conform closely and produce small χ² values. The “Tampered Tax Returns” dataset is generated with a bias toward digits 5-7, and always exceeds the critical threshold—demonstrating why forensic accountants use Benford tests as a first-pass anomaly screen.

Try it: select the Fibonacci dataset to see near-perfect Benford conformance (χ² < 2). Then switch to Tampered Tax Returns to trigger the fraud alert. Watch how even a modest bias (±3% per digit) is statistically unambiguous at N = 1000 observations.

Pipe Flow — Hagen-Poiseuille Profile

Fully developed laminar flow through a circular pipe of radius R, driven by a pressure gradient dP/dx, produces the classic parabolic velocity profile derived independently by Hagen (1839) and Poiseuille (1840):

u(r) = (R2 − r2) / (4μ) × (−dP/dx)

where μ is dynamic viscosity and r is the radial distance from the centreline. Maximum velocity umax = R2/(4μ) × (−dP/dx) occurs on the axis, and the volumetric flow rate follows:

Q = πR4 / (8μ) × (−dP/dx)

This fourth-power dependence on radius is the key engineering insight: halving the pipe radius reduces flow by a factor of 16 for the same driving pressure. The simulator shows this directly with the radius slider.

Reynolds Number and Flow Regimes

The dimensionless Reynolds number characterises the balance between inertial and viscous forces:

Re = ρ uavg D / μ

where D = 2R is the diameter, ρ is fluid density, and uavg = umax/2. Below Re ≈ 2100 flow is laminar and the parabolic profile holds exactly. Between 2100 and 4000 the flow is transitional; above 4000 it is turbulent and the flat “turbulent core” profile replaces the parabola. The simulator renders the appropriate profile shape and colours the regime indicator accordingly.

Fluid Presets

Five fluid presets span a viscosity range of five orders of magnitude:

Try it: set fluid to Air and increase velocity until Re > 4000. Watch the velocity profile flatten from a parabola to a turbulent “plug” shape. Then switch to Honey and observe how the same pressure gradient yields a hundred times lower average velocity.

Next Steps

Wave 52 will push further into algorithms and probability. Candidates include Hamming error-correcting codes (SECDED, syndrome decoding), regression to the mean (bivariate normal scatter and the Sports Illustrated Curse), and cyclic cellular automata (spiral wave emergence from N-state threshold rules). As always, suggestions via the contact page are welcome.