h2 number="18.9"><span class="header-section-number">18.9</span> Recursive Functions</h2>
<p>Stan supports recursive function definitions, which can be useful for
some applications. For instance, consider the matrix power operation,
<span class="math inline">\(A^n\)</span>, which is defined for a square matrix <span class="math inline">\(A\)</span> and positive integer
<span class="math inline">\(n\)</span> by
<span class="math display">\[
A^n
=
\begin{cases}
\textrm{I} &amp; \quad\text{if } n = 0, \text{ a