simple-squiggle

A restricted subset of Squiggle
Log | Files | Refs | README

setMultiplicity.md (941B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      2 
      3 # Function setMultiplicity
      4 
      5 Count the multiplicity of an element in a multiset.
      6 A multi-dimension array will be converted to a single-dimension array before the operation.
      7 
      8 
      9 ## Syntax
     10 
     11 ```js
     12 math.setMultiplicity(element, set)
     13 ```
     14 
     15 ### Parameters
     16 
     17 Parameter | 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 
     24 Type | Description
     25 ---- | -----------
     26 number | The number of how many times the multiset contains the element
     27 
     28 
     29 ### Throws
     30 
     31 Type | Description
     32 ---- | -----------
     33 
     34 
     35 ## Examples
     36 
     37 ```js
     38 math.setMultiplicity(1, [1, 2, 2, 4])    // returns 1
     39 math.setMultiplicity(2, [1, 2, 2, 4])    // returns 2
     40 ```
     41 
     42 
     43 ## See also
     44 
     45 [setDistinct](setDistinct.md),
     46 [setSize](setSize.md)