Explicit Ornstein-Uhlenbeck solution (source code)

= Explicit Ornstein-Uhlenbeck solution

The solution of
$$
dX_t=-\lambda X_t\,dt+dB_t,\qquad X_0=x,
$$
is
$$
X_t=xe^{-\lambda t}+\int_0^te^{-\lambda(t-s)}\,dB_s.
$$
It has variance $(1-e^{-2\lambda t})/(2\lambda)$. Starting from $N(0,(2\lambda)^{-1})$ makes it stationary with covariance $e^{-\lambda|t-s|}/(2\lambda)$.