simple-squiggle

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

median.md (1090B)


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