p>As an example, the normalizing constant of a left-truncated normal distribution is</p>
<p><span class="math display">\[
  \int_a^\infty \frac{1}{\sqrt{2 \pi \sigma^2}} e^{-\frac{1}{2}\frac{(x - \mu)^2}{\sigma^2}}
\]</span></p>
<p>To compute this integral in Stan, the integrand must first be defined as a Stan function (see the Stan Reference Manual chapter on User-Defined Functions for more information on coding user-defined functions).</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode stan code-