Function setMultiplicity #
计算多重集中某个元素的数量。在操作之前,多维数组将被转换为一维数组。
Syntax #
math.setMultiplicity(element, set)
Parameters #
| Parameter | Type | Description |
|---|---|---|
e |
number | BigNumber | Fraction | Complex | 多重集中的一个元素 |
a |
Array | Matrix | 一个多重集 |
Returns #
| Type | Description |
|---|---|
| number | 多重集包含该元素的次数 |
Throws #
Type | Description —- | ———–
Examples #
math.setMultiplicity(1, [1, 2, 2, 4]) // returns 1
math.setMultiplicity(2, [1, 2, 2, 4]) // returns 2