Normal mean posterior with an exponential prior (source code)

= Normal mean posterior with an exponential prior
{title2=$\mu\mid x\sim N(\bar x-\lambda\sigma^2/n,\sigma^2/n)\text{ truncated to }[0,\infty)$}

For <independent and identically distributed> observations from a <normal distribution> with known <variance> $\sigma^2$, an <exponential distribution> prior of rate $\lambda$ on their nonnegative mean gives this <truncated normal distribution> <posterior>. Complete the square in $-n(\mu-\bar x)^2/(2\sigma^2)-\lambda\mu$; the truncation remains essential even when the untruncated normal mean is negative.