mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
55 lines
1.5 KiB
Markdown
55 lines
1.5 KiB
Markdown
---
|
|
layout: default
|
|
---
|
|
|
|
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
|
|
|
|
<h1 id="function-mode">Function mode <a href="#function-mode" title="Permalink">#</a></h1>
|
|
|
|
Computes the mode of a set of numbers or a list with values(numbers or characters).
|
|
If there are multiple modes, it returns a list of those values.
|
|
|
|
|
|
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.mode(a, b, c, ...)
|
|
math.mode(A)
|
|
```
|
|
|
|
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`args` | ... * | A single matrix
|
|
|
|
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
* | The mode of all values
|
|
|
|
|
|
<h3 id="throws">Throws <a href="#throws" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
|
|
|
|
<h2 id="examples">Examples <a href="#examples" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.mode(2, 1, 4, 3, 1) // returns [1]
|
|
math.mode([1, 2.7, 3.2, 4, 2.7]) // returns [2.7]
|
|
math.mode(1, 4, 6, 1, 6) // returns [1, 6]
|
|
math.mode('a','a','b','c') // returns ["a"]
|
|
math.mode(1, 1.5, 'abc') // returns [1, 1.5, "abc"]
|
|
```
|
|
|
|
|
|
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
|
|
|
|
[median](median.html),
|
|
[](.html),
|
|
[mean](mean.html)
|