Skip to content

Sum ​

Generated from the engine's own definition: compute-engine's symbol, which we neither extend nor document by hand.

Sum(f, [a, b]) computes the sum of f from a to b; Sum(L) sums the elements of a collection L

✓ checked against that system · ! checked, with disagreements (hover a chip)WikipediaSummationMathWorldSumWikidataQ218005Britannicatopic/summandFungrimSum✓Fungrim entryFindStatSt000165via ParkingFunction✓Wolfram LanguageSum✓
Sum(any, tuple*) -> numberSum(f, [a, b]) computes the sum of f from a to b; Sum(L) sums the elements of a collection L
SageMathsum(any, tuple*)SymPysummation(any, tuple*)
Typed signatures
TypePackageApplies
(any, tuple*) -> numberanalyticreplaces evaluationalways
(any, tuple*) -> numbercompute-enginealways
(any, tuple*) -> numberevaluationreplaces compute-enginealways

Domain: Compute engine

Examples

Basic #

Sum of squares up to 10, using the default start of 1

live ↗
In∑k10k2\sum_{k}^{10}k^2Out385385

The Basel-type sum, ζ(6)=π6/945\zeta(6)=\pi^6/945

live ↗
In∑k=1∞1k6\sum_{k=1}^{∞}\frac{1}{k^6}Outπ6945\frac{π^6}{945}

The members of the subset {1,3}\{1, 3\} of {1,…,4}\{1, \dots, 4\}

live ↗
InCombinatorialStat(Finset⁡(Tuple⁡(4,[1,3])),Sum)\mathrm{CombinatorialStat}(\operatorname{Finset}(\operatorname{Tuple}(4,\bigl\lbrack1, 3\bigr\rbrack)), \text{Sum})Out44

The inversion table 01100110, whose sum is the permutation's inversion count

live ↗
InCombinatorialStat(PermutationInversion⁡([0,1,1,0]),Sum)\mathrm{CombinatorialStat}({\operatorname{PermutationInversion}}([0, 1, 1, 0]), \text{Sum})Out22

The subexcedant sequence 00110011

live ↗
InCombinatorialStat(SubexcedantSeq⁡([0,0,1,1]),Sum)\mathrm{CombinatorialStat}({\operatorname{SubexcedantSeq}}([0, 0, 1, 1]), \text{Sum})Out22
Scope #
live ↗
In∑k=1∞1k2\sum_{k=1}^{∞}\frac{1}{k^2}Outπ26\frac{π^2}{6}
About
Examples6
Checked againstWolfram Language 3 agreeSageMath 3 agreeSymPy 3 agreemathlib4 1 agree
CrosswalkWikipediaMathWorldWikidataBritannicaFungrimFungrim entry ×47FindStatWolfram LanguageSageMathSymPy

Implementation

mappedsympypackages/oracle/src/mappings.ts

The iterator (Limits or Tuple, k from a to b, or from 1 when a is Nothing) is emitted as SymPy's (k, a, b). SymPy sums reversed bounds by Karr's convention: b < a - 1 gives a negative sum.

mappedsagepackages/oracle/src/mappings.ts
mappedmathlib4packages/oracle/src/mappings.ts

The emitter reads the iterator Limits(k, a, b) or Tuple(k, a, b), from 1 when a is Nothing or left out, as the summand's lambda, a and b. Over ℤ, or ℕ where the summand needs one. An empty range is 0, as ours.