Skip to content

Commit 2cbf029

Browse files
author
Release Manager
committed
gh-35040: Document argument is_open in ManifoldSubset.complement and difference <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> ### 📚 Document argument is_open of methods complement and difference in ManifoldSubset <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> <!-- If it resolves an open issue, please link to the issue here. For example "Closes #1337" --> The argument `is_open` was not documented in the docstrings of `ManifoldSubset.complement` and `ManifoldSubset.difference` ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> - [x ] I have made sure that the title is self-explanatory and the description concisely explains the PR. - [ ] I have linked an issue or discussion. - [ x] I have created tests covering the changes. - [ x] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open pull requests that this PR logically depends on --> <!-- - #xyz: short description why this is a dependency - #abc: ... --> URL: #35040 Reported by: Eric Gourgoulhon Reviewer(s): Matthias Köppe, Tobias Diez
2 parents ee3013b + f02b32b commit 2cbf029

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

src/sage/manifolds/subset.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,11 +2629,13 @@ def complement(self, superset=None, name=None, latex_name=None, is_open=False):
26292629
- ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
26302630
complement in the case the latter has to be created; the default
26312631
is built upon the symbol `\setminus`
2632+
- ``is_open`` -- (default: ``False``) if ``True``, the created subset
2633+
is assumed to be open with respect to the manifold's topology
26322634
26332635
OUTPUT:
26342636
2635-
- instance of :class:`ManifoldSubset` representing the
2636-
subset that is difference of ``superset`` minus ``self``
2637+
- instance of :class:`ManifoldSubset` representing the subset that
2638+
is ``superset`` minus ``self``
26372639
26382640
EXAMPLES::
26392641
@@ -2650,6 +2652,15 @@ def complement(self, superset=None, name=None, latex_name=None, is_open=False):
26502652
...
26512653
TypeError: superset must be a superset of self
26522654
2655+
Demanding that the complement is open makes ``self`` a closed subset::
2656+
2657+
sage: A.is_closed() # False a priori
2658+
False
2659+
sage: A.complement(is_open=True)
2660+
Open subset M_minus_A of the 2-dimensional topological manifold M
2661+
sage: A.is_closed()
2662+
True
2663+
26532664
"""
26542665
if superset is None:
26552666
superset = self.manifold()
@@ -2672,11 +2683,13 @@ def difference(self, other, name=None, latex_name=None, is_open=False):
26722683
- ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
26732684
difference in the case the latter has to be created; the default
26742685
is built upon the symbol `\setminus`
2686+
- ``is_open`` -- (default: ``False``) if ``True``, the created subset
2687+
is assumed to be open with respect to the manifold's topology
26752688
26762689
OUTPUT:
26772690
2678-
- instance of :class:`ManifoldSubset` representing the
2679-
subset that is difference of ``self`` minus ``other``
2691+
- instance of :class:`ManifoldSubset` representing the subset that is
2692+
``self`` minus ``other``
26802693
26812694
EXAMPLES::
26822695
@@ -2706,6 +2719,13 @@ def difference(self, other, name=None, latex_name=None, is_open=False):
27062719
sage: M.difference(O, is_open=True)
27072720
Open subset CO2 of the 2-dimensional topological manifold M
27082721
2722+
Since `O` is open and we have asked `M\setminus O` to be open, `O`
2723+
is a clopen set (if `O\neq M` and `O\neq\emptyset`, this implies that
2724+
`M` is not connected)::
2725+
2726+
sage: O.is_closed() and O.is_open()
2727+
True
2728+
27092729
"""
27102730
# See if it has been created already
27112731
diffs = []

0 commit comments

Comments
 (0)