UNPKG

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