union
set union operator
intersect
set intersection operator
minus
set difference operator
subset
subset operator
Calling Sequence
Parameters
Description
Thread Safety
Examples
s1 union s2
s1∪s2
s1 intersect s2
s1∩s2
s1 minus s2
s1∖s2
s1 subset s2
s1⊆s2
`union`(s1, s2, s3,...)
`intersect`(s1, s2, s3, ...)
`minus`(s1,s2)
`subset`(s1,s2)
s1, s2, s3, ...
-
sets or expressions
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,b∪b,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.
The set operators are thread safe as of Maple 15.
a,bunionb,c
a,b,c
a,bintersectb,c
b
a,bminusb,c
a
aunionbuniona
a∪b
3,4unionaunion3,7
a∪3,4,7
aintersectbintersecta
a∩b
3,4intersectaintersect3,7
a∩3
`intersect`⁡3,4,a,3,7
minus and subset are binary operators.
aminusbminusa
a∖b∖a
∅
3,4minus3,7
4
a,bsubseta,b,c,d
true
a,bsubseta,c,d,e
false
asubsetbunionc
a⊆b∪c
The order of precedence for set operators is: intersect, union and minus, then subset.
1,2subset1,3,7union2,4
1,2union1,2,3intersect3,4,5
1,2,3
3
The set operations are based on address test. If two set elements appear to be the same but have different addresses, the test fails.
A≔e↦type⁡e,integer:B≔e↦type⁡e,integer:
AsubsetB
AintersectB
See Also
expand
operator precedence
symmdiff
type/integer
type/intersect
type/minus
type/subset
type/union
Download Help Document