In physics, and elsewhere, stochastic processes are often simulated as white-noise processes. These processes are idealized and typically justified as the limit of exponentially correlated colored noise. The white approximation is not always accurate, and sometimes it is necessary to simulated colored noise.
Following Fox’s work , I wrote this note to demonstrate how to simulate colored noise.
Consider the stochastic differential equation where the time derivative of state variable is given by some nonlinear process as well as Gaussian white noise . Gaussian white noise is defined by the derivative of Brownian motion (Brownian motion is called the Wiener process in some mathematical literature) such that
We can write a stochastic differential equation (SDE) then
where the mean of the noise is zero, and autocorrelation (correlation with itself over time) is given by the Dirac delta function
with the diffusion constant. Because the delta function has dimensions of the inverse of its argument, has dimensions of and thus must have dimensions of . The reason for calling this noise “white” is evident because the power spectrum, or the absolute value of the Fourier transform of the correlation in time is
a constant for all frequencies. The process only requires the first two probability moments because it is Gaussian. We now have the stochastic difference equation
and we see that because the noise is additive (and noticing ), the mean value of the solution is equal to the solution without noise, or the typical ODE. The fact that the stochastic equation corresponds with our typical intuition for integrals is due to a subtle distinction in the type of calculus chosen: the Itô calculus. I hope to write more about this soon.
To discretize the solution and compute numerically, we calculate an increment of the Wiener process (i.e. ). We can use the Box-Muller algorithm to generate zero mean and unit standard deviation Gaussian pseudo random numbers using 2 uniform random numbers as
The Euler-Marayuma scheme then leads to the numerical implementation
If instead colored noise is desired, the easiest to implement is exponentially correlated noise defined by
where is the characteristic time of the noise and . We computed the power spectrum of the white noise process above, and we do the same here for colored noise by taking the Fourier transform:
so that the power spectrum is for exponentially distributed noise is Lorentzian
We generate the trajectories of a variable experiencing exponentially correlated noise or the so-called “Ornstein-Uhlenbeck process'' by solving the system of equations
A subtle note is that the initial value of the exponential noise can be chosen as a Gaussian random variable so that really we have that the mean of the auto-correlation function is exponentially distributed for all initial values of . So a full solver of the set of equations above is to generate as a Gaussian random number using the Box-Muller algorithm , then loop through the recipe:
(3) generate another Gaussian random number with Box-Muller and two new uniform numbers
(4) compute and return to step 1
 Fox et al. “Fast, accurate algorithm for numerical simulation of exponentially correlated colored noise.'' Physical Review A 38.11 (1988): 5938.
 Box and Muller. “A note on the generation of random normal deviates.'' The Annals of Mathematical Statistics 29 (1958): 610-611.