|
Calling Sequence
|
|
s1 union s2
|
|
s1 intersect s2
|
|
s1 minus s2
|
|
s1 subset s2
|
|
`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.
|
•
|
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 and returns an error, while the union of 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 .
|
•
|
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
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
>
|
|
minus and subset are binary operators.
>
|
|
>
|
|
>
|
|
The order of precedence for set operators is: intersect, union and minus, then subset.
>
|
|
>
|
|
>
|
|
The set operations are based on address test. If two set elements appear to be the same but have different addresses, the test fails.
>
|
|
|
|
|