simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

sum.md (948B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      2 
      3 # Function sum
      4 
      5 Compute the sum of a matrix or a list with values.
      6 In case of a (multi dimensional) array or matrix, the sum of all
      7 elements will be calculated.
      8 
      9 
     10 ## Syntax
     11 
     12 ```js
     13 math.sum(a, b, c, ...)
     14 math.sum(A)
     15 ```
     16 
     17 ### Parameters
     18 
     19 Parameter | Type | Description
     20 --------- | ---- | -----------
     21 `args` | ... * | A single matrix or or multiple scalar values
     22 
     23 ### Returns
     24 
     25 Type | Description
     26 ---- | -----------
     27 * | The sum of all values
     28 
     29 
     30 ### Throws
     31 
     32 Type | Description
     33 ---- | -----------
     34 
     35 
     36 ## Examples
     37 
     38 ```js
     39 math.sum(2, 1, 4, 3)               // returns 10
     40 math.sum([2, 1, 4, 3])             // returns 10
     41 math.sum([[2, 5], [4, 3], [1, 7]]) // returns 22
     42 ```
     43 
     44 
     45 ## See also
     46 
     47 [mean](mean.md),
     48 [median](median.md),
     49 [min](min.md),
     50 [max](max.md),
     51 [prod](prod.md),
     52 [std](std.md),
     53 [variance](variance.md),
     54 [cumsum](cumsum.md)