set union operator - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Operations : Sets and lists : union

union - set union operator

intersect - set intersection operator

minus - set difference operator

subset - subset operator

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,b∪b,c

a,b,c

(1)

a,b∩b,c

b

(2)

a,b∖b,c

a

(3)

a∪b∪a

a∪b

(4)

3,4∪a∪3,7

a∪3,4,7

(5)

`union`3,4,a,3,7

a∪3,4,7

(6)

a∩b∩a

a∩b

(7)

3,4∩a∩3,7

a∩3

(8)

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

a∩3

(9)

minus and subset are binary operators.

a∖b∖a

a∖b∖a

(10)

a∖b∖a

(11)

3,4∖3,7

4

(12)

a,b⊆a,c,b,d

true

(13)

a,b⊆a,c,d,e

false

(14)

a⊆b∪c

a⊆b∪c

(15)

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

1,2⊆1,3,7∪2,4

true

(16)

1,2∪1,2,3∩3,4,5

1,2,3

(17)

1,2∪1,2,3∩3,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.

A:=e→typee,'integer':B:=e→typee,'integer':

A⊆B

false

(19)

A∩B

(20)

See Also

expand, operator precedence, symmdiff, type/integer, type/intersect, type/minus, type/subset, type/union


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam