intersect - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


union

set union operator

intersect

set intersection operator

minus

set difference operator

subset

subset operator

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

Calling Sequence

s1 union s2

s1s2

s1 intersect s2

s1s2

s1 minus s2

s1s2

s1 subset s2

s1s2

`union`(s1, s2, s3,...)

 

`intersect`(s1, s2, s3, ...)

 

`minus`(s1,s2)

 

`subset`(s1,s2)

 

Parameters

s1, s2, s3, ...

-

sets or expressions

Description

• 

The union, intersect, minus, and subset routines are used for the set union, intersection, difference, and subset operations.  The union and intersect routines are infix, associative, commutative, n-ary operators. The minus and subset routines are binary infix operators.

  

For information on the order of precedence of these operators, see operator precedence.

• 

If an argument is an expression, it must be possible for that object to evaluate to a set.  If any argument cannot be assigned a set, an error is returned.  For example, the union of 1,2,3 and 4 returns an error, while the union of 1,2,3 and S returns unevaluated.

• 

You can enter these commands using either the 1-D or 2-D calling sequences.  For example, {a,b} union {b,c} is equivalent to a,bb,c.

• 

When using the union(s1,s2) calling sequence in 1-D Math notation, you must enclose union in backquotes since it is a keyword: `union`(s1,s2). In 2-D Math notation, backquotes are not necessary.

  

Note: The set operations are based on address tests.  If two set elements appear to be the same but have different addresses, the test fails.  This is illustrated by the final example.

Thread Safety

• 

The set operators are thread safe as of Maple 15.

Examples

a,bunionb,c

a,b,c

(1)

a,bintersectb,c

b

(2)

a,bminusb,c

a

(3)

aunionbuniona

ab

(4)

3,4unionaunion3,7

a3,4,7

(5)

3,4unionaunion3,7

a3,4,7

(6)

aintersectbintersecta

ab

(7)

3,4intersectaintersect3,7

a3

(8)

`intersect`3,4,a,3,7

a3

(9)

minus and subset are binary operators.

aminusbminusa

aba

(10)

aminusbminusa

(11)

3,4minus3,7

4

(12)

a,bsubseta,b,c,d

true

(13)

a,bsubseta,c,d,e

false

(14)

asubsetbunionc

abc

(15)

The order of precedence for set operators is: intersect, union and minus, then subset.

1,2subset1,3,7union2,4

true

(16)

1,2union1,2,3intersect3,4,5

1,2,3

(17)

1,2union1,2,3intersect3,4,5

3

(18)

The set operations are based on address test. If two set elements appear to be the same but have different addresses, the test fails.

Aetypee,integer:Betypee,integer:

AsubsetB

false

(19)

AintersectB

(20)

See Also

expand

operator precedence

symmdiff

type/integer

type/intersect

type/minus

type/subset

type/union