mathjs/docs/reference/functions/setIntersect.md
2017-06-30 15:16:08 +02:00

1.3 KiB

layout
default

Function setIntersect #

Create the intersection of two (multi)sets. Multi-dimension arrays will be converted to single-dimension arrays before the operation.

Syntax #

math.setIntersect(set1, set2)

Parameters #

Parameter Type Description
a1 Array | Matrix A (multi)set
a2 Array | Matrix A (multi)set

Returns #

Type Description
Array | Matrix The intersection of two (multi)sets

Examples #

math.setIntersect([1, 2, 3, 4], [3, 4, 5, 6]);            // returns [3, 4]
math.setIntersect([[1, 2], [3, 4]], [[3, 4], [5, 6]]);    // returns [3, 4]

See also #

setUnion, setDifference