Statistical process control with a mean shift at sample 30.
A process produces a quantity with mean μ and standard deviation σ. Samples of size n are averaged; the means have standard deviation σ/√n, so the control limits are μ0 ± 3σ/√n. A point outside these limits signals a special cause (a false alarm happens with probability 0.0027 per sample).
Capability compares the specification window [LSL, USL] with the spread: Cp = (USL-LSL)/(6σ) and Cpk = min(USL-μ, μ-LSL)/(3σ). The fraction outside specification for a normal process is Φ((LSL-μ)/σ) + 1 - Φ((USL-μ)/σ); a Cpk of 1.33 is a common supplier requirement.
The process is assumed normal and independent; real charts add run rules, non-normal transforms and sigma estimated from the data rather than known.
20,000 individual values are drawn from the shifted process and the fraction beyond the specification limits is compared with the exact normal-tail formula (within four binomial standard errors). The result is shown live under the chart and turns red if the agreement fails.
All random draws come from a seeded 32-bit generator (mulberry32) and Gaussian variates from the Box-Muller transform, so a given seed always produces the same sample on every device; Re-run random seed advances the seed deterministically. Deterministic curves are evaluated on a fixed grid and integrated, where needed, with a fixed-step fourth-order Runge-Kutta scheme whose local error scales with the fifth power of the step; the step sizes used here keep the error far below the drawn line width.
The tiles under the chart are recomputed on every slider move. Quantities labelled exact or analytic come from a closed-form expression; quantities labelled simulated come from the random sample and fluctuate around the exact value by an amount that shrinks as the sample size grows (roughly as one over the square root of the sample size). The green or red box is the automated agreement test between the two.
This page is an educational model, not a decision tool. It is meant to build intuition for how a handful of parameters shape an outcome and how a stated formula can be checked against an independent numerical experiment. Numbers are illustrative unless a unit is given, and results must not be used for real engineering, medical, financial or legal decisions. If you notice a result that contradicts the stated formula, the built-in check is the first place to look: it is designed to fail loudly instead of hiding a disagreement, and a failing check on a sensible parameter set would be a bug worth reporting.
Why does the simulated value never match the exact one perfectly? Because a finite random sample has sampling error; the check box tests that the difference is no larger than four standard errors, which a correct model fails only about once in sixteen thousand runs.
Why are some sliders limited to a narrow range? Outside those ranges the formula is still valid mathematically but the plain-language interpretation stops making sense, or the chart would become unreadable.
Can I embed or share a state? The page keeps no hidden state: the sliders, the seed and the formulas fully determine every number you see, so a screenshot of the sliders is enough to reproduce a result.
Does the chart work on a phone? Yes. The canvas resizes with its container, scales to the device pixel ratio (capped at 2 for smooth drawing), and the controls stack above the chart on narrow screens.