Differential equation with gaussian noise

The equation has the following form:

$$x'' + w^2 x=n$$

$w=1$, $x(0)=1$, $n$ is Gaussian noise with mean $0$ and standard deviation of $1$.

Without the Gaussian noise, i can easily solve the equation numerically by using ODE45 in matlab.The problem is, how can i deal with this equation when the Gaussian noise is taken into consideration?

-
Should the equation be $$x''+w^2 x=n$$ or $$x''+w^{2x}=n$$? –  Pedro Tamaroff Apr 29 '12 at 1:51
The first one..sorry i didn't noticed it before –  axell Apr 29 '12 at 2:28
In general, you need to find the corresponding Fokker-Plank equation for the density function. Some details and references can be found, e.g., in the book The noisy oscillator: The first hundred years –  Artem Apr 29 '12 at 6:27
Basically, what i need to do is to simulate the equation numerically without having to convert it to its correspondences Fokker-Planck equation..because in my real project, i will have to solve a system of stochastic equations derived from Fokker-Planck equation by using Phase Space representation..but for now, the basic is for me to simulate this equation. any other ideas? –  axell Apr 29 '12 at 9:03

Let $X_t$ denote the position of this stochastic oscillator, and $V_t$ denote its velocity. A meaningful interpretation of the quoted differential equation is $$X_t = x_0 + \int_0^t V_s \mathrm{d} s, \quad V_t = v_0 - \omega^2 \int_0^t X_s \mathrm{d} s + \sigma W_t$$ where $W_t$ denotes the standard Wiener process. The deterministic case corresponds to $\sigma = 0$.

In the differential form this SDE reads: $$\mathrm{d} \begin{pmatrix} X_t \\ V_t \end{pmatrix} = \hat{B}.\begin{pmatrix} X_t \\ V_t \end{pmatrix} \mathrm{d} t + \begin{pmatrix} 0 \cr \sigma \end{pmatrix} \mathrm{d} W_t$$ where $\hat{B} = \begin{pmatrix} 0 & 1 \\ -\omega^2 & 0 \end{pmatrix}$. This is an exactly solvable system, with $(X_t, V_t)$ being a Guassian process. It is solved using Ito lemma: $$\mathrm{d} \left( \mathrm{e}^{-\hat{B} t}\cdot \begin{pmatrix} X_t \\ V_t \end{pmatrix} \right) = \mathrm{e}^{-\hat{B} t}\cdot \begin{pmatrix} 0 \cr \sigma \end{pmatrix} \mathrm{d} W_t$$ Which implies $$\begin{pmatrix} X_t \\ V_t \end{pmatrix} = \mathrm{e}^{\hat{B} t} \cdot \begin{pmatrix} x_0 \\ v_0 \end{pmatrix} + \mathrm{e}^{\hat{B} t} \cdot \int_0^t \mathrm{e}^{-\hat{B} s} \begin{pmatrix} 0 \cr \sigma \end{pmatrix} \mathrm{d} W_s$$ Using $$\mathrm{e}^{-\hat{B} t} = \begin{pmatrix} \cos(\omega t) & - \frac{\sin(\omega t)}{\omega} \cr \omega \sin(\omega t) & \cos(\omega t) \end{pmatrix}$$ we arrive at the solution: $$\begin{eqnarray} X_t &=& x_0 \cos(\omega t) + \frac{v_0}{\omega} \sin(\omega t) + \frac{\sigma}{\omega} \int_0^t \sin((t-s) \omega) \mathrm{d} W_s \\ V_t &=& v_0 \cos(\omega t) - x_0 \omega \sin(\omega t) + \sigma \int_0^t \cos((t-s) \omega) \mathrm{d} W_s \end{eqnarray}$$ Since $(X_t, V_t)$ is Gaussian, value of the process at any $t$ is a multinormal random vector with mean and covariance matrix found by using Ito isometry: $$\begin{eqnarray} \mathbb{E}(X_t) &=& x_0 \cos(\omega t) + \frac{v_0}{\omega} \sin(\omega t) \\ \mathbb{E}(V_t) &=& v_0 \cos(\omega t) - x_0 \omega \sin(\omega t) \\ \mathbb{Var}(X_t) &=& \frac{\sigma^2}{\omega^2} \int_0^t \sin^2(\omega (t-s)) \mathrm{d} s = \frac{\sigma^2}{\omega^2} \left( \frac{t}{2} - \frac{\sin(2 \omega t)}{4 \omega} \right) \\ \mathbb{Var}(V_t) &=& \sigma^2 \int_0^t \cos^2(\omega (t-s)) \mathrm{d} s = \sigma^2 \left( \frac{t}{2} + \frac{\sin(2 \omega t)}{4 \omega} \right) \\ \mathbb{Cov}(X_t,V_t) &=& \frac{\sigma^2}{\omega} \int_0^t \sin(\omega (t-s)) \cos(\omega (t-s)) \mathrm{d}s = \sigma^2 \frac{ \sin^2(\omega t)}{2 \omega^2} \end{eqnarray}$$

-
So, how can i simulate this equation then? how can i integrate the wiener increment dWs? As i recall, the analytical equation assumes the form: <x^2>=(σ^2/2ω0) –  axell Apr 30 '12 at 2:57
First, $\mathbb{E}(X_t^2) = \mathbb{Var}(X_t) + \mathbb{E}(X_t)^2$, which is not constant in time. For simulation, please see the book Artem referenced in his answer. –  Sasha Apr 30 '12 at 5:05
Ok. Thank you for all the responses. –  axell May 16 '12 at 3:57

In the case you need to simulate this equation, there are many numerical methods for SDE (stochastic differential equations). The best source to simply start simulations is, in my taste, this book with R examples. (in the simplest example, you can apply the Euler's scheme to turn the system into discrete dynamical system, and then simulate trajectories of this system by using any random number generator).

However, your equation allows complete analytic treatment, although, as far as I can recall, the solution properties are not nice due to the lack of the damping term in the oscillator.

-
I second the recommendation for the Stefano Iacus's book. The book by Fima Klebaner, "Introduction to stochastic calculus with applications" is also highly recommended. –  Sasha Apr 29 '12 at 20:47