I have been struggling for a half hour to post my question but always getting the same error:
Your post appears to contain code that is not properly formatted as code. Please indent all code by 4 spaces using the code toolbar button or the CTRL+K keyboard shortcut. For more editing help, click the [?] toolbar icon.
I have done my best to put code blocks where appropriate but the error persists. Would really appreciate any help!
Full text of my question
I am a Mathematica novice. For an operations research application, I am trying to work with the following wealth process in Mathematica, $$ d W_t = (\rho W_t + P_t) dt\ , $$ where $P_t$ is a stream of payoffs that itself follows a geometric Brownian motion: $$ d P_t = \mu P_t dt + \sigma P_t dZ_t\ . $$ Unfortunately, I cannot represent this problem as a standard Ito process and thus take advantage of Mathematica's rich in-built features. Just as in that case, I would like to be able to perform simulations, compute expected values of functions of terminal wealth, etc.
Here is what I've tried so far to compute, for example, the expected value.
WealthEvolve := Simplify[
DSolve[{
W'[t] == (\[Rho] W[t] + P[t]),
W[0] == w - k
},
W[t],
t
]]
FinalWealth[t_] := W[t] /. WealthEvolve[[1]]
This gives the expected output
E^(t \[Rho]) (-k + w +
Inactive[Integrate][E^(-\[Rho] K[1]) P[K[1]], {K[1], 0, t}])
If I now go ahead and evaluate
Simplify[
Activate[
FinalWealth[t] /.
P -> Mean[GeometricBrownianMotionProcess[\[Mu], \[Sigma], p]]
]]
It does not evaluate, even though the expression looks correct.
E^(t \[Rho]) (-k + w + \!\(
\*SubsuperscriptBox[\(\[Integral]\), \(0\), \(t\)]\(\(
\*SuperscriptBox[\(E\), \(\(-\[Rho]\)\ K[1]\)]\ \(Mean[
GeometricBrownianMotionProcess[\[Mu], \[Sigma], p]]\)[
K[1]]\) \[DifferentialD]K[1]\)\))
Does anyone have any insight as to why?
I am also stuck when it comes to simulations. My intuition tells me that I for any $t$, I need to need to sample from LogNormalDistribution
and then evaluate the following integral for that $t$, but I am not sure how to do this. I would be grateful for any insight!