Wave 52 at a glance
Gambler's Ruin
Exact ruin probability formula, Monte Carlo path browser, Kelly criterion and expected duration.
Open simulation โStochastic Processes
BM, Geometric BM (Black-Scholes), Ornstein-Uhlenbeck, and correlated Brownian motion with confidence bands.
Open simulation โK-Fold Symmetry
Draw a single stroke and watch it reflected into 2โ16 symmetric sectors. Dihedral mirror mode, palette presets, Save PNG.
Open simulation โ๐ฒ Gambler's Ruin
The Gambler's Ruin problem asks: a player starts with wealth W and bets one unit at a time, winning with probability p and losing with probability q = 1 โ p. Play stops when wealth reaches the target T (win) or zero (ruin). What is the probability of eventual ruin?
Analytical solution
The exact formula depends on whether the game is fair:
-
If p โ 0.5:
P(ruin | W) = [(q/p)^W โ (q/p)^T] / [1 โ (q/p)^T] -
If p = 0.5 (fair game):
P(ruin | W) = (T โ W) / T
For a slightly unfavourable game (e.g. casino roulette with p โ 0.4737), starting at W = 50 with target T = 100 already gives a ruin probability exceeding 98%. The asymmetry is enormous even for small deviations from fair.
Kelly criterion
The Kelly criterion gives the bet fraction that maximises long-run wealth growth. For simple even-money bets:
Monte Carlo
The simulation generates up to 200 independent random walk paths simultaneously. Paths are coloured red when they hit ruin (wealth = 0), green when they reach the target, and violet for paths still in progress. The Monte Carlo estimate of P(ruin) converges rapidly to the analytical formula.
๐ Stochastic Processes & Wiener Process
A Wiener process (standard Brownian motion) is a continuous-time random process W(t) satisfying: W(0) = 0; increments W(t) โ W(s) are Gaussian with mean 0 and variance t โ s; increments over non-overlapping intervals are independent. It is the scaling limit of a simple random walk and the building block of stochastic calculus.
Four process modes
1. Standard Brownian Motion (Wiener process)
SDE: dX = ฮผ dt + ฯ dW โ additive drift plus Gaussian noise. Variance grows linearly: Var[X(t)] = ฯยฒt. The shaded confidence band shows the ยฑ1ฯ envelope around the theoretical mean path.
2. Geometric Brownian Motion (GBM โ Black-Scholes stock model)
SDE: dS = ฮผS dt + ฯS dW. The solution is S(t) = Sโ exp((ฮผ โ ฯยฒ/2)t + ฯW(t)). Log-returns are normally distributed; prices are log-normal and always positive. This is the model underlying the Black-Scholes option pricing formula.
3. Ornstein-Uhlenbeck process (mean reversion)
SDE: dX = ฮบ(ฮธ โ X) dt + ฯ dW. The parameter ฮบ controls how quickly the process reverts to the long-run mean ฮธ. Used for modelling interest rates (Vasicek model), commodity prices, and inter-spike intervals in neuroscience. Variance converges to ฯยฒ/(2ฮบ) as t โ โ.
4. Correlated Brownian Motion pair
Two arithmetic BM processes sharing correlated noise: dWโ = ฯ dWโ + โ(1โฯยฒ) dZ, where Z โฅ Wโ. Blue paths are Xโ and pink paths are Xโ. The correlation ฯ โ (โ1, 1) controls how tightly coupled they move โ relevant for modelling correlated assets in portfolio theory.
The white path is the sample mean across all simulated paths. For all modes the mean converges to the theoretical expectation as the path count increases.
๐ฏ K-Fold Rotational Symmetry
Rotational symmetry of order K means an object looks identical after a rotation of 360ยฐ/K. The symmetry group is the cyclic group Cโ. When reflections are also included (mirror mode) the group becomes the dihedral group Dโ, doubling the number of copies.
Drawing algorithm
Every stroke segment from (xโ, yโ) to (xโ, yโ) is first translated to the canvas centre, then drawn K times, each copy rotated by k ร 2ฯ/K from the previous. In dihedral mode a mirror copy (y โ โy before rotation) is added for each sector, producing 2K copies total.
Because strokes are accumulated on a persistent offscreen canvas, details build up progressively to create mandala and kaleidoscope patterns. The guide lines (faint sector dividers) update in real time as K is changed.
Wallpaper groups
The preset buttons correspond to the four wallpaper groups achievable with pure rotational symmetry on a lattice:
- p1 โ no rotation symmetry (K = 1, translation only)
- p2 โ 2-fold (180ยฐ) rotation, point symmetry
- p4 โ 4-fold (90ยฐ) rotation, square lattice signature
- p6 โ 6-fold (60ยฐ) rotation, hexagonal lattice โ most common in Islamic geometric art
The finished artwork can be saved as a lossless PNG using the Save PNG button, which triggers a direct canvas โ data-URL download.
What's next
Wave 53 candidates from the queue include fluid simulations (laminar-turbulent transition, boundary layer), fish-school 3D flocking, and Islamic geometric pattern generation. Biology and physics queues are also well stocked. Suggestions welcome via the contact page.