2
$\begingroup$

Here's the probability (I think) that a particle in Brownian motion (w/ standard deviation $\sqrt{t}$) will exceed $m$ between times $t_1$ and $t_2$:

$$\frac1{2\sqrt{2\pi}}\int_{-\infty }^m \frac1{\sqrt{t_1}}e^{-\frac{x^2}{2t_1}}\left(1+\mathrm{erf}\left(\frac{m-x}{2\sqrt{t_2-t_1}}\right)\right)\mathrm{d}x$$

or, in Mathematica (slightly different form):

p[m_,t1_,t2_] := Integrate[ 
 PDF[NormalDistribution[0,Sqrt[t1]]][x]* 
 CDF[NormalDistribution[x, Sqrt[2]*Sqrt[t2-t1]]][m], 
{x,-Infinity,m}, Assumptions -> { 
 t2 >= t1 >= 0, Element[m,Reals], Element[t2, Reals], Element[t1, Reals]} 
] 

Mathematica can numerically integrate this for specific values of m, t1, and t2, but it's not superfast.

I now want to find the partial derivatives of p[] with respect to each of its variables. Ideally in closed-form (Mathematica can't find one), but a good approximation if not.

I've tried power series and a few other techniques, but I've found nothing good enough for a wide range of values for m, t1, and t2.

Solving this problem will calculate the "Greeks" for box options:

https://money.stackexchange.com/questions/4312/calculating-fair-value-of-an-oanda-com-box-option

  • 0
    Perhaps, there is something wrong in your expression for that probability. I will post an answer soon.2010-11-18
  • 0
    You do know the error function is built-in in *Mathematica* as `Erf[]`?2010-11-19
  • 0
    Yes, I used Mathematica to generate the TeX. I'm not sure why I didn't use it in the Mathematica code, but it shouldn't affect Mathematica's ability to integrate.2010-11-19

1 Answers 1

4

In view of your previous post, the probability you are considering is actually $$ \bar P(m,t_1,t_2) = 1 - \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x},\;\; m \in {\bf R}. $$ This is the complement of the probability considered in your previous post. So, we may consider instead the partial derivatives of $$ P(m,t_1,t_2) = \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x}. $$ Now, erf(x) has derivative ${\rm erf}'(x)= \frac{2}{{\sqrt \pi }}e^{ - x^2 }$, $x > 0$. Then, the partial derivative with respect to $t_2$ is obtained as follows: $$ \frac{{\partial}}{{\partial t_2 }}P(m,t_1 ,t_2 ) = \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {\frac{\partial }{{\partial t_2 }}{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x}, $$ and explicitly, $$ \frac{{\partial}}{{\partial t_2 }}P(m,t_1 ,t_2 ) = \frac{{ - 1}}{{\sqrt {8 \pi ^2 t_1 (t_2 - t_1 )^3 } }}\int_{ - \infty }^m {\exp \bigg[ - \frac{{(m - x)^2 }}{{4(t_2 - t_1 )}} - \frac{{x^2 }}{{2t_1 }}\bigg](m - x){\rm d}x}. $$ (The probability that the maximum is smaller than $m$ decreases as $t_2$ increases, hence the minus sign in this equation.) To find the partial derivative with respect to $m$ corresponds to taking the derivative of a convolution, according to the rule $(f * g)' = f' * g$. Specifically, this says that $$ \frac{{\partial}}{{\partial m }}P(m,t_1 ,t_2 ) = \frac{1}{{\sqrt {2\pi t_1 } }}\int_{ - \infty }^m {\frac{\partial }{{\partial m }}{\rm erf}\bigg(\frac{{m - x}}{{2\sqrt {t_2 - t_1 } }}\bigg)e^{ - x^2 /(2t_1 )} {\rm d}x}, $$ and explicitly, $$ \frac{{\partial}}{{\partial m }}P(m,t_1 ,t_2 ) = \frac{{1}}{{\sqrt {2 \pi ^2 t_1 (t_2 - t_1 ) } }}\int_{ - \infty }^m {\exp \bigg[ - \frac{{(m - x)^2 }}{{4(t_2 - t_1 )}} - \frac{{x^2 }}{{2t_1 }}\bigg]{\rm d}x}. $$ Maybe you can simplify further. The partial derivative with respect to $t_1$ is apparently a quite complicated expression.

  • 2
    The partial derivative with respect to $m$ is equivalent to $\frac{m^2}{\sqrt{2\pi(2t_2-t_1)}}\exp\left(-\frac{m^2}{2(2t_2-t_1)}\right)\left(1+\mathrm{erf}\left(m\sqrt{\frac{t_2-t_1}{t_1(2t_2-t_1)}}\right)\right)$ . The other one looks quite complicated.2010-11-19
  • 0
    Elegant expression! Thank you.2010-11-19
  • 0
    Thanks! I'd actually been looking at the CDF for m, so meant to say "less than or equal to m", but you are correct. I wonder if that's any way to coerce Mathematica into coming up with this answer.2010-11-19
  • 0
    Since I can scale my time unit, I'm wondering if I can set t1 to 1 without loss of generality, hmm... (or t2-t1 to one, and leaving t1 arbitrary)2010-11-19
  • 0
    OK, I think I'm confused by the @/@m derivative, since m is a limit of the integral. Would the fundamental theorem of calculus apply?2010-11-19
  • 0
    @barry: Shai here noted that what you have is expressible as a [convolution](http://mathworld.wolfram.com/Convolution.html), and differentiated accordingly.2010-11-20
  • 0
    @barry: You cannot set $t_1$ (or $t_2 - t_1$) to one.2010-11-21
  • 0
    Thanks, Shai. You're right. I already normalized by setting the standard deviation to 1 over t=1. So I don't think this problem simplifies any further.2010-11-22