Subsets of Topological Manifolds#
The class ManifoldSubset
implements generic subsets of a
topological manifold. Open subsets are implemented by the class
TopologicalManifold
(since an
open subset of a manifold is a manifold by itself), which inherits
from ManifoldSubset
. Besides, subsets that are images of
a manifold subset under a continuous map are implemented by the
subclass ImageManifoldSubset
.
AUTHORS:
Eric Gourgoulhon, Michal Bejger (2013-2015): initial version
Travis Scrimshaw (2015): review tweaks; removal of facade parents
Matthias Koeppe (2021): Families and posets of subsets
REFERENCES:
EXAMPLES:
Two subsets on a manifold:
sage: M = Manifold(2, 'M', structure='topological')
sage: a = M.subset('A'); a
Subset A of the 2-dimensional topological manifold M
sage: b = M.subset('B'); b
Subset B of the 2-dimensional topological manifold M
sage: M.subset_family()
Set {A, B, M} of subsets of the 2-dimensional topological manifold M
>>> from sage.all import *
>>> M = Manifold(Integer(2), 'M', structure='topological')
>>> a = M.subset('A'); a
Subset A of the 2-dimensional topological manifold M
>>> b = M.subset('B'); b
Subset B of the 2-dimensional topological manifold M
>>> M.subset_family()
Set {A, B, M} of subsets of the 2-dimensional topological manifold M
The intersection of the two subsets:
sage: c = a.intersection(b); c
Subset A_inter_B of the 2-dimensional topological manifold M
>>> from sage.all import *
>>> c = a.intersection(b); c
Subset A_inter_B of the 2-dimensional topological manifold M
Their union:
sage: d = a.union(b); d
Subset A_union_B of the 2-dimensional topological manifold M
>>> from sage.all import *
>>> d = a.union(b); d
Subset A_union_B of the 2-dimensional topological manifold M
Families of subsets after the above operations:
sage: M.subset_family()
Set {A, A_inter_B, A_union_B, B, M} of subsets of the 2-dimensional topological manifold M
sage: a.subset_family()
Set {A, A_inter_B} of subsets of the 2-dimensional topological manifold M
sage: c.subset_family()
Set {A_inter_B} of subsets of the 2-dimensional topological manifold M
sage: d.subset_family()
Set {A, A_inter_B, A_union_B, B} of subsets of the 2-dimensional topological manifold M
>>> from sage.all import *
>>> M.subset_family()
Set {A, A_inter_B, A_union_B, B, M} of subsets of the 2-dimensional topological manifold M
>>> a.subset_family()
Set {A, A_inter_B} of subsets of the 2-dimensional topological manifold M
>>> c.subset_family()
Set {A_inter_B} of subsets of the 2-dimensional topological manifold M
>>> d.subset_family()
Set {A, A_inter_B, A_union_B, B} of subsets of the 2-dimensional topological manifold M
- class sage.manifolds.subset.ManifoldSubset(manifold, name: str, latex_name=None, category=None)[source]#
Bases:
UniqueRepresentation
,Parent
Subset of a topological manifold.
The class
ManifoldSubset
inherits from the generic classParent
. The corresponding element class isManifoldPoint
.Note that open subsets are not implemented directly by this class, but by the derived class
TopologicalManifold
(an open subset of a topological manifold being itself a topological manifold).INPUT:
manifold
– topological manifold on which the subset is definedname
– string; name (symbol) given to the subsetlatex_name
– (default:None
) string; LaTeX symbol to denote the subset; if none are provided, it is set toname
category
– (default:None
) to specify the category; ifNone
, the category for generic subsets is used
EXAMPLES:
A subset of a manifold:
sage: M = Manifold(2, 'M', structure='topological') sage: from sage.manifolds.subset import ManifoldSubset sage: A = ManifoldSubset(M, 'A', latex_name=r'\mathcal{A}') sage: A Subset A of the 2-dimensional topological manifold M sage: latex(A) \mathcal{A} sage: A.is_subset(M) True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> from sage.manifolds.subset import ManifoldSubset >>> A = ManifoldSubset(M, 'A', latex_name=r'\mathcal{A}') >>> A Subset A of the 2-dimensional topological manifold M >>> latex(A) \mathcal{A} >>> A.is_subset(M) True
Instead of importing
ManifoldSubset
in the global namespace, it is recommended to use the methodsubset()
to create a new subset:sage: B = M.subset('B', latex_name=r'\mathcal{B}'); B Subset B of the 2-dimensional topological manifold M sage: M.subset_family() Set {A, B, M} of subsets of the 2-dimensional topological manifold M
>>> from sage.all import * >>> B = M.subset('B', latex_name=r'\mathcal{B}'); B Subset B of the 2-dimensional topological manifold M >>> M.subset_family() Set {A, B, M} of subsets of the 2-dimensional topological manifold M
The manifold is itself a subset:
sage: isinstance(M, ManifoldSubset) True sage: M in M.subsets() True
>>> from sage.all import * >>> isinstance(M, ManifoldSubset) True >>> M in M.subsets() True
Instances of
ManifoldSubset
are parents:sage: isinstance(A, Parent) True sage: A.category() Category of subobjects of sets sage: p = A.an_element(); p Point on the 2-dimensional topological manifold M sage: p.parent() Subset A of the 2-dimensional topological manifold M sage: p in A True sage: p in M True
>>> from sage.all import * >>> isinstance(A, Parent) True >>> A.category() Category of subobjects of sets >>> p = A.an_element(); p Point on the 2-dimensional topological manifold M >>> p.parent() Subset A of the 2-dimensional topological manifold M >>> p in A True >>> p in M True
- Element[source]#
alias of
ManifoldPoint
- ambient()[source]#
Return the ambient manifold of
self
.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: A = M.subset('A') sage: A.manifold() 2-dimensional topological manifold M sage: A.manifold() is M True sage: B = A.subset('B') sage: B.manifold() is M True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> A = M.subset('A') >>> A.manifold() 2-dimensional topological manifold M >>> A.manifold() is M True >>> B = A.subset('B') >>> B.manifold() is M True
An alias is
ambient
:sage: A.ambient() is A.manifold() True
>>> from sage.all import * >>> A.ambient() is A.manifold() True
- closure(name=None, latex_name=None)[source]#
Return the topological closure of
self
as a subset of the manifold.INPUT:
name
– (default:None
) name given to the difference in the case the latter has to be created; the default prependscl_
toself._name
latex_name
– (default:None
) LaTeX symbol to denote the difference in the case the latter has to be created; the default is built upon the operator \(\mathrm{cl}\)
OUTPUT:
if
self
is already known to be closed (seeis_closed()
),self
; otherwise, an instance ofManifoldSubsetClosure
EXAMPLES:
sage: M = Manifold(2, 'R^2', structure='topological') sage: c_cart.<x,y> = M.chart() # Cartesian coordinates on R^2 sage: M.closure() is M True sage: D2 = M.open_subset('D2', coord_def={c_cart: x^2+y^2<2}); D2 Open subset D2 of the 2-dimensional topological manifold R^2 sage: cl_D2 = D2.closure(); cl_D2 Topological closure cl_D2 of the Open subset D2 of the 2-dimensional topological manifold R^2 sage: cl_D2.is_closed() True sage: cl_D2 is cl_D2.closure() True sage: D1 = D2.open_subset('D1'); D1 Open subset D1 of the 2-dimensional topological manifold R^2 sage: D1.closure().is_subset(D2.closure()) True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'R^2', structure='topological') >>> c_cart = M.chart(names=('x', 'y',)); (x, y,) = c_cart._first_ngens(2)# Cartesian coordinates on R^2 >>> M.closure() is M True >>> D2 = M.open_subset('D2', coord_def={c_cart: x**Integer(2)+y**Integer(2)<Integer(2)}); D2 Open subset D2 of the 2-dimensional topological manifold R^2 >>> cl_D2 = D2.closure(); cl_D2 Topological closure cl_D2 of the Open subset D2 of the 2-dimensional topological manifold R^2 >>> cl_D2.is_closed() True >>> cl_D2 is cl_D2.closure() True >>> D1 = D2.open_subset('D1'); D1 Open subset D1 of the 2-dimensional topological manifold R^2 >>> D1.closure().is_subset(D2.closure()) True
- complement(superset=None, name=None, latex_name=None, is_open=False)[source]#
Return the complement of
self
in the manifold or insuperset
.INPUT:
superset
– (default:self.manifold()
) a superset ofself
name
– (default:None
) name given to the complement in the case the latter has to be created; the default issuperset._name
minusself._name
latex_name
– (default:None
) LaTeX symbol to denote the complement in the case the latter has to be created; the default is built upon the symbol \(\setminus\)is_open
– (default:False
) ifTrue
, the created subset is assumed to be open with respect to the manifold’s topology
OUTPUT:
instance of
ManifoldSubset
representing the subset that issuperset
minusself
EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: A = M.subset('A') sage: B1 = A.subset('B1') sage: B2 = A.subset('B2') sage: B1.complement() Subset M_minus_B1 of the 2-dimensional topological manifold M sage: B1.complement(A) Subset A_minus_B1 of the 2-dimensional topological manifold M sage: B1.complement(B2) Traceback (most recent call last): ... TypeError: superset must be a superset of self
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> A = M.subset('A') >>> B1 = A.subset('B1') >>> B2 = A.subset('B2') >>> B1.complement() Subset M_minus_B1 of the 2-dimensional topological manifold M >>> B1.complement(A) Subset A_minus_B1 of the 2-dimensional topological manifold M >>> B1.complement(B2) Traceback (most recent call last): ... TypeError: superset must be a superset of self
Demanding that the complement is open makes
self
a closed subset:sage: A.is_closed() # False a priori False sage: A.complement(is_open=True) Open subset M_minus_A of the 2-dimensional topological manifold M sage: A.is_closed() True
>>> from sage.all import * >>> A.is_closed() # False a priori False >>> A.complement(is_open=True) Open subset M_minus_A of the 2-dimensional topological manifold M >>> A.is_closed() True
- declare_closed()[source]#
Declare
self
to be a closed subset of the manifold.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: A = M.subset('A') sage: B1 = A.subset('B1') sage: B1.is_closed() False sage: B1.declare_closed() sage: B1.is_closed() True sage: B2 = A.subset('B2') sage: cl_B2 = B2.closure() sage: A.declare_closed() sage: cl_B2.is_subset(A) True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> A = M.subset('A') >>> B1 = A.subset('B1') >>> B1.is_closed() False >>> B1.declare_closed() >>> B1.is_closed() True >>> B2 = A.subset('B2') >>> cl_B2 = B2.closure() >>> A.declare_closed() >>> cl_B2.is_subset(A) True
- declare_empty()[source]#
Declare that
self
is the empty set.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: A = M.subset('A', is_open=True) sage: AA = A.subset('AA') sage: A Open subset A of the 2-dimensional topological manifold M sage: A.declare_empty() sage: A.is_empty() True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> A = M.subset('A', is_open=True) >>> AA = A.subset('AA') >>> A Open subset A of the 2-dimensional topological manifold M >>> A.declare_empty() >>> A.is_empty() True
Empty sets do not allow to define points on them:
sage: A.point() Traceback (most recent call last): ... TypeError: cannot define a point on the Open subset A of the 2-dimensional topological manifold M because it has been declared empty
>>> from sage.all import * >>> A.point() Traceback (most recent call last): ... TypeError: cannot define a point on the Open subset A of the 2-dimensional topological manifold M because it has been declared empty
Emptiness transfers to subsets:
sage: AA.is_empty() True sage: AA.point() Traceback (most recent call last): ... TypeError: cannot define a point on the Subset AA of the 2-dimensional topological manifold M because it has been declared empty sage: AD = A.subset('AD') sage: AD.is_empty() True
>>> from sage.all import * >>> AA.is_empty() True >>> AA.point() Traceback (most recent call last): ... TypeError: cannot define a point on the Subset AA of the 2-dimensional topological manifold M because it has been declared empty >>> AD = A.subset('AD') >>> AD.is_empty() True
If points have already been defined on
self
(or its subsets), it is an error to declare it to be empty:sage: B = M.subset('B') sage: b = B.point(name='b'); b Point b on the 2-dimensional topological manifold M sage: B.declare_empty() Traceback (most recent call last): ... TypeError: cannot be empty because it has defined points
>>> from sage.all import * >>> B = M.subset('B') >>> b = B.point(name='b'); b Point b on the 2-dimensional topological manifold M >>> B.declare_empty() Traceback (most recent call last): ... TypeError: cannot be empty because it has defined points
Emptiness is recorded as empty open covers:
sage: P = M.subset_poset(open_covers=True, points=[b]) # needs sage.graphs sage: def label(element): ....: if isinstance(element, str): ....: return element ....: try: ....: return element._name ....: except AttributeError: ....: return '[' + ', '.join(sorted(x._name for x in element)) + ']' sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 10 graphics primitives
>>> from sage.all import * >>> P = M.subset_poset(open_covers=True, points=[b]) # needs sage.graphs >>> def label(element): ... if isinstance(element, str): ... return element ... try: ... return element._name ... except AttributeError: ... return '[' + ', '.join(sorted(x._name for x in element)) + ']' >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 10 graphics primitives
- declare_equal(*others)[source]#
Declare that
self
andothers
are the same sets.INPUT:
others
– finitely many subsets or iterables of subsets of the same manifold asself
.
EXAMPLES:
sage: M = Manifold(2, 'M') sage: U = M.open_subset('U') sage: V = M.open_subset('V') sage: Vs = [M.open_subset(f'V{i}') for i in range(2)] sage: UV = U.intersection(V) sage: W = UV.open_subset('W') sage: P = M.subset_poset() # needs sage.graphs sage: def label(element): ....: return element._name sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 15 graphics primitives sage: V.declare_equal(Vs) sage: P = M.subset_poset() # needs sage.graphs sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 11 graphics primitives sage: W.declare_equal(U) sage: P = M.subset_poset() # needs sage.graphs sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 6 graphics primitives
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M') >>> U = M.open_subset('U') >>> V = M.open_subset('V') >>> Vs = [M.open_subset(f'V{i}') for i in range(Integer(2))] >>> UV = U.intersection(V) >>> W = UV.open_subset('W') >>> P = M.subset_poset() # needs sage.graphs >>> def label(element): ... return element._name >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 15 graphics primitives >>> V.declare_equal(Vs) >>> P = M.subset_poset() # needs sage.graphs >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 11 graphics primitives >>> W.declare_equal(U) >>> P = M.subset_poset() # needs sage.graphs >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 6 graphics primitives
- declare_nonempty()[source]#
Declare that
self
is nonempty.Once declared nonempty,
self
(or any of its supersets) cannot be declared empty.This is equivalent to defining a point on
self
usingpoint()
but is cheaper than actually creating aManifoldPoint
instance.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: A = M.subset('A', is_open=True) sage: AA = A.subset('AA') sage: AA.declare_nonempty() sage: A.has_defined_points() True sage: A.declare_empty() Traceback (most recent call last): ... TypeError: cannot be empty because it has defined points
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> A = M.subset('A', is_open=True) >>> AA = A.subset('AA') >>> AA.declare_nonempty() >>> A.has_defined_points() True >>> A.declare_empty() Traceback (most recent call last): ... TypeError: cannot be empty because it has defined points
- declare_subset(*supersets)[source]#
Declare
self
to be a subset of each of the given supersets.INPUT:
supersets
– other subsets of the same manifold
EXAMPLES:
sage: M = Manifold(2, 'M') sage: U1 = M.open_subset('U1') sage: U2 = M.open_subset('U2') sage: V = M.open_subset('V') sage: V.superset_family() Set {M, V} of open subsets of the 2-dimensional differentiable manifold M sage: U1.subset_family() Set {U1} of open subsets of the 2-dimensional differentiable manifold M sage: P = M.subset_poset() # needs sage.graphs sage: def label(element): ....: return element._name sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 8 graphics primitives sage: V.declare_subset(U1, U2) sage: V.superset_family() Set {M, U1, U2, V} of open subsets of the 2-dimensional differentiable manifold M sage: P = M.subset_poset() # needs sage.graphs sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 9 graphics primitives
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M') >>> U1 = M.open_subset('U1') >>> U2 = M.open_subset('U2') >>> V = M.open_subset('V') >>> V.superset_family() Set {M, V} of open subsets of the 2-dimensional differentiable manifold M >>> U1.subset_family() Set {U1} of open subsets of the 2-dimensional differentiable manifold M >>> P = M.subset_poset() # needs sage.graphs >>> def label(element): ... return element._name >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 8 graphics primitives >>> V.declare_subset(U1, U2) >>> V.superset_family() Set {M, U1, U2, V} of open subsets of the 2-dimensional differentiable manifold M >>> P = M.subset_poset() # needs sage.graphs >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 9 graphics primitives
Subsets in a directed cycle of inclusions are equal:
sage: M.declare_subset(V) sage: M.superset_family() Set {M, U1, U2, V} of open subsets of the 2-dimensional differentiable manifold M sage: M.equal_subset_family() Set {M, U1, U2, V} of open subsets of the 2-dimensional differentiable manifold M sage: P = M.subset_poset() # needs sage.graphs sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 2 graphics primitives
>>> from sage.all import * >>> M.declare_subset(V) >>> M.superset_family() Set {M, U1, U2, V} of open subsets of the 2-dimensional differentiable manifold M >>> M.equal_subset_family() Set {M, U1, U2, V} of open subsets of the 2-dimensional differentiable manifold M >>> P = M.subset_poset() # needs sage.graphs >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 2 graphics primitives
- declare_superset(*subsets)[source]#
Declare
self
to be a superset of each of the given subsets.INPUT:
subsets
– other subsets of the same manifold
EXAMPLES:
sage: M = Manifold(2, 'M') sage: U = M.open_subset('U') sage: V1 = M.open_subset('V1') sage: V2 = M.open_subset('V2') sage: W = V1.intersection(V2) sage: U.subset_family() Set {U} of open subsets of the 2-dimensional differentiable manifold M sage: P = M.subset_poset() # needs sage.graphs sage: def label(element): ....: return element._name sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 11 graphics primitives sage: U.declare_superset(V1, V2) sage: U.subset_family() Set {U, V1, V1_inter_V2, V2} of open subsets of the 2-dimensional differentiable manifold M sage: P = M.subset_poset() # needs sage.graphs sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 11 graphics primitives
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M') >>> U = M.open_subset('U') >>> V1 = M.open_subset('V1') >>> V2 = M.open_subset('V2') >>> W = V1.intersection(V2) >>> U.subset_family() Set {U} of open subsets of the 2-dimensional differentiable manifold M >>> P = M.subset_poset() # needs sage.graphs >>> def label(element): ... return element._name >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 11 graphics primitives >>> U.declare_superset(V1, V2) >>> U.subset_family() Set {U, V1, V1_inter_V2, V2} of open subsets of the 2-dimensional differentiable manifold M >>> P = M.subset_poset() # needs sage.graphs >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 11 graphics primitives
Subsets in a directed cycle of inclusions are equal:
sage: W.declare_superset(U) sage: W.subset_family() Set {U, V1, V1_inter_V2, V2} of open subsets of the 2-dimensional differentiable manifold M sage: W.equal_subset_family() Set {U, V1, V1_inter_V2, V2} of open subsets of the 2-dimensional differentiable manifold M sage: P = M.subset_poset() # needs sage.graphs sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 4 graphics primitives
>>> from sage.all import * >>> W.declare_superset(U) >>> W.subset_family() Set {U, V1, V1_inter_V2, V2} of open subsets of the 2-dimensional differentiable manifold M >>> W.equal_subset_family() Set {U, V1, V1_inter_V2, V2} of open subsets of the 2-dimensional differentiable manifold M >>> P = M.subset_poset() # needs sage.graphs >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 4 graphics primitives
- declare_union(disjoint, *subsets_or_families)[source]#
Declare that the current subset is the union of two subsets.
Suppose \(U\) is the current subset, then this method declares that \(U = \bigcup_{S\in F} S\).
INPUT:
subsets_or_families
– finitely many subsets or iterables of subsetsdisjoint
– (default:False
) whether to declare the subsets pairwise disjoint
EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: AB = M.subset('AB') sage: A = AB.subset('A') sage: B = AB.subset('B') 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 # needs sage.graphs Finite poset containing 4 elements sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 8 graphics primitives sage: AB.declare_union(A, B) sage: A.union(B) Subset AB of the 2-dimensional topological manifold M sage: P = M.subset_poset(open_covers=True); P # needs sage.graphs Finite poset containing 4 elements sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 8 graphics primitives sage: B1 = B.subset('B1', is_open=True) sage: B2 = B.subset('B2', is_open=True) sage: B.declare_union(B1, B2, disjoint=True) sage: P = M.subset_poset(open_covers=True); P # needs sage.graphs Finite poset containing 9 elements sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 19 graphics primitives
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> AB = M.subset('AB') >>> A = AB.subset('A') >>> B = AB.subset('B') >>> def label(element): ... try: ... return element._name ... except AttributeError: ... return '[' + ', '.join(sorted(x._name for x in element)) + ']' >>> P = M.subset_poset(open_covers=True); P # needs sage.graphs Finite poset containing 4 elements >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 8 graphics primitives >>> AB.declare_union(A, B) >>> A.union(B) Subset AB of the 2-dimensional topological manifold M >>> P = M.subset_poset(open_covers=True); P # needs sage.graphs Finite poset containing 4 elements >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 8 graphics primitives >>> B1 = B.subset('B1', is_open=True) >>> B2 = B.subset('B2', is_open=True) >>> B.declare_union(B1, B2, disjoint=True) >>> P = M.subset_poset(open_covers=True); P # needs sage.graphs Finite poset containing 9 elements >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 19 graphics primitives
- difference(other, name=None, latex_name=None, is_open=False)[source]#
Return the set difference of
self
minusother
.INPUT:
other
– another subset of the same manifoldname
– (default:None
) name given to the difference in the case the latter has to be created; the default isself._name
minusother._name
latex_name
– (default:None
) LaTeX symbol to denote the difference in the case the latter has to be created; the default is built upon the symbol \(\setminus\)is_open
– (default:False
) ifTrue
, the created subset is assumed to be open with respect to the manifold’s topology
OUTPUT:
instance of
ManifoldSubset
representing the subset that isself
minusother
EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: A = M.subset('A') sage: CA = M.difference(A); CA Subset M_minus_A of the 2-dimensional topological manifold M sage: latex(CA) M\setminus A sage: A.intersection(CA).is_empty() True sage: A.union(CA) 2-dimensional topological manifold M sage: O = M.open_subset('O') sage: CO = M.difference(O); CO Subset M_minus_O of the 2-dimensional topological manifold M sage: M.difference(O) is CO True sage: CO2 = M.difference(O, is_open=True, name='CO2'); CO2 Open subset CO2 of the 2-dimensional topological manifold M sage: CO is CO2 False sage: CO.is_subset(CO2) and CO2.is_subset(CO) True sage: M.difference(O, is_open=True) Open subset CO2 of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> A = M.subset('A') >>> CA = M.difference(A); CA Subset M_minus_A of the 2-dimensional topological manifold M >>> latex(CA) M\setminus A >>> A.intersection(CA).is_empty() True >>> A.union(CA) 2-dimensional topological manifold M >>> O = M.open_subset('O') >>> CO = M.difference(O); CO Subset M_minus_O of the 2-dimensional topological manifold M >>> M.difference(O) is CO True >>> CO2 = M.difference(O, is_open=True, name='CO2'); CO2 Open subset CO2 of the 2-dimensional topological manifold M >>> CO is CO2 False >>> CO.is_subset(CO2) and CO2.is_subset(CO) True >>> M.difference(O, is_open=True) Open subset CO2 of the 2-dimensional topological manifold M
Since \(O\) is open and we have asked \(M\setminus O\) to be open, \(O\) is a clopen set (if \(O\neq M\) and \(O\neq\emptyset\), this implies that \(M\) is not connected):
sage: O.is_closed() and O.is_open() True
>>> from sage.all import * >>> O.is_closed() and O.is_open() True
- equal_subset_family()[source]#
Generate the declared manifold subsets that are equal to
self
.Note
If you only need to iterate over the equal sets in arbitrary order, you can use the generator method
equal_subsets()
instead.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: U = M.open_subset('U') sage: V = U.subset('V') sage: V.declare_equal(M) sage: V.equal_subset_family() Set {M, U, V} of subsets of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> U = M.open_subset('U') >>> V = U.subset('V') >>> V.declare_equal(M) >>> V.equal_subset_family() Set {M, U, V} of subsets of the 2-dimensional topological manifold M
- equal_subsets()[source]#
Generate the declared manifold subsets that are equal to
self
.Note
To get the equal subsets as a family, sorted by name, use the method
equal_subset_family()
instead.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: U = M.open_subset('U') sage: V = U.subset('V') sage: V.declare_equal(M) sage: sorted(V.equal_subsets(), key=lambda v: v._name) [2-dimensional topological manifold M, Open subset U of the 2-dimensional topological manifold M, Subset V of the 2-dimensional topological manifold M]
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> U = M.open_subset('U') >>> V = U.subset('V') >>> V.declare_equal(M) >>> sorted(V.equal_subsets(), key=lambda v: v._name) [2-dimensional topological manifold M, Open subset U of the 2-dimensional topological manifold M, Subset V of the 2-dimensional topological manifold M]
- get_subset(name)[source]#
Get a subset by its name.
The subset must have been previously created by the method
subset()
(oropen_subset()
)INPUT:
name
– (string) name of the subset
OUTPUT:
instance of
ManifoldSubset
(or of the derived classTopologicalManifold
for an open subset) representing the subset whose name isname
EXAMPLES:
sage: M = Manifold(4, 'M', structure='topological') sage: A = M.subset('A') sage: B = A.subset('B') sage: U = M.open_subset('U') sage: M.subset_family() Set {A, B, M, U} of subsets of the 4-dimensional topological manifold M sage: M.get_subset('A') Subset A of the 4-dimensional topological manifold M sage: M.get_subset('A') is A True sage: M.get_subset('B') is B True sage: A.get_subset('B') is B True sage: M.get_subset('U') Open subset U of the 4-dimensional topological manifold M sage: M.get_subset('U') is U True
>>> from sage.all import * >>> M = Manifold(Integer(4), 'M', structure='topological') >>> A = M.subset('A') >>> B = A.subset('B') >>> U = M.open_subset('U') >>> M.subset_family() Set {A, B, M, U} of subsets of the 4-dimensional topological manifold M >>> M.get_subset('A') Subset A of the 4-dimensional topological manifold M >>> M.get_subset('A') is A True >>> M.get_subset('B') is B True >>> A.get_subset('B') is B True >>> M.get_subset('U') Open subset U of the 4-dimensional topological manifold M >>> M.get_subset('U') is U True
- has_defined_points(subsets=True)[source]#
Return whether any points have been defined on
self
or any of its subsets.INPUT:
subsets
– (default:True
) ifFalse
, only consider points that have been defined directly onself
; ifTrue
, also consider points on all subsets.
EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: A = M.subset('A', is_open=True) sage: AA = A.subset('AA') sage: AA.point() Point on the 2-dimensional topological manifold M sage: AA.has_defined_points() True sage: A.has_defined_points(subsets=False) False sage: A.has_defined_points() True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> A = M.subset('A', is_open=True) >>> AA = A.subset('AA') >>> AA.point() Point on the 2-dimensional topological manifold M >>> AA.has_defined_points() True >>> A.has_defined_points(subsets=False) False >>> A.has_defined_points() True
- intersection(name, latex_name, *others)[source]#
Return the intersection of the current subset with other subsets.
This method may return a previously constructed intersection instead of creating a new subset. In this case,
name
andlatex_name
are not used.INPUT:
others
– other subsets of the same manifoldname
– (default:None
) name given to the intersection in the case the latter has to be created; the default isself._name
interother._name
latex_name
– (default:None
) LaTeX symbol to denote the intersection in the case the latter has to be created; the default is built upon the symbol \(\cap\)
OUTPUT:
instance of
ManifoldSubset
representing the subset that is the intersection of the current subset withothers
EXAMPLES:
Intersection of two subsets:
sage: M = Manifold(2, 'M', structure='topological') sage: a = M.subset('A') sage: b = M.subset('B') sage: c = a.intersection(b); c Subset A_inter_B of the 2-dimensional topological manifold M sage: a.subset_family() Set {A, A_inter_B} of subsets of the 2-dimensional topological manifold M sage: b.subset_family() Set {A_inter_B, B} of subsets of the 2-dimensional topological manifold M sage: c.superset_family() Set {A, A_inter_B, B, M} of subsets of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> a = M.subset('A') >>> b = M.subset('B') >>> c = a.intersection(b); c Subset A_inter_B of the 2-dimensional topological manifold M >>> a.subset_family() Set {A, A_inter_B} of subsets of the 2-dimensional topological manifold M >>> b.subset_family() Set {A_inter_B, B} of subsets of the 2-dimensional topological manifold M >>> c.superset_family() Set {A, A_inter_B, B, M} of subsets of the 2-dimensional topological manifold M
Intersection of six subsets:
sage: T = Manifold(2, 'T', structure='topological') sage: S = [T.subset(f'S{i}') for i in range(6)] sage: [S[i].intersection(S[i+3]) for i in range(3)] [Subset S0_inter_S3 of the 2-dimensional topological manifold T, Subset S1_inter_S4 of the 2-dimensional topological manifold T, Subset S2_inter_S5 of the 2-dimensional topological manifold T] sage: inter_S_i = T.intersection(*S, name='inter_S_i'); inter_S_i Subset inter_S_i of the 2-dimensional topological manifold T sage: inter_S_i.superset_family() Set {S0, S0_inter_S3, S0_inter_S3_inter_S1_inter_S4, S1, S1_inter_S4, S2, S2_inter_S5, S3, S4, S5, T, inter_S_i} of subsets of the 2-dimensional topological manifold T
>>> from sage.all import * >>> T = Manifold(Integer(2), 'T', structure='topological') >>> S = [T.subset(f'S{i}') for i in range(Integer(6))] >>> [S[i].intersection(S[i+Integer(3)]) for i in range(Integer(3))] [Subset S0_inter_S3 of the 2-dimensional topological manifold T, Subset S1_inter_S4 of the 2-dimensional topological manifold T, Subset S2_inter_S5 of the 2-dimensional topological manifold T] >>> inter_S_i = T.intersection(*S, name='inter_S_i'); inter_S_i Subset inter_S_i of the 2-dimensional topological manifold T >>> inter_S_i.superset_family() Set {S0, S0_inter_S3, S0_inter_S3_inter_S1_inter_S4, S1, S1_inter_S4, S2, S2_inter_S5, S3, S4, S5, T, inter_S_i} of subsets of the 2-dimensional topological manifold T
- is_closed()[source]#
Return if
self
is a closed set.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: M.is_closed() True sage: also_M = M.subset('also_M') sage: M.declare_subset(also_M) sage: also_M.is_closed() True sage: A = M.subset('A') sage: A.is_closed() False sage: A.declare_empty() sage: A.is_closed() True sage: N = M.open_subset('N') sage: N.is_closed() False sage: complement_N = M.subset('complement_N') sage: M.declare_union(N, complement_N, disjoint=True) sage: complement_N.is_closed() True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> M.is_closed() True >>> also_M = M.subset('also_M') >>> M.declare_subset(also_M) >>> also_M.is_closed() True >>> A = M.subset('A') >>> A.is_closed() False >>> A.declare_empty() >>> A.is_closed() True >>> N = M.open_subset('N') >>> N.is_closed() False >>> complement_N = M.subset('complement_N') >>> M.declare_union(N, complement_N, disjoint=True) >>> complement_N.is_closed() True
- is_empty()[source]#
Return whether the current subset is empty.
By default, manifold subsets are considered nonempty: The method
point()
can be used to define points on it, either with or without coordinates some chart.However, using
declare_empty()
, a subset can be declared empty, and emptiness transfers to all of its subsets.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: A = M.subset('A', is_open=True) sage: AA = A.subset('AA') sage: A.is_empty() False sage: A.declare_empty() sage: A.is_empty() True sage: AA.is_empty() True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> A = M.subset('A', is_open=True) >>> AA = A.subset('AA') >>> A.is_empty() False >>> A.declare_empty() >>> A.is_empty() True >>> AA.is_empty() True
- is_open()[source]#
Return if
self
is an open set.This method always returns
False
, since open subsets must be constructed as instances of the subclassTopologicalManifold
(which redefinesis_open
)EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: A = M.subset('A') sage: A.is_open() False
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> A = M.subset('A') >>> A.is_open() False
- is_subset(other)[source]#
Return
True
if and only ifself
is included inother
.EXAMPLES:
Subsets on a 2-dimensional manifold:
sage: M = Manifold(2, 'M', structure='topological') sage: a = M.subset('A') sage: b = a.subset('B') sage: c = M.subset('C') sage: a.is_subset(M) True sage: b.is_subset(a) True sage: b.is_subset(M) True sage: a.is_subset(b) False sage: c.is_subset(a) False
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> a = M.subset('A') >>> b = a.subset('B') >>> c = M.subset('C') >>> a.is_subset(M) True >>> b.is_subset(a) True >>> b.is_subset(M) True >>> a.is_subset(b) False >>> c.is_subset(a) False
- lift(p)[source]#
Return the lift of
p
to the ambient manifold ofself
.INPUT:
p
– point of the subset
OUTPUT:
the same point, considered as a point of the ambient manifold
EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: A = M.open_subset('A', coord_def={X: x>0}) sage: p = A((1, -2)); p Point on the 2-dimensional topological manifold M sage: p.parent() Open subset A of the 2-dimensional topological manifold M sage: q = A.lift(p); q Point on the 2-dimensional topological manifold M sage: q.parent() 2-dimensional topological manifold M sage: q.coord() (1, -2) sage: (p == q) and (q == p) True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> X = M.chart(names=('x', 'y',)); (x, y,) = X._first_ngens(2) >>> A = M.open_subset('A', coord_def={X: x>Integer(0)}) >>> p = A((Integer(1), -Integer(2))); p Point on the 2-dimensional topological manifold M >>> p.parent() Open subset A of the 2-dimensional topological manifold M >>> q = A.lift(p); q Point on the 2-dimensional topological manifold M >>> q.parent() 2-dimensional topological manifold M >>> q.coord() (1, -2) >>> (p == q) and (q == p) True
- list_of_subsets()[source]#
Return the list of subsets that have been defined on the current subset.
The list is sorted by the alphabetical names of the subsets.
OUTPUT:
a list containing all the subsets that have been defined on the current subset
Note
This method is deprecated.
To get the subsets as a
ManifoldSubsetFiniteFamily
instance (which sorts its elements alphabetically by name), usesubset_family()
instead.To loop over the subsets in an arbitrary order, use the generator method
subsets()
instead.EXAMPLES:
List of subsets of a 2-dimensional manifold (deprecated):
sage: M = Manifold(2, 'M', structure='topological') sage: U = M.open_subset('U') sage: V = M.subset('V') sage: M.list_of_subsets() doctest:...: DeprecationWarning: the method list_of_subsets of ManifoldSubset is deprecated; use subset_family or subsets instead... [2-dimensional topological manifold M, Open subset U of the 2-dimensional topological manifold M, Subset V of the 2-dimensional topological manifold M]
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> U = M.open_subset('U') >>> V = M.subset('V') >>> M.list_of_subsets() doctest:...: DeprecationWarning: the method list_of_subsets of ManifoldSubset is deprecated; use subset_family or subsets instead... [2-dimensional topological manifold M, Open subset U of the 2-dimensional topological manifold M, Subset V of the 2-dimensional topological manifold M]
Using
subset_family()
instead (recommended when order matters):sage: M.subset_family() Set {M, U, V} of subsets of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M.subset_family() Set {M, U, V} of subsets of the 2-dimensional topological manifold M
The method
subsets()
generates the subsets in an unspecified order. To create a set:sage: frozenset(M.subsets()) # random (set output) {Subset V of the 2-dimensional topological manifold M, 2-dimensional topological manifold M, Open subset U of the 2-dimensional topological manifold M}
>>> from sage.all import * >>> frozenset(M.subsets()) # random (set output) {Subset V of the 2-dimensional topological manifold M, 2-dimensional topological manifold M, Open subset U of the 2-dimensional topological manifold M}
- manifold()[source]#
Return the ambient manifold of
self
.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: A = M.subset('A') sage: A.manifold() 2-dimensional topological manifold M sage: A.manifold() is M True sage: B = A.subset('B') sage: B.manifold() is M True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> A = M.subset('A') >>> A.manifold() 2-dimensional topological manifold M >>> A.manifold() is M True >>> B = A.subset('B') >>> B.manifold() is M True
An alias is
ambient
:sage: A.ambient() is A.manifold() True
>>> from sage.all import * >>> A.ambient() is A.manifold() True
- open_cover_family(trivial=True, supersets=False)[source]#
Return the family of open covers of the current subset.
If the current subset, \(A\) say, is a subset of the manifold \(M\), an open cover of \(A\) is a
ManifoldSubsetFiniteFamily
\(F\) of open subsets \(U \in F\) of \(M\) such that\[A \subset \bigcup_{U \in F} U.\]If \(A\) is open, we ask that the above inclusion is actually an identity:
\[A = \bigcup_{U \in F} U.\]The family is sorted lexicographically by the names of the subsets forming the open covers.
Note
If you only need to iterate over the open covers in arbitrary order, you can use the generator method
open_covers()
instead.INPUT:
trivial
– (default:True
) ifself
is open, include the trivial open cover ofself
by itselfsupersets
– (default:False
) ifTrue
, include open covers of all the supersets; it can also be an iterable of supersets to include
EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: M.open_cover_family() Set {{M}} of objects of the 2-dimensional topological manifold M sage: U = M.open_subset('U') sage: U.open_cover_family() Set {{U}} of objects of the 2-dimensional topological manifold M sage: A = U.open_subset('A') sage: B = U.open_subset('B') sage: U.declare_union(A,B) sage: U.open_cover_family() Set {{A, B}, {U}} of objects of the 2-dimensional topological manifold M sage: U.open_cover_family(trivial=False) Set {{A, B}} of objects of the 2-dimensional topological manifold M sage: V = M.open_subset('V') sage: M.declare_union(U,V) sage: M.open_cover_family() Set {{A, B, V}, {M}, {U, V}} of objects of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> M.open_cover_family() Set {{M}} of objects of the 2-dimensional topological manifold M >>> U = M.open_subset('U') >>> U.open_cover_family() Set {{U}} of objects of the 2-dimensional topological manifold M >>> A = U.open_subset('A') >>> B = U.open_subset('B') >>> U.declare_union(A,B) >>> U.open_cover_family() Set {{A, B}, {U}} of objects of the 2-dimensional topological manifold M >>> U.open_cover_family(trivial=False) Set {{A, B}} of objects of the 2-dimensional topological manifold M >>> V = M.open_subset('V') >>> M.declare_union(U,V) >>> M.open_cover_family() Set {{A, B, V}, {M}, {U, V}} of objects of the 2-dimensional topological manifold M
- open_covers(trivial=True, supersets=False)[source]#
Generate the open covers of the current subset.
If the current subset, \(A\) say, is a subset of the manifold \(M\), an open cover of \(A\) is a
ManifoldSubsetFiniteFamily
\(F\) of open subsets \(U \in F\) of \(M\) such that\[A \subset \bigcup_{U \in F} U.\]If \(A\) is open, we ask that the above inclusion is actually an identity:
\[A = \bigcup_{U \in F} U.\]Note
To get the open covers as a family, sorted lexicographically by the names of the subsets forming the open covers, use the method
open_cover_family()
instead.INPUT:
trivial
– (default:True
) ifself
is open, include the trivial open cover ofself
by itselfsupersets
– (default:False
) ifTrue
, include open covers of all the supersets; it can also be an iterable of supersets to include
EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: M.open_covers() <generator ...> sage: list(M.open_covers()) [Set {M} of open subsets of the 2-dimensional topological manifold M] sage: U = M.open_subset('U') sage: list(U.open_covers()) [Set {U} of open subsets of the 2-dimensional topological manifold M] sage: A = U.open_subset('A') sage: B = U.open_subset('B') sage: U.declare_union(A,B) sage: list(U.open_covers()) [Set {U} of open subsets of the 2-dimensional topological manifold M, Set {A, B} of open subsets of the 2-dimensional topological manifold M] sage: list(U.open_covers(trivial=False)) [Set {A, B} of open subsets of the 2-dimensional topological manifold M] sage: V = M.open_subset('V') sage: M.declare_union(U,V) sage: list(M.open_covers()) [Set {M} of open subsets of the 2-dimensional topological manifold M, Set {U, V} of open subsets of the 2-dimensional topological manifold M, Set {A, B, V} of open subsets of the 2-dimensional topological manifold M]
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> M.open_covers() <generator ...> >>> list(M.open_covers()) [Set {M} of open subsets of the 2-dimensional topological manifold M] >>> U = M.open_subset('U') >>> list(U.open_covers()) [Set {U} of open subsets of the 2-dimensional topological manifold M] >>> A = U.open_subset('A') >>> B = U.open_subset('B') >>> U.declare_union(A,B) >>> list(U.open_covers()) [Set {U} of open subsets of the 2-dimensional topological manifold M, Set {A, B} of open subsets of the 2-dimensional topological manifold M] >>> list(U.open_covers(trivial=False)) [Set {A, B} of open subsets of the 2-dimensional topological manifold M] >>> V = M.open_subset('V') >>> M.declare_union(U,V) >>> list(M.open_covers()) [Set {M} of open subsets of the 2-dimensional topological manifold M, Set {U, V} of open subsets of the 2-dimensional topological manifold M, Set {A, B, V} of open subsets of the 2-dimensional topological manifold M]
- open_subset(name, latex_name=None, coord_def={}, supersets=None)[source]#
Create an open subset of the manifold that is a subset of
self
.An open subset is a set that is (i) included in the manifold and (ii) open with respect to the manifold’s topology. It is a topological manifold by itself. Hence the returned object is an instance of
TopologicalManifold
.INPUT:
name
– name given to the open subsetlatex_name
– (default:None
) LaTeX symbol to denote the subset; if none are provided, it is set toname
coord_def
– (default: {}) definition of the subset in terms of coordinates;coord_def
must a be dictionary with keys charts on the manifold and values the symbolic expressions formed by the coordinates to define the subsetsupersets
– (default: onlyself
) list of sets that the new open subset is a subset of
OUTPUT:
the open subset, as an instance of
TopologicalManifold
or one of its subclasses
EXAMPLES:
sage: M = Manifold(2, 'R^2', structure='topological') sage: c_cart.<x,y> = M.chart() # Cartesian coordinates on R^2 sage: cl_D = M.subset('cl_D'); cl_D Subset cl_D of the 2-dimensional topological manifold R^2 sage: D = cl_D.open_subset('D', coord_def={c_cart: x^2+y^2<1}); D Open subset D of the 2-dimensional topological manifold R^2 sage: D.is_subset(cl_D) True sage: D.is_subset(M) True sage: M = Manifold(2, 'R^2', structure='differentiable') sage: c_cart.<x,y> = M.chart() # Cartesian coordinates on R^2 sage: cl_D = M.subset('cl_D'); cl_D Subset cl_D of the 2-dimensional differentiable manifold R^2 sage: D = cl_D.open_subset('D', coord_def={c_cart: x^2+y^2<1}); D Open subset D of the 2-dimensional differentiable manifold R^2 sage: D.is_subset(cl_D) True sage: D.is_subset(M) True sage: M = Manifold(2, 'R^2', structure='Riemannian') sage: c_cart.<x,y> = M.chart() # Cartesian coordinates on R^2 sage: cl_D = M.subset('cl_D'); cl_D Subset cl_D of the 2-dimensional Riemannian manifold R^2 sage: D = cl_D.open_subset('D', coord_def={c_cart: x^2+y^2<1}); D Open subset D of the 2-dimensional Riemannian manifold R^2 sage: D.is_subset(cl_D) True sage: D.is_subset(M) True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'R^2', structure='topological') >>> c_cart = M.chart(names=('x', 'y',)); (x, y,) = c_cart._first_ngens(2)# Cartesian coordinates on R^2 >>> cl_D = M.subset('cl_D'); cl_D Subset cl_D of the 2-dimensional topological manifold R^2 >>> D = cl_D.open_subset('D', coord_def={c_cart: x**Integer(2)+y**Integer(2)<Integer(1)}); D Open subset D of the 2-dimensional topological manifold R^2 >>> D.is_subset(cl_D) True >>> D.is_subset(M) True >>> M = Manifold(Integer(2), 'R^2', structure='differentiable') >>> c_cart = M.chart(names=('x', 'y',)); (x, y,) = c_cart._first_ngens(2)# Cartesian coordinates on R^2 >>> cl_D = M.subset('cl_D'); cl_D Subset cl_D of the 2-dimensional differentiable manifold R^2 >>> D = cl_D.open_subset('D', coord_def={c_cart: x**Integer(2)+y**Integer(2)<Integer(1)}); D Open subset D of the 2-dimensional differentiable manifold R^2 >>> D.is_subset(cl_D) True >>> D.is_subset(M) True >>> M = Manifold(Integer(2), 'R^2', structure='Riemannian') >>> c_cart = M.chart(names=('x', 'y',)); (x, y,) = c_cart._first_ngens(2)# Cartesian coordinates on R^2 >>> cl_D = M.subset('cl_D'); cl_D Subset cl_D of the 2-dimensional Riemannian manifold R^2 >>> D = cl_D.open_subset('D', coord_def={c_cart: x**Integer(2)+y**Integer(2)<Integer(1)}); D Open subset D of the 2-dimensional Riemannian manifold R^2 >>> D.is_subset(cl_D) True >>> D.is_subset(M) True
- open_superset_family()[source]#
Return the family of open supersets of
self
.The family is sorted by the alphabetical names of the subsets.
OUTPUT:
a
ManifoldSubsetFiniteFamily
instance containing all the open supersets that have been defined on the current subset
Note
If you only need to iterate over the open supersets in arbitrary order, you can use the generator method
open_supersets()
instead.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: U = M.open_subset('U') sage: V = U.subset('V') sage: W = V.subset('W') sage: W.open_superset_family() Set {M, U} of open subsets of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> U = M.open_subset('U') >>> V = U.subset('V') >>> W = V.subset('W') >>> W.open_superset_family() Set {M, U} of open subsets of the 2-dimensional topological manifold M
- open_supersets()[source]#
Generate the open supersets of
self
.Note
To get the open supersets as a family, sorted by name, use the method
open_superset_family()
instead.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: U = M.open_subset('U') sage: V = U.subset('V') sage: W = V.subset('W') sage: sorted(W.open_supersets(), key=lambda S: S._name) [2-dimensional topological manifold M, Open subset U of the 2-dimensional topological manifold M]
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> U = M.open_subset('U') >>> V = U.subset('V') >>> W = V.subset('W') >>> sorted(W.open_supersets(), key=lambda S: S._name) [2-dimensional topological manifold M, Open subset U of the 2-dimensional topological manifold M]
- point(coords=None, chart=None, name=None, latex_name=None)[source]#
Define a point in
self
.See
ManifoldPoint
for a complete documentation.INPUT:
coords
– the point coordinates (as a tuple or a list) in the chart specified bychart
chart
– (default:None
) chart in which the point coordinates are given; ifNone
, the coordinates are assumed to refer to the default chart of the current subsetname
– (default:None
) name given to the pointlatex_name
– (default:None
) LaTeX symbol to denote the point; ifNone
, the LaTeX symbol is set toname
OUTPUT:
the declared point, as an instance of
ManifoldPoint
EXAMPLES:
Points on a 2-dimensional manifold:
sage: M = Manifold(2, 'M', structure='topological') sage: c_xy.<x,y> = M.chart() sage: p = M.point((1,2), name='p'); p Point p on the 2-dimensional topological manifold M sage: p in M True sage: a = M.open_subset('A') sage: c_uv.<u,v> = a.chart() sage: q = a.point((-1,0), name='q'); q Point q on the 2-dimensional topological manifold M sage: q in a True sage: p._coordinates {Chart (M, (x, y)): (1, 2)} sage: q._coordinates {Chart (A, (u, v)): (-1, 0)}
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> c_xy = M.chart(names=('x', 'y',)); (x, y,) = c_xy._first_ngens(2) >>> p = M.point((Integer(1),Integer(2)), name='p'); p Point p on the 2-dimensional topological manifold M >>> p in M True >>> a = M.open_subset('A') >>> c_uv = a.chart(names=('u', 'v',)); (u, v,) = c_uv._first_ngens(2) >>> q = a.point((-Integer(1),Integer(0)), name='q'); q Point q on the 2-dimensional topological manifold M >>> q in a True >>> p._coordinates {Chart (M, (x, y)): (1, 2)} >>> q._coordinates {Chart (A, (u, v)): (-1, 0)}
- retract(p)[source]#
Return the retract of
p
toself
.INPUT:
p
– point of the ambient manifold
OUTPUT:
the same point, considered as a point of the subset
EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: X.<x,y> = M.chart() sage: A = M.open_subset('A', coord_def={X: x>0}) sage: p = M((1, -2)); p Point on the 2-dimensional topological manifold M sage: p.parent() 2-dimensional topological manifold M sage: q = A.retract(p); q Point on the 2-dimensional topological manifold M sage: q.parent() Open subset A of the 2-dimensional topological manifold M sage: q.coord() (1, -2) sage: (q == p) and (p == q) True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> X = M.chart(names=('x', 'y',)); (x, y,) = X._first_ngens(2) >>> A = M.open_subset('A', coord_def={X: x>Integer(0)}) >>> p = M((Integer(1), -Integer(2))); p Point on the 2-dimensional topological manifold M >>> p.parent() 2-dimensional topological manifold M >>> q = A.retract(p); q Point on the 2-dimensional topological manifold M >>> q.parent() Open subset A of the 2-dimensional topological manifold M >>> q.coord() (1, -2) >>> (q == p) and (p == q) True
Of course, if the point does not belong to
A
, theretract
method fails:sage: p = M((-1, 3)) # x < 0, so that p is not in A sage: q = A.retract(p) Traceback (most recent call last): ... ValueError: the Point on the 2-dimensional topological manifold M is not in Open subset A of the 2-dimensional topological manifold M
>>> from sage.all import * >>> p = M((-Integer(1), Integer(3))) # x < 0, so that p is not in A >>> q = A.retract(p) Traceback (most recent call last): ... ValueError: the Point on the 2-dimensional topological manifold M is not in Open subset A of the 2-dimensional topological manifold M
- subset(name, latex_name=None, is_open=False)[source]#
Create a subset of the current subset.
INPUT:
name
– name given to the subsetlatex_name
– (default:None
) LaTeX symbol to denote the subset; if none are provided, it is set toname
is_open
– (default:False
) ifTrue
, the created subset is assumed to be open with respect to the manifold’s topology
OUTPUT:
the subset, as an instance of
ManifoldSubset
, or of the derived classTopologicalManifold
ifis_open
isTrue
EXAMPLES:
Creating a subset of a manifold:
sage: M = Manifold(2, 'M', structure='topological') sage: a = M.subset('A'); a Subset A of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> a = M.subset('A'); a Subset A of the 2-dimensional topological manifold M
Creating a subset of
A
:sage: b = a.subset('B', latex_name=r'\mathcal{B}'); b Subset B of the 2-dimensional topological manifold M sage: latex(b) \mathcal{B}
>>> from sage.all import * >>> b = a.subset('B', latex_name=r'\mathcal{B}'); b Subset B of the 2-dimensional topological manifold M >>> latex(b) \mathcal{B}
We have then:
sage: b.is_subset(a) True sage: b in a.subsets() True
>>> from sage.all import * >>> b.is_subset(a) True >>> b in a.subsets() True
- subset_digraph(loops=False, quotient=False, open_covers=False, points=False, lower_bound=None)[source]#
Return the digraph whose arcs represent subset relations among the subsets of
self
.INPUT:
loops
– (default:False
) whether to include the trivial containment of each subset in itself as loops of the digraphquotient
– (default:False
) whether to contract directed cycles in the graph,replacing equivalence classes of equal subsets by a single vertex. In this case, each vertex of the digraph is a set of
ManifoldSubset
instances.
open_covers
– (default:False
) whether to include vertices for open coverspoints
– (default:False
) whether to include vertices for declared points; this can also be an iterable for the points to includelower_bound
– (default:None
) only include supersets of this
OUTPUT:
A digraph. Each vertex of the digraph is either:
a
ManifoldSubsetFiniteFamily
containing one instance ofManifoldSubset
.(if
open_covers
isTrue
) a tuple ofManifoldSubsetFiniteFamily
instances, representing an open cover.
EXAMPLES:
sage: # needs sage.graphs sage: M = Manifold(3, 'M') sage: U = M.open_subset('U'); V = M.open_subset('V'); W = M.open_subset('W') sage: D = M.subset_digraph(); D Digraph on 4 vertices sage: D.edges(sort=True, key=lambda e: (e[0]._name, e[1]._name)) # needs sage.graphs [(Set {U} of open subsets of the 3-dimensional differentiable manifold M, Set {M} of open subsets of the 3-dimensional differentiable manifold M, None), (Set {V} of open subsets of the 3-dimensional differentiable manifold M, Set {M} of open subsets of the 3-dimensional differentiable manifold M, None), (Set {W} of open subsets of the 3-dimensional differentiable manifold M, Set {M} of open subsets of the 3-dimensional differentiable manifold M, None)] sage: D.plot(layout='acyclic') # needs sage.plot Graphics object consisting of 8 graphics primitives sage: def label(element): ....: try: ....: return element._name ....: except AttributeError: ....: return '[' + ', '.join(sorted(x._name for x in element)) + ']' sage: D.relabel(label, inplace=False).plot(layout='acyclic') # needs sage.plot Graphics object consisting of 8 graphics primitives sage: VW = V.union(W) sage: D = M.subset_digraph(); D Digraph on 5 vertices sage: D.relabel(label, inplace=False).plot(layout='acyclic') # needs sage.plot Graphics object consisting of 12 graphics primitives
>>> from sage.all import * >>> # needs sage.graphs >>> M = Manifold(Integer(3), 'M') >>> U = M.open_subset('U'); V = M.open_subset('V'); W = M.open_subset('W') >>> D = M.subset_digraph(); D Digraph on 4 vertices >>> D.edges(sort=True, key=lambda e: (e[Integer(0)]._name, e[Integer(1)]._name)) # needs sage.graphs [(Set {U} of open subsets of the 3-dimensional differentiable manifold M, Set {M} of open subsets of the 3-dimensional differentiable manifold M, None), (Set {V} of open subsets of the 3-dimensional differentiable manifold M, Set {M} of open subsets of the 3-dimensional differentiable manifold M, None), (Set {W} of open subsets of the 3-dimensional differentiable manifold M, Set {M} of open subsets of the 3-dimensional differentiable manifold M, None)] >>> D.plot(layout='acyclic') # needs sage.plot Graphics object consisting of 8 graphics primitives >>> def label(element): ... try: ... return element._name ... except AttributeError: ... return '[' + ', '.join(sorted(x._name for x in element)) + ']' >>> D.relabel(label, inplace=False).plot(layout='acyclic') # needs sage.plot Graphics object consisting of 8 graphics primitives >>> VW = V.union(W) >>> D = M.subset_digraph(); D Digraph on 5 vertices >>> D.relabel(label, inplace=False).plot(layout='acyclic') # needs sage.plot Graphics object consisting of 12 graphics primitives
If
open_covers
isTrue
, the digraph includes a special vertex for each nontrivial open cover of a subset:sage: D = M.subset_digraph(open_covers=True) # needs sage.graphs sage: D.relabel(label, inplace=False).plot(layout='acyclic') # needs sage.graphs sage.plot Graphics object consisting of 14 graphics primitives
>>> from sage.all import * >>> D = M.subset_digraph(open_covers=True) # needs sage.graphs >>> D.relabel(label, inplace=False).plot(layout='acyclic') # needs sage.graphs sage.plot Graphics object consisting of 14 graphics primitives
- subset_family()[source]#
Return the family of subsets that have been defined on the current subset.
The family is sorted by the alphabetical names of the subsets.
OUTPUT:
a
ManifoldSubsetFiniteFamily
instance containing all the subsets that have been defined on the current subset
Note
If you only need to iterate over the subsets in arbitrary order, you can use the generator method
subsets()
instead.EXAMPLES:
Subsets of a 2-dimensional manifold:
sage: M = Manifold(2, 'M', structure='topological') sage: U = M.open_subset('U') sage: V = M.subset('V') sage: M.subset_family() Set {M, U, V} of subsets of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> U = M.open_subset('U') >>> V = M.subset('V') >>> M.subset_family() Set {M, U, V} of subsets of the 2-dimensional topological manifold M
- subset_poset(open_covers=False, points=False, lower_bound=None)[source]#
Return the poset of equivalence classes of the subsets of
self
.Each element of the poset is a set of
ManifoldSubset
instances, which are known to be equal.INPUT:
open_covers
– (default:False
) whether to include vertices for open coverspoints
– (default:False
) whether to include vertices for declared points; this can also be an iterable for the points to includelower_bound
– (default:None
) only include supersets of this
EXAMPLES:
sage: # needs sage.graphs sage: M = Manifold(3, 'M') sage: U = M.open_subset('U'); V = M.open_subset('V'); W = M.open_subset('W') sage: P = M.subset_poset(); P Finite poset containing 4 elements sage: P.plot(element_labels={element: element._name for element in P}) # needs sage.plot Graphics object consisting of 8 graphics primitives sage: VW = V.union(W) sage: P = M.subset_poset(); P Finite poset containing 5 elements sage: P.maximal_elements() [Set {M} of open subsets of the 3-dimensional differentiable manifold M] sage: sorted(P.minimal_elements(), key=lambda v: v._name) [Set {U} of open subsets of the 3-dimensional differentiable manifold M, Set {V} of open subsets of the 3-dimensional differentiable manifold M, Set {W} of open subsets of the 3-dimensional differentiable manifold M] sage: from sage.manifolds.subset import ManifoldSubsetFiniteFamily sage: sorted(P.lower_covers(ManifoldSubsetFiniteFamily([M])), key=str) [Set {U} of open subsets of the 3-dimensional differentiable manifold M, Set {V_union_W} of open subsets of the 3-dimensional differentiable manifold M] sage: P.plot(element_labels={element: element._name for element in P}) # needs sage.plot Graphics object consisting of 10 graphics primitives
>>> from sage.all import * >>> # needs sage.graphs >>> M = Manifold(Integer(3), 'M') >>> U = M.open_subset('U'); V = M.open_subset('V'); W = M.open_subset('W') >>> P = M.subset_poset(); P Finite poset containing 4 elements >>> P.plot(element_labels={element: element._name for element in P}) # needs sage.plot Graphics object consisting of 8 graphics primitives >>> VW = V.union(W) >>> P = M.subset_poset(); P Finite poset containing 5 elements >>> P.maximal_elements() [Set {M} of open subsets of the 3-dimensional differentiable manifold M] >>> sorted(P.minimal_elements(), key=lambda v: v._name) [Set {U} of open subsets of the 3-dimensional differentiable manifold M, Set {V} of open subsets of the 3-dimensional differentiable manifold M, Set {W} of open subsets of the 3-dimensional differentiable manifold M] >>> from sage.manifolds.subset import ManifoldSubsetFiniteFamily >>> sorted(P.lower_covers(ManifoldSubsetFiniteFamily([M])), key=str) [Set {U} of open subsets of the 3-dimensional differentiable manifold M, Set {V_union_W} of open subsets of the 3-dimensional differentiable manifold M] >>> P.plot(element_labels={element: element._name for element in P}) # needs sage.plot Graphics object consisting of 10 graphics primitives
If
open_covers
isTrue
, the poset includes a special vertex for each nontrivial open cover of a subset:sage: # needs sage.graphs sage: P = M.subset_poset(open_covers=True); P Finite poset containing 6 elements sage: from sage.manifolds.subset import ManifoldSubsetFiniteFamily sage: sorted(P.upper_covers(ManifoldSubsetFiniteFamily([VW])), key=str) [(Set {V} of open subsets of the 3-dimensional differentiable manifold M, Set {W} of open subsets of the 3-dimensional differentiable manifold M), Set {M} of open subsets of the 3-dimensional differentiable manifold M] sage: def label(element): ....: try: ....: return element._name ....: except AttributeError: ....: return '[' + ', '.join(sorted(x._name for x in element)) + ']' sage: P.plot(element_labels={element: label(element) for element in P}) # needs sage.plot Graphics object consisting of 12 graphics primitives
>>> from sage.all import * >>> # needs sage.graphs >>> P = M.subset_poset(open_covers=True); P Finite poset containing 6 elements >>> from sage.manifolds.subset import ManifoldSubsetFiniteFamily >>> sorted(P.upper_covers(ManifoldSubsetFiniteFamily([VW])), key=str) [(Set {V} of open subsets of the 3-dimensional differentiable manifold M, Set {W} of open subsets of the 3-dimensional differentiable manifold M), Set {M} of open subsets of the 3-dimensional differentiable manifold M] >>> def label(element): ... try: ... return element._name ... except AttributeError: ... return '[' + ', '.join(sorted(x._name for x in element)) + ']' >>> P.plot(element_labels={element: label(element) for element in P}) # needs sage.plot Graphics object consisting of 12 graphics primitives
- subsets()[source]#
Generate the subsets that have been defined on the current subset.
Note
To get the subsets as a family, sorted by name, use the method
subset_family()
instead.EXAMPLES:
Subsets of a 2-dimensional manifold:
sage: M = Manifold(2, 'M', structure='topological') sage: U = M.open_subset('U') sage: V = M.subset('V') sage: frozenset(M.subsets()) # random (set output) {Subset V of the 2-dimensional topological manifold M, 2-dimensional topological manifold M, Open subset U of the 2-dimensional topological manifold M} sage: U in M.subsets() True
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> U = M.open_subset('U') >>> V = M.subset('V') >>> frozenset(M.subsets()) # random (set output) {Subset V of the 2-dimensional topological manifold M, 2-dimensional topological manifold M, Open subset U of the 2-dimensional topological manifold M} >>> U in M.subsets() True
The method
subset_family()
returns a family (sorted alphabetically by the subset names):sage: M.subset_family() Set {M, U, V} of subsets of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M.subset_family() Set {M, U, V} of subsets of the 2-dimensional topological manifold M
- superset(name, latex_name=None, is_open=False)[source]#
Create a superset of the current subset.
A superset is a manifold subset in which the current subset is included.
INPUT:
name
– name given to the supersetlatex_name
– (default:None
) LaTeX symbol to denote the superset; if none are provided, it is set toname
is_open
– (default:False
) ifTrue
, the created subset is assumed to be open with respect to the manifold’s topology
OUTPUT:
the superset, as an instance of
ManifoldSubset
or of the derived classTopologicalManifold
ifis_open
isTrue
EXAMPLES:
Creating some superset of a given subset:
sage: M = Manifold(2, 'M', structure='topological') sage: a = M.subset('A') sage: b = a.superset('B'); b Subset B of the 2-dimensional topological manifold M sage: b.subset_family() Set {A, B} of subsets of the 2-dimensional topological manifold M sage: a.superset_family() Set {A, B, M} of subsets of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> a = M.subset('A') >>> b = a.superset('B'); b Subset B of the 2-dimensional topological manifold M >>> b.subset_family() Set {A, B} of subsets of the 2-dimensional topological manifold M >>> a.superset_family() Set {A, B, M} of subsets of the 2-dimensional topological manifold M
The superset of the whole manifold is itself:
sage: M.superset('SM') is M True
>>> from sage.all import * >>> M.superset('SM') is M True
Two supersets of a given subset are a priori different:
sage: c = a.superset('C') sage: c == b False
>>> from sage.all import * >>> c = a.superset('C') >>> c == b False
- superset_digraph(loops=False, quotient=False, open_covers=False, points=False, upper_bound=None)[source]#
Return the digraph whose arcs represent subset relations among the supersets of
self
.INPUT:
loops
– (default:False
) whether to include the trivial containment of each subset in itself as loops of the digraphquotient
– (default:False
) whether to contract directed cycles in the graph,replacing equivalence classes of equal subsets by a single vertex. In this case, each vertex of the digraph is a set of
ManifoldSubset
instances.
open_covers
– (default:False
) whether to include vertices for open coverspoints
– (default:False
) whether to include vertices for declared points; this can also be an iterable for the points to includeupper_bound
– (default:None
) only include subsets of this
EXAMPLES:
sage: M = Manifold(3, 'M') sage: U = M.open_subset('U'); V = M.open_subset('V'); W = M.open_subset('W') sage: VW = V.union(W) sage: P = V.superset_digraph(loops=False, upper_bound=VW); P # needs sage.graphs Digraph on 2 vertices
>>> from sage.all import * >>> M = Manifold(Integer(3), 'M') >>> U = M.open_subset('U'); V = M.open_subset('V'); W = M.open_subset('W') >>> VW = V.union(W) >>> P = V.superset_digraph(loops=False, upper_bound=VW); P # needs sage.graphs Digraph on 2 vertices
- superset_family()[source]#
Return the family of declared supersets of the current subset.
The family is sorted by the alphabetical names of the supersets.
OUTPUT:
a
ManifoldSubsetFiniteFamily
instance containing all the supersets
Note
If you only need to iterate over the supersets in arbitrary order, you can use the generator method
supersets()
instead.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: U = M.open_subset('U') sage: V = M.subset('V') sage: V.superset_family() Set {M, V} of subsets of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> U = M.open_subset('U') >>> V = M.subset('V') >>> V.superset_family() Set {M, V} of subsets of the 2-dimensional topological manifold M
- superset_poset(open_covers=False, points=False, upper_bound=None)[source]#
Return the poset of the supersets of
self
.INPUT:
open_covers
– (default:False
) whether to include vertices for open coverspoints
– (default:False
) whether to include vertices for declared points; this can also be an iterable for the points to includeupper_bound
– (default:None
) only include subsets of this
EXAMPLES:
sage: M = Manifold(3, 'M') sage: U = M.open_subset('U'); V = M.open_subset('V'); W = M.open_subset('W') sage: VW = V.union(W) sage: P = V.superset_poset(); P # needs sage.graphs Finite poset containing 3 elements sage: P.plot(element_labels={element: element._name for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 6 graphics primitives
>>> from sage.all import * >>> M = Manifold(Integer(3), 'M') >>> U = M.open_subset('U'); V = M.open_subset('V'); W = M.open_subset('W') >>> VW = V.union(W) >>> P = V.superset_poset(); P # needs sage.graphs Finite poset containing 3 elements >>> P.plot(element_labels={element: element._name for element in P}) # needs sage.graphs sage.plot Graphics object consisting of 6 graphics primitives
- supersets()[source]#
Generate the declared supersets of the current subset.
Note
To get the supersets as a family, sorted by name, use the method
superset_family()
instead.EXAMPLES:
sage: M = Manifold(2, 'M', structure='topological') sage: U = M.open_subset('U') sage: V = M.subset('V') sage: sorted(V.supersets(), key=lambda v: v._name) [2-dimensional topological manifold M, Subset V of the 2-dimensional topological manifold M]
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> U = M.open_subset('U') >>> V = M.subset('V') >>> sorted(V.supersets(), key=lambda v: v._name) [2-dimensional topological manifold M, Subset V of the 2-dimensional topological manifold M]
- union(name, latex_name, *others)[source]#
Return the union of the current subset with other subsets.
This method may return a previously constructed union instead of creating a new subset. In this case,
name
andlatex_name
are not used.INPUT:
others
– other subsets of the same manifoldname
– (default:None
) name given to the union in the case the latter has to be created; the default isself._name
unionother._name
latex_name
– (default:None
) LaTeX symbol to denote the union in the case the latter has to be created; the default is built upon the symbol \(\cup\)
OUTPUT:
instance of
ManifoldSubset
representing the subset that is the union of the current subset withothers
EXAMPLES:
Union of two subsets:
sage: M = Manifold(2, 'M', structure='topological') sage: a = M.subset('A') sage: b = M.subset('B') sage: c = a.union(b); c Subset A_union_B of the 2-dimensional topological manifold M sage: a.superset_family() Set {A, A_union_B, M} of subsets of the 2-dimensional topological manifold M sage: b.superset_family() Set {A_union_B, B, M} of subsets of the 2-dimensional topological manifold M sage: c.superset_family() Set {A_union_B, M} of subsets of the 2-dimensional topological manifold M
>>> from sage.all import * >>> M = Manifold(Integer(2), 'M', structure='topological') >>> a = M.subset('A') >>> b = M.subset('B') >>> c = a.union(b); c Subset A_union_B of the 2-dimensional topological manifold M >>> a.superset_family() Set {A, A_union_B, M} of subsets of the 2-dimensional topological manifold M >>> b.superset_family() Set {A_union_B, B, M} of subsets of the 2-dimensional topological manifold M >>> c.superset_family() Set {A_union_B, M} of subsets of the 2-dimensional topological manifold M
Union of six subsets:
sage: T = Manifold(2, 'T', structure='topological') sage: S = [T.subset(f'S{i}') for i in range(6)] sage: [S[i].union(S[i+3]) for i in range(3)] [Subset S0_union_S3 of the 2-dimensional topological manifold T, Subset S1_union_S4 of the 2-dimensional topological manifold T, Subset S2_union_S5 of the 2-dimensional topological manifold T] sage: union_S_i = S[0].union(S[1:], name='union_S_i'); union_S_i Subset union_S_i of the 2-dimensional topological manifold T sage: T.subset_family() Set {S0, S0_union_S3, S0_union_S3_union_S1_union_S4, S1, S1_union_S4, S2, S2_union_S5, S3, S4, S5, T, union_S_i} of subsets of the 2-dimensional topological manifold T
>>> from sage.all import * >>> T = Manifold(Integer(2), 'T', structure='topological') >>> S = [T.subset(f'S{i}') for i in range(Integer(6))] >>> [S[i].union(S[i+Integer(3)]) for i in range(Integer(3))] [Subset S0_union_S3 of the 2-dimensional topological manifold T, Subset S1_union_S4 of the 2-dimensional topological manifold T, Subset S2_union_S5 of the 2-dimensional topological manifold T] >>> union_S_i = S[Integer(0)].union(S[Integer(1):], name='union_S_i'); union_S_i Subset union_S_i of the 2-dimensional topological manifold T >>> T.subset_family() Set {S0, S0_union_S3, S0_union_S3_union_S1_union_S4, S1, S1_union_S4, S2, S2_union_S5, S3, S4, S5, T, union_S_i} of subsets of the 2-dimensional topological manifold T