1
$\begingroup$

I am currently trying to reproduce a semi-analytical solution, where $U_0$ satisfies the PDE under the Black-Scholes model, $\mathcal{M}$ represents some differential operators, such as derivatives with respect to time $t$. Given such a complex recursive form involving the integrals of $U_n$, can Mathematica handle it? I found myself quite foolish as I directly used Integrate and failed to obtain a solution.

enter image description here

My code is:

T = 1;
r = 0.04;
kappa = 1;
theta = 0.25;
sigma = 0.1;

eta[\[Tau]_, x_, v_] := 
 Exp[-1/8 v (2 r/v + 1)^2 \[Tau] + 1/2 (2 r/v + 1) x]
dmPlus[t_, x_, v_] := (-x + (r + v/2) (T - t))/Sqrt[v (T - t)]
dmMinus[t_, x_, v_] := (-x + (r - v/2) (T - t))/Sqrt[v (T - t)]
dmR[t_, x_, v_] := dmPlus[t, x, v] - 2 r/Sqrt[v] Sqrt[T - t]
G[t_, x_, \[Xi]_, v_] := 
 1/(Sqrt[2 \[Pi] v t])*(Exp[-(x - \[Xi])^2/(2 v t)] + 
    Exp[-(x + \[Xi])^2/(2 v t)] + (2 r/v + 1) Integrate[
      Exp[-(x + \[Xi] + \[Eta])^2/(2 v t) + 
        0.5 (2 r/v + 1) \[Eta]], {\[Eta], 0, \[Infinity]}, 
      Assumptions -> 
       1/(t v) > 0 && (0.04` t - 1.` x - 1.` \[Xi])/(t v) < -0.5])
normal[z_] := CDF[NormalDistribution[0, 1], z]

U0[t_, x_, v_] := 
 Exp[x] Exp[-r (T - t)] normal[-dmMinus[t, x, v]] - 
  normal[-dmPlus[t, x, v]] + 
  v/(2 r) (Exp[-r (T - t)] normal[dmPlus[t, x, v]] - 
     Exp[x + 2 x r/v] normal[dmR[t, x, v]])
MU0[t_, x_, v_] := 
 kappa (theta - v) D[U0[t, x, v], v] + 
  0.5 sigma^2 v D[D[U0[t, x, v], v], v]
Uhat[\[Tau]_, x_, v_] := 
 Integrate[
  Integrate[
   eta[s, \[Xi], v] *MU0[T - s, \[Xi], v] *
    G[\[Tau] - s, x, \[Xi], v], {\[Xi], 0, \[Infinity]}, 
   Assumptions -> \[Tau] > s > 0 && x > 0 && v > 0], {s, 0, \[Tau]}]
$\endgroup$
14
  • 1
    $\begingroup$ "I directly used Integrate and failed to obtain a solution." This sounds strange, coding such recursive formula in Mathematica should be straightforward. How do you try using Integrate? Please show us the code. (Notice you may need Inactive to avoid unnecessary integration. ) $\endgroup$
    – xzczd
    Commented Apr 12 at 4:01
  • $\begingroup$ Another thing that's worth mentioning is, you cannot directly differentiate the integral using D, see the following 2 posts for more info: mathematica.stackexchange.com/q/223456/1871 mathematica.stackexchange.com/q/223880/1871 $\endgroup$
    – xzczd
    Commented Apr 12 at 4:14
  • $\begingroup$ @xzczd I posted my code, but found that Uhat cannot be solved. How can I solve this issue? Thanks $\endgroup$ Commented Apr 12 at 5:48
  • $\begingroup$ I don't understand your code: it does not seem to code the recursion. You should have something like U[n_,..]:= U[n, ... ] = function of (U[n-1,...]) $\endgroup$
    – chris
    Commented Apr 12 at 6:02
  • $\begingroup$ @chris Yes, you are right. The Uhat I am solving for now corresponds to $n=1$, but I am stuck at the step from $n=0$ to $n=1$. $\endgroup$ Commented Apr 12 at 6:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.