Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 't/31727/manifoldsubset__add_methods_subset_family__supe…
Browse files Browse the repository at this point in the history
…rset_family__equal_subset_family__deprecate_method_list_of_subsets' into t/31732/manifoldsubset__new_methods_declare_empty__declare_nonempty__is_empty__has_defined_points__open_cover_family
  • Loading branch information
Matthias Koeppe committed Jun 19, 2021
2 parents 1e6a055 + 2b47b1b commit 359dde1
Show file tree
Hide file tree
Showing 13 changed files with 683 additions and 183 deletions.
30 changes: 11 additions & 19 deletions src/sage/manifolds/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ def __init__(self, domain, coordinates='', names=None, calc_method=None):
self._restrictions = [] # to be set with method add_restrictions()
#
# The chart is added to the domain's atlas, as well as to all the
# atlases of the domain's supersets; moreover the fist defined chart
# atlases of the domain's supersets; moreover the first defined chart
# is considered as the default chart
for sd in self._domain._supersets:
for sd in self._domain.open_supersets():
# the chart is added in the top charts only if its coordinates have
# not been used:
for chart in sd._atlas:
Expand All @@ -346,13 +346,9 @@ def __init__(self, domain, coordinates='', names=None, calc_method=None):
# The null and one functions of the coordinates:
# Expression in self of the zero and one scalar fields of open sets
# containing the domain of self:
for dom in self._domain._supersets:
if hasattr(dom, '_zero_scalar_field'):
# dom is an open set
dom._zero_scalar_field._express[self] = self.function_ring().zero()
if hasattr(dom, '_one_scalar_field'):
# dom is an open set
dom._one_scalar_field._express[self] = self.function_ring().one()
for dom in self._domain.open_supersets():
dom._zero_scalar_field._express[self] = self.function_ring().zero()
dom._one_scalar_field._express[self] = self.function_ring().one()

def _init_coordinates(self, coord_list):
r"""
Expand Down Expand Up @@ -932,12 +928,9 @@ def transition_map(self, other, transformations, intersection_name=None,
The subset `W`, intersection of `U` and `V`, has been created by
``transition_map()``::
sage: M.list_of_subsets()
[1-dimensional topological manifold S^1,
Open subset U of the 1-dimensional topological manifold S^1,
Open subset V of the 1-dimensional topological manifold S^1,
Open subset W of the 1-dimensional topological manifold S^1]
sage: W = M.list_of_subsets()[3]
sage: F = M.subset_family(); F
Set {S^1, U, V, W} of open subsets of the 1-dimensional topological manifold S^1
sage: W = F['W']
sage: W is U.intersection(V)
True
sage: M.atlas()
Expand All @@ -960,9 +953,8 @@ def transition_map(self, other, transformations, intersection_name=None,
In this case, no new subset has been created since `U \cap M = U`::
sage: M.list_of_subsets()
[2-dimensional topological manifold R^2,
Open subset U of the 2-dimensional topological manifold R^2]
sage: M.subset_family()
Set {R^2, U} of open subsets of the 2-dimensional topological manifold R^2
but a new chart has been created: `(U, (x, y))`::
Expand Down Expand Up @@ -3010,7 +3002,7 @@ def __init__(self, chart1, chart2, *transformations):
# is added to the subset (and supersets) dictionary:
if chart1._domain == chart2._domain:
domain = chart1._domain
for sdom in domain._supersets:
for sdom in domain.open_supersets():
sdom._coord_changes[(chart1, chart2)] = self

def _repr_(self):
Expand Down
22 changes: 9 additions & 13 deletions src/sage/manifolds/differentiable/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,9 @@ def transition_map(self, other, transformations, intersection_name=None,
The subset `W`, intersection of `U` and `V`, has been created by
``transition_map()``::
sage: M.list_of_subsets()
[1-dimensional differentiable manifold S^1,
Open subset U of the 1-dimensional differentiable manifold S^1,
Open subset V of the 1-dimensional differentiable manifold S^1,
Open subset W of the 1-dimensional differentiable manifold S^1]
sage: W = M.list_of_subsets()[3]
sage: F = M.subset_family(); F
Set {S^1, U, V, W} of open subsets of the 1-dimensional differentiable manifold S^1
sage: W = F['W']
sage: W is U.intersection(V)
True
sage: M.atlas()
Expand All @@ -385,9 +382,8 @@ def transition_map(self, other, transformations, intersection_name=None,
In this case, no new subset has been created since `U\cap M = U`::
sage: M.list_of_subsets()
[2-dimensional differentiable manifold R^2,
Open subset U of the 2-dimensional differentiable manifold R^2]
sage: M.subset_family()
Set {R^2, U} of open subsets of the 2-dimensional differentiable manifold R^2
but a new chart has been created: `(U, (x, y))`::
Expand Down Expand Up @@ -563,7 +559,7 @@ def restrict(self, subset, restrictions=None):
sframe._restrictions[subset] = resu._frame
# The subchart frame is not a "top frame" in the supersets
# (including self._domain):
for dom in self._domain._supersets:
for dom in self._domain.open_supersets():
if resu._frame in dom._top_frames:
# it was added by the Chart constructor invoked in
# Chart.restrict above
Expand Down Expand Up @@ -1046,7 +1042,7 @@ def restrict(self, subset, restrictions=None):
sframe._restrictions[subset] = resu._frame
# The subchart frame is not a "top frame" in the supersets
# (including self._domain):
for dom in self._domain._supersets:
for dom in self._domain.open_supersets():
if resu._frame in dom._top_frames:
# it was added by the Chart constructor invoked in
# Chart.restrict above
Expand Down Expand Up @@ -1138,15 +1134,15 @@ def __init__(self, chart1, chart2, *transformations):
ch_basis.add_comp(frame1)[:, chart1] = self._jacobian
ch_basis.add_comp(frame2)[:, chart1] = self._jacobian
vf_module._basis_changes[(frame2, frame1)] = ch_basis
for sdom in domain._supersets:
for sdom in domain.open_supersets():
sdom._frame_changes[(frame2, frame1)] = ch_basis
# The inverse is computed only if it does not exist already
# (because if it exists it may have a simpler expression than that
# obtained from the matrix inverse)
if (frame1, frame2) not in vf_module._basis_changes:
ch_basis_inv = ch_basis.inverse()
vf_module._basis_changes[(frame1, frame2)] = ch_basis_inv
for sdom in domain._supersets:
for sdom in domain.open_supersets():
sdom._frame_changes[(frame1, frame2)] = ch_basis_inv

def jacobian(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
lightlike submanifold) and in General Relativity. In geometry of lightlike
submanifolds, according to the dimension `r` of the radical distribution
(see below for definition of radical distribution), degenerate submanifolds
have been classify into 4 subgroups: `r`-lightlike submanifolds, Coisotropic
have been classified into 4 subgroups: `r`-lightlike submanifolds, Coisotropic
submanifolds, Isotropic submanifolds and Totally lightlike submanifolds.
(See the book of Krishan L. Duggal and Aurel Bejancu [DS2010]_.)
Expand Down
73 changes: 73 additions & 0 deletions src/sage/manifolds/differentiable/differentiable_submanifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,83 @@ def _repr_(self):
3-dimensional differentiable manifold M
"""
if self is not self._manifold:
return "Open subset {} of the {}".format(self._name, self._manifold)
if self._ambient is None:
return super(DifferentiableManifold, self).__repr__()
if self._embedded:
return "{}-dimensional {} submanifold {} embedded in the {}".format(
self._dim, self._structure.name, self._name, self._ambient)
return "{}-dimensional {} submanifold {} immersed in the {}".format(
self._dim, self._structure.name, self._name, self._ambient)

def open_subset(self, name, latex_name=None, coord_def={}, supersets=None):
r"""
Create an open subset of the manifold.
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 differentiable
manifold by itself.
As ``self`` is a submanifold of its ambient manifold,
the new open subset is also considered a submanifold of that.
Hence the returned object is an instance of
:class:`DifferentiableSubmanifold`.
INPUT:
- ``name`` -- name given to the open subset
- ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
subset; if none is provided, it is set to ``name``
- ``coord_def`` -- (default: {}) definition of the subset in
terms of coordinates; ``coord_def`` must a be dictionary with keys
charts in the manifold's atlas and values the symbolic expressions
formed by the coordinates to define the subset.
- ``supersets`` -- (default: only ``self``) list of sets that the
new open subset is a subset of
OUTPUT:
- the open subset, as an instance of :class:`DifferentiableSubmanifold`
EXAMPLES::
sage: M = Manifold(3, 'M', structure="differentiable")
sage: N = Manifold(2, 'N', ambient=M, structure="differentiable"); N
2-dimensional differentiable submanifold N immersed in the
3-dimensional differentiable manifold M
sage: S = N.subset('S'); S
Subset S of the
2-dimensional differentiable submanifold N immersed in the
3-dimensional differentiable manifold M
sage: O = N.subset('O', is_open=True); O # indirect doctest
Open subset O of the
2-dimensional differentiable submanifold N immersed in the
3-dimensional differentiable manifold M
sage: phi = N.diff_map(M)
sage: N.set_embedding(phi)
sage: N
2-dimensional differentiable submanifold N embedded in the
3-dimensional differentiable manifold M
sage: S = N.subset('S'); S
Subset S of the
2-dimensional differentiable submanifold N embedded in the
3-dimensional differentiable manifold M
sage: O = N.subset('O', is_open=True); O # indirect doctest
Open subset O of the
2-dimensional differentiable submanifold N embedded in the
3-dimensional differentiable manifold M
"""
resu = DifferentiableSubmanifold(self._dim, name, self._field,
self._structure, ambient=self._ambient,
base_manifold=self._manifold,
diff_degree=self._diff_degree,
latex_name=latex_name,
start_index=self._sindex)
if supersets is None:
supersets = [self]
for superset in supersets:
superset._init_open_subset(resu, coord_def=coord_def)
return resu
10 changes: 5 additions & 5 deletions src/sage/manifolds/differentiable/examples/real_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@ class OpenInterval(DifferentiableManifold):
We have::
sage: I.list_of_subsets()
sage: list(I.subset_family())
[Real interval (0, 1), Real interval (0, pi), Real interval (1/2, 1)]
sage: J.list_of_subsets()
sage: list(J.subset_family())
[Real interval (0, 1), Real interval (1/2, 1)]
sage: K.list_of_subsets()
sage: list(K.subset_family())
[Real interval (1/2, 1)]
As any open subset of a manifold, open subintervals are created in a
Expand Down Expand Up @@ -684,7 +684,7 @@ def open_interval(self, lower, upper, name=None, latex_name=None):
Real interval (0, pi)
sage: J.is_subset(I)
True
sage: I.list_of_subsets()
sage: list(I.subset_family())
[Real interval (-4, 4), Real interval (0, pi)]
``J`` is considered as an open submanifold of ``I``::
Expand Down Expand Up @@ -863,7 +863,7 @@ class RealLine(OpenInterval):
Real interval (0, 1)
sage: I.manifold()
Real number line R
sage: R.list_of_subsets()
sage: list(R.subset_family())
[Real interval (0, 1), Real number line R]
"""
Expand Down
Loading

0 comments on commit 359dde1

Please sign in to comment.