# Use of Ito's lemma in ItoProcess

In the documentation for the ItoProcess it says:

Converting an ItoProcess to standard form automatically makes use of Ito's lemma.

It is unclear to me how this is done, also the example given for the standard form doesn't help.

How can I, for example, apply Ito's lemma on the following stochastic differential equation (SDE) $dS=S(σdB+μdt)$, with $B$ being Brownian motion. Applying Itō's lemma with $f(S)=log(S)$ gives

\begin{align} d\log(S) & = f^\prime(S)\,dS + \frac{1}{2}f^{\prime\prime} (S)S^2\sigma^2 \,dt \\ & = \frac{1}{S} \left( \sigma S\,dB + \mu S\,dt\right) - \frac{1}{2}\sigma^2\,dt \\ &= \sigma\,dB +\left (\mu-\tfrac{\sigma^2}{2} \right )\,dt. \end{align}

It follows that

$$\log (S_t) = \log (S_0) + \sigma B_t + \left (\mu-\tfrac{\sigma^2}{2} \right )t,$$

exponentiating gives the expression for $S$,

$$S_t=S_0\exp\left(\sigma B_t+ \left (\mu-\tfrac{\sigma^2}{2} \right )t\right).$$

How can I achieve that in Mathematica?

-

ItoProcess function only construct an object to represent your SDE. This function will not take the partials and solve your SDE. For this reason, you should use ItoProcess whenever you want to simulate paths of a stochastic process. Let's take the example you provided above.

Suppose I define xt = Log[St] and take the \[mu] and \[sigma] from the evolution of St. As you correctly demonstrated above, it implies that the drift of xt will be \[mu]-\[sigma]^2/2 and the volatility will be \[sigma]. So if you want to simulate the path of St, you can run

St = ItoProcess[{0.03 S, 0.1 S}, {S, 10}, t]
ListLinePlot[RandomFunction[ItoProcess[{0.03 S, 0.1 S}, {S, 10}, t], {0, 1, 0.01}], Filling -> Axis]


Note that in the expression above, the level of the stock price, S, should enter in the drift and volatility.

You can perform a similar exercise and simulate the evolution for xt. In this case, you can evaluate

xt=ItoProcess[{0.03-0.01^2/2,0.1},x,t]
ListLinePlot[RandomFunction[ItoProcess[{0.03 - 0.1^2/2, 0.1 }, x, t], {0, 1, 0.01}],Filling -> Axis].


Note that if you have a more complicated function "f" than Log[S] and you are only interested on the outcome of Ito's Lemma application on this function, you'll need load the package ItosLemma, by Mark Fisher, that can be downloaded here: http://library.wolfram.com/infocenter/MathSource/1170/

The ItosLemma.nb has a clear example on how to use it. Following his example, you only need to load the package

<< ItosLemma


and call ItoMake to represent the SDE satisfied by xt

dx = ItoMake[x[t], \[Mu]-\[Sigma]^2/2, \[Sigma]]


By denoting y = f(x,t), you should use the function ItoD[y] that gives you the Ito's lemma application for any "well behaved" function f.

y = f[x[t], t]
ItoD[y]

-
Thank you, does this package still work with current Mathematica versions? – vonjd Jul 9 '15 at 6:47
Yes, it does. I ran the code above on the latest version. – Diogo Jul 9 '15 at 12:51
I tried to solve the above mentioned problem: dS = S[t]*ItoMake[S[t], \[Mu], \[Sigma]] and ItoD[Log[S[t]]] and got the wrong result dt (\[Mu]/S-\[Sigma]^2/(2 S^2))+(\[Sigma] Subscript[dB, 1])/S. What is even stranger is that I get the same result when I define dS differently: dS = ItoMake[S[t], \[Mu], \[Sigma]] What is going on? – vonjd Jul 11 '15 at 9:18
@dougfromoz: I saw that you are/were a heavy user of this package - could you help to recreate the solution of the example given above? Thank you – vonjd Jul 11 '15 at 16:55
Hi vonjd, try this: 1) dS = ItoMake[S[t], [mu] S, [sigma]S] 2)ItoD[Log[S[t]],t] – Diogo Jul 11 '15 at 19:02