Category Archives: Numerical Examples

Getting your feet wet numerically

Simulate the following stochastic differential equations:

  • \[ dX(t) = – \lambda X(t) dt + dW(t) \]
  • \[ dY(t) = – \lambda Y(t) dt +Y(t) dW(t) \]

by using the following Euler type numerical approximation

  • \[X_{n+1} = X_n – \lambda X_n h + \sqrt{h} \eta_n\]
  • \[Y_{n+1} = Y_n – \lambda Y_n h + \sqrt{h} Y_n\eta_n\]

where \(n=0,1,2,\dots\) and \(h >0\) is a small number that give the numerical step side.  That is to say that we consider \( X_n \) as an approximation of \(X( t) \) and \( Y_n \) as an approximation of \(Y( t) \) each with \(t=h n\).  Here \(\eta_n\) are a collection of mutually independent random variables each with a Gaussian distribution with mean zero and variance one. (That is \( N(0,1) \).)

Write code to simulate the two equations using the numerically methods suggested.  Plot some trajectories. Describe how the behavior changes for different choices of \(\lambda\). Can you conjecture where it changes ? Compare and contrast the behavior of the two equations.

Tell your story with pictures.

Simple Numerical Exercise

Let \(\omega_i\) , \(i=1,\cdots\) be a collection of mutually independent, uniform on \([0,1]\) random variables. Define

\[\eta_i(\omega)= \omega_i -\frac12\]

and

\[X_n(\omega) = \sum_{i=1}^n \eta_i(\omega)\,.\]

 

  1. What is \(\mathbf{E}\,X_n\) ?
  2. What is \(\mathrm{Var}(X_n)\) ?
  3. What is \(\mathbf{E}\,X_{n+k} | X_n \) for \(n, k >0\) ?
  4. What is \(\mathbf{E}(\,X_5^2 \,|\, X_3)\) ?
  5. [optional] Write a computer program to simulate some realizations of this process viewing \(n\) as time. Plot some plots of \(n\) vs \(X_n\).
  6. [optional] How do you simulations agree with the first two parts ?