Truncated lognormal moment (source code)

= Truncated lognormal moment
{title2=$\mathbb E[S^p1_{\{S>K\}}]$}

If $\log S=m+sZ$ with $s>0$, $K>0$ and $Z$ having the <standard normal distribution>, then for every real $p$,
$$
\begin{aligned}
\mathbb E[S^p\mathbf1_{\{S>K\}}]&=e^{pm+p^2s^2/2}\Phi\!\left(\frac{m+ps^2-\log K}{s}\right),\\
\mathbb E[S^p\mathbf1_{\{S<K\}}]&=e^{pm+p^2s^2/2}\Phi\!\left(\frac{\log K-m-ps^2}{s}\right).
\end{aligned}
$$
Here $\Phi$ is the <standard normal distribution function>. Multiplying the <normal distribution> density by $e^{psZ}$ and completing the square shifts its mean by $ps$ and supplies the factor $e^{p^2s^2/2}$; this is a <Gaussian exponential tilt>. Integrating above or below the shifted threshold proves both formulas. They apply to noninteger and negative powers, including the inverse-price moment $p=-1$. The lower-tail formula gives the <European power put formula> after a <binomial theorem> expansion.