Opened 2 years ago

# declare_union yields wrong results — at Version 4

Reported by: Owned by: gh-mjungmath major sage-9.7 manifolds sets, union egourgoulhon, tscrim N/A #31680

```sage: M = Manifold(3, 'M')
sage: U = M.open_subset('U'); V = M.open_subset('V'); W = M.open_subset('W')
sage: M.declare_union(U, V, W)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-c7f527dcc1ea> in <module>()
----> 1 M.declare_union(U, V, W)

TypeError: declare_union() takes 3 positional arguments but 4 were given

sage: def label(element):
....:     try:
....:         return element._name
....:     except AttributeError:
....:         return '[' + ', '.join(sorted(x._name for x in element)) + ']'

sage: P = M.subset_poset(open_covers=True); P.plot(element_labels={element: label(element) for element in P})

sage: M.declare_union(U, V.union(W))
sage: P = M.subset_poset(open_covers=True); P.plot(element_labels={element: label(element) for element in P})

sage: U.union(V).union(W)
Open subset U_union_V_union_W of the 3-dimensional differentiable manifold M
sage: P = M.subset_poset(open_covers=True); P.plot(element_labels={element: label(element) for element in P})

sage: U.union(V.union(W))
3-dimensional differentiable manifold M
sage: P = M.subset_poset(open_covers=True); P.plot(element_labels={element: label(element) for element in P})  # same

```

I propose to allow more than two arguments for `declare_union`. Furthermore, something went wrong with the commutativity of the union. This should be investigated, too.

### comment:1 Changed 22 months ago by mkoeppe

• Milestone changed from sage-9.2 to sage-9.3

### comment:2 Changed 16 months ago by mkoeppe

• Milestone changed from sage-9.3 to sage-9.4

Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review.

### comment:3 Changed 16 months ago by mkoeppe

Unions of several subsets also appear in another form - as open covers (which are merely lists of subsets and not manifold subsets in their own right). One might ask whether this could be unified as well.

### comment:4 Changed 16 months ago by mkoeppe

• Dependencies set to #31680
• Description modified (diff)
Note: See TracTickets for help on using tickets.