simple-squiggle

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

setCartesian.md (1055B)


      1 <!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
      2 
      3 # Function setCartesian
      4 
      5 Create the cartesian product of two (multi)sets.
      6 Multi-dimension arrays will be converted to single-dimension arrays
      7 and the values will be sorted in ascending order before the operation.
      8 
      9 
     10 ## Syntax
     11 
     12 ```js
     13 math.setCartesian(set1, set2)
     14 ```
     15 
     16 ### Parameters
     17 
     18 Parameter | Type | Description
     19 --------- | ---- | -----------
     20 `a1` | Array &#124; Matrix | A (multi)set
     21 `a2` | Array &#124; Matrix | A (multi)set
     22 
     23 ### Returns
     24 
     25 Type | Description
     26 ---- | -----------
     27 Array &#124; Matrix | The cartesian product of two (multi)sets
     28 
     29 
     30 ### Throws
     31 
     32 Type | Description
     33 ---- | -----------
     34 
     35 
     36 ## Examples
     37 
     38 ```js
     39 math.setCartesian([1, 2], [3, 4])        // returns [[1, 3], [1, 4], [2, 3], [2, 4]]
     40 math.setCartesian([4, 3], [2, 1])        // returns [[3, 1], [3, 2], [4, 1], [4, 2]]
     41 ```
     42 
     43 
     44 ## See also
     45 
     46 [setUnion](setUnion.md),
     47 [setIntersect](setIntersect.md),
     48 [setDifference](setDifference.md),
     49 [setPowerset](setPowerset.md)