Box–Muller Gaussian Transform
📐 Definition
Section titled “📐 Definition”The Box–Muller method maps two independent uniform samples on ((0,1)) to a pair of independent standard normal variables using logarithm, square root, and trigonometric transforms.
Domain and Codomain
Section titled “Domain and Codomain”Accepts uniform random inputs; outputs real-valued Gaussian samples with zero mean and unit variance.
⚙️ Key Properties
Section titled “⚙️ Key Properties”The transform yields independent variables. The Jacobian ensures the correct density under ideal arithmetic; extremely small values are often clamped to avoid overflow in .
Fixing to a constant collapses the phase and destroys the rotational symmetry; the outputs are no longer Gaussian (e.g. gives and , which is Rayleigh-distributed). Restricting to one output simply discards half of each uniform pair; each component is still .
🎯 Special Cases and Limits
Section titled “🎯 Special Cases and Limits”- Using only discards half of each uniform pair.
- Extremely small requires care due to .
🔗 Related Functions
Section titled “🔗 Related Functions”Gaussian white noise uses the generated samples; inverse-CDF Gaussian sampling provides an alternative; the Marsaglia polar method avoids trigonometric evaluations while producing the same distribution.
Usage in Oakfield
Section titled “Usage in Oakfield”Oakfield uses Box–Muller-style transforms internally when it needs Gaussian deviates from uniform RNGs:
- White-noise stimuli (e.g.
stimulus_white_noise) use Gaussian sampling to populate noise fields deterministically from a seed. - Stochastic operators (e.g.
stochastic_noise) generate Gaussian sources for OU-style updates. - Integrator stochastic hooks use an internal RNG to generate Gaussian noise by default (with uniform/Laplace alternatives available).
Historical Foundations
Section titled “Historical Foundations”📜 Transform Sampling
Section titled “📜 Transform Sampling”The Box–Muller transform is a classic method for turning uniform random variables into Gaussian samples using an analytic change of variables.
🌍 Modern Perspective
Section titled “🌍 Modern Perspective”While often superseded by faster methods in high-performance settings, it remains a standard reference implementation due to simplicity and exactness.
📚 References
Section titled “📚 References”- Box & Muller, “A Note on the Generation of Random Normal Deviates” (1958)
- Devroye, Non-Uniform Random Variate Generation