Skip to content

Commit

Permalink
improves the section about the Sum set function
Browse files Browse the repository at this point in the history
  • Loading branch information
hartig committed Sep 22, 2023
1 parent bced028 commit 2de324d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions spec/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9701,16 +9701,17 @@ <h5>Sum</h5>
be 6.0 (float).</p>
<div class="defn">
<p><b>Definition: <span id="defn_aggSum">Sum</span></b></p>
<pre class="code nohighlight">numeric Sum(sequence S)</pre>
<p>L = Flatten(S)</p>
<p>Sum(S) = Sum(L)</p>
<p>Sum(L) = op:numeric-add(L<sub>1</sub>, Sum(L<sub>2..n</sub>)) if <a href="#defn_Card">Card</a>(L) &gt;
<pre class="code nohighlight">numeric <var>Sum</var>(sequence <var>S</var>)</pre>
<p>|Sum|(|S|) = <var>Sum'</var>(|L|),
where |L| = Flatten(|S|)
and <var>Sum'</var>(|L|) is defined recursively as follows.</p>
<p><var>Sum'</var>(|L|) = op:numeric-add(|L|<sub>1</sub>, <var>Sum'</var>(|L|<sub>2..n</sub>)) if <a href="#defn_Card">Card</a>(|L|) &gt;
1<br>
Sum(L) = op:numeric-add(L<sub>1</sub>, 0) if <a href="#defn_Card">Card</a>(L) = 1<br>
Sum(L) = "0"^^xsd:integer if <a href="#defn_Card">Card</a>(L) = 0</p>
<p>In this way, Sum( (1, 2, 3) ) = op:numeric-add(1, op:numeric-add(2,
op:numeric-add(3, 0))).</p>
<var>Sum'</var>(|L|) = op:numeric-add(|L|<sub>1</sub>, 0) if <a href="#defn_Card">Card</a>(|L|) = 1<br>
<var>Sum'</var>(|L|) = "0"^^xsd:integer if <a href="#defn_Card">Card</a>(|L|) = 0</p>
</div>
<p>In this way, <var>Sum</var>( [(1), (2), (3)] ) = <var>Sum'</var>( (1, 2, 3) ) =
op:numeric-add(1, op:numeric-add(2, op:numeric-add(3, 0))).</p>
</section>
<section id="aggAvg">
<h5>Avg</h5>
Expand Down

0 comments on commit 2de324d

Please sign in to comment.