mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
51 lines
1.4 KiB
Markdown
51 lines
1.4 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-setmultiplicity">Function setMultiplicity <a href="#function-setmultiplicity" title="Permalink">#</a></h1>
|
|
|
|
Count the multiplicity of an element in a multiset.
|
|
A multi-dimension array will be converted to a single-dimension array before the operation.
|
|
|
|
|
|
<h2 id="syntax">Syntax <a href="#syntax" title="Permalink">#</a></h2>
|
|
|
|
```js
|
|
math.setMultiplicity(element, set)
|
|
```
|
|
|
|
<h3 id="parameters">Parameters <a href="#parameters" title="Permalink">#</a></h3>
|
|
|
|
Parameter | Type | Description
|
|
--------- | ---- | -----------
|
|
`e` | number | BigNumber | Fraction | Complex | An element in the multiset
|
|
`a` | Array | Matrix | A multiset
|
|
|
|
<h3 id="returns">Returns <a href="#returns" title="Permalink">#</a></h3>
|
|
|
|
Type | Description
|
|
---- | -----------
|
|
number | The number of how many times the multiset contains the element
|
|
|
|
|
|
<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.setMultiplicity(1, [1, 2, 2, 4]) // returns 1
|
|
math.setMultiplicity(2, [1, 2, 2, 4]) // returns 2
|
|
```
|
|
|
|
|
|
<h2 id="see-also">See also <a href="#see-also" title="Permalink">#</a></h2>
|
|
|
|
[setDistinct](setDistinct.html),
|
|
[setSize](setSize.html)
|