on level3">
<h3 number="4.1.2"><span class="header-section-number">4.1.2</span> Sum, Product, and Log Sum of Exp</h3>
<!-- int; sum; (int[] x); -->
<p></p>
<p><code>int</code> <strong><code>sum</code></strong><code>(int[] x)</code><br>
The sum of the elements in x, defined for <span class="math inline">\(x\)</span> of size <span class="math inline">\(N\)</span> by <span class="math display">\[
\text{sum}(x) = \begin{cases} \sum_{n=1}^N x_n &amp; \text{if} N &gt; 0
\\[4pt] 0 &amp; \text{if} N = 0 \end{cases}