Macaulay2 » Documentation
Packages » Macaulay2Doc :: union(Set,Set)
next | previous | forward | backward | up | index | toc

union(Set,Set) -- set union

Synopsis

Description

i1 : set{a,b,c} + set{a,d,f}

o1 = set {c, d, f, a, b}

o1 : Set
i2 : union(set{a,b,c}, set{a,d,f}, set{a,c,e})

o2 = set {c, d, e, f, a, b}

o2 : Set

The function sum can be used to form the union of a list of sets, but this can be slow for long lists.

i3 : x = apply(3, i -> set apply(3, j -> 10*i+j))

o3 = {set {0, 1, 2}, set {12, 10, 11}, set {20, 21, 22}}

o3 : List
i4 : sum x

o4 = set {0, 1, 2, 20, 21, 22, 10, 11, 12}

o4 : Set

See also

Ways to use this method: