I am trying to do something very simple in Mathematica 9. I want to play around with option pricing and for that I thought it best to use the new stochastic process functionality.
So, first of all I simulate one instance of a geometric brownian motion:
$$ \frac{dX_t}{X_t} = \mu dt + \sigma dW_t\\ dW_t \sim N(0, 1) $$
Which in Mathematica is:
proc = ItoProcess[
\[DifferentialD]x[t]/
x[t] == σ \[DifferentialD]w[t] + μ \[DifferentialD]t,
x[t],
{x, x0},
t,
w \[Distributed] WienerProcess[]];
And here's an example of what I get, when I plot it, assuming $X_0 = 100$.
So, okay, when I create a plot of a RandomFunction
of the process, then I actually plot the TemporalData
for $X_t$ and not $dX_t$. Cool, whatever.
But now I want to plot, say $f(dX_t)$ or $f(X_t)$, where I would like to define $f$ as I see fit. And this is where I hit a brick wall. I have tried looking for hints in the docs or for answers here, but there are no definitive ones or the ones that seem to work.
I also feel, that I'm missing something fundamental here. Could somebody kindly suggest an answer or the venue of inquiry?
TemporalData
objecttd
,Normal[td]
gives the list of time-value pairs. You can apply yourf
to this list - e.g.f/@Normal[td][[All,2]]
. $\endgroup$