UNPKG

889 BMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function setMultiplicity
4
5Count the multiplicity of an element in a multiset.
6A multi-dimension array will be converted to a single-dimension array before the operation.
7
8
9## Syntax
10
11```js
12math.setMultiplicity(element, set)
13```
14
15### Parameters
16
17Parameter | Type | Description
18--------- | ---- | -----------
19`e` | number &#124; BigNumber &#124; Fraction &#124; Complex | An element in the multiset
20`a` | Array &#124; Matrix | A multiset
21
22### Returns
23
24Type | Description
25---- | -----------
26number | The number of how many times the multiset contains the element
27
28
29## Examples
30
31```js
32math.setMultiplicity(1, [1, 2, 2, 4]) // returns 1
33math.setMultiplicity(2, [1, 2, 2, 4]) // returns 2
34```
35
36
37## See also
38
39[setDistinct](setDistinct.md),
40[setSize](setSize.md)