Release Stats
New Simulations
Law of Large Numbers
Roll dice, flip coins, or sample continuous distributions. Watch the running mean X̄ converge to the true μ in real time with animated ±σ/√N confidence bands and a live histogram.
Open simulation →Fusion Reactor
Interactive D–T tokamak using the Bosch–Hale 〈σv〉(T) parametric fit. Tune plasma temperature, density, and confinement time to cross the Lawson criterion and achieve ignition (Q ≥ 10).
Open simulation →Molecular Spectroscopy
Beer–Lambert IR absorption spectra for H₂O, CO₂, CH₄, HCl, and NH₃, with temperature-dependent P/R-branch rotational fine structure and a vibrational energy level diagram.
Open simulation →Law of Large Numbers
The classic Bernoulli theorem — that the sample mean of i.i.d. random variables converges in probability to the population expectation μ — is one of the most important results in all of probability theory, yet it is surprisingly hard to develop intuition for from text alone.
The simulator offers eight source distributions: d6/d4/d20 dice, a fair coin, standard Gaussian, exponential (λ=1), a bimodal (±3) mixture, and a custom Bernoulli (p=0.3). Speed can be set to ×1, ×10, or ×100 samples per animation frame to show both the early-phase wild fluctuations and the eventual tight convergence. Two canvas panels run in tandem: the top shows the running mean trace against the true μ dashed line, optionally with filled ±σ/√N and ±2σ/√N bands; the bottom shows a live 30-bin histogram with a theoretical PDF overlay.
Technical details
- Box–Muller transform for the Gaussian distribution.
-
Int32Array(30)histogram withO(1)bin update — no re-binning on every frame. - Confidence bands computed analytically from the population standard deviation σ (exact for most presets).
- Die-face emoji display (⚀ –⚅) and coin face (🪙G/R) for the discrete distributions.
Fusion Reactor
Nuclear fusion requires three conditions to be met simultaneously: sufficient plasma temperature T (so nuclei have enough kinetic energy to tunnel through the Coulomb barrier), sufficient density n (so collisions are frequent), and sufficient energy confinement time τE (so energy is retained long enough for self-heating to dominate). The Lawson criterion combines the latter two into a single figure of merit: nτE.
The simulator uses the Bosch–Hale (1992) parametric fit for the Maxwell-averaged D–T reactivity 〈σv〉(T), valid from 0.5–550 keV. Fusion power is computed as Pf = (n²/4)·〈σv〉·QDT·V where QDT = 17.58 MeV = 2.82×10⁻¹² J. The Q-value (fusion gain) is Pf/Pheating.
Plasma states
- Sub-Lawson — nτ < 0.5×10²⁰ m⁻³ s.
- Below break-even — Q < 1, net energy loss.
- Break-even — Q ≥ 1 (ITER design goal ≈ 10).
- Burning plasma — Q ≥ 5, alpha heating dominates.
- Ignition — Q ≥ 10, self-sustaining burn.
The animating temperature sweep scans 1–200 keV, passing through the D–T reactivity peak near 65 keV. The tokamak cross-section canvas shows glow intensity and colour shifting from blue-white (cold plasma) to red-orange (hot igniting plasma) continuously.
Molecular Spectroscopy
Infrared spectroscopy is the workhorse technique of analytical and physical chemistry: every polar chemical bond absorbs IR radiation at characteristic frequencies that match its fundamental vibrational mode. The simulator renders Beer–Lambert transmission spectra T(ν̃) = exp(−A(ν̃)) across 400–4000 cm⁻¹.
Each molecular band is modelled with a Lorentzian lineshape whose half-width is inversely coupled to the instrumental resolution slider. For diatomics (HCl) and near-diatomics with a large rotational constant B (H₂O at B = 27.88 cm⁻¹, NH₃, CH₄), the P- and R-branch structure is resolved: individual rotational lines are placed at ν̃ = ν̃0 ± 2BJ, weighted by a Boltzmann population (2J+1)·exp(−hcBJ(J+1)/kT), with J ranging up to a temperature-dependent Jmax.
Molecule presets
- H₂O: 1595 cm⁻¹ (ν2 bend), 3400 (ν1 sym. stretch), 3756 (ν3 antisym.). Key atmospheric greenhouse gas.
- CO₂: 667 cm⁻¹ (ν2 bend, degenerate), 2349 (ν3 antisym. stretch). IR-inactive symmetric stretch omitted by selection rules.
- CH₄: 1306 cm⁻¹ (ν4 deformation), 3017 (ν3 C–H stretch). Tetrahedral symmetry.
- HCl: 2886 cm⁻¹ (ν1) with clear P/R fine structure. ¹H + ₃⁵Cl.
- NH₃: 950 cm⁻¹ umbrella inversion, 1627 (ν4), 3337 (ν1), 3444 (ν3).
Technical Notes
All three simulations are self-contained single-page HTML5/CSS/JS
files with zero external dependencies. The LLN convergence canvas
redraws in under 2 ms at 10,000 samples; the tokamak glow uses
createRadialGradient at 80 radial arc points per frame
without WebGL. The spectroscopy engine pre-allocates a
Float32Array(1200) absorptance buffer and evaluates each
Lorentzian sweep in a single tight loop, completing a full
4000 cm⁻¹ spectrum in under 4 ms.
Tags
Probability Law of Large Numbers Bernoulli’s Theorem Convergence Statistics Plasma Physics Fusion Reactor Tokamak Lawson Criterion D-T Fusion Physical Chemistry IR Spectroscopy Beer-Lambert Rotational Fine Structure Wave 39