Truncated discounted Brownian first passage (source code)

= Truncated discounted Brownian first passage
{title2=$\mathbb E[e^{-rH_a}\mathbf1\{H_a\leq T\}]$}

When $d=\sqrt{c^2+2r}$ is real and nonnegative, the discounted <drifted Brownian first-passage density> is $e^{a(c-d)}h_d(t)$. Integrating yields $e^{a(c-d)}\Phi((dT-a)/\sqrt T)+e^{a(c+d)}\Phi((-a-dT)/\sqrt T)$. In a <Black-Scholes model> with $c=(r-\sigma^2/2)/\sigma$, the identity $c^2+2r=(r+\sigma^2/2)^2/\sigma^2$ ensures this formula covers every real interest rate.