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

Commit

Permalink
ContinuousMap.preimage: New, make pullback an alias; add example
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 5, 2021
1 parent 4a13d8b commit 79232db
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 6 deletions.
41 changes: 40 additions & 1 deletion src/sage/manifolds/continuous_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,11 +866,50 @@ def image(self, subset=None, inverse=None):
return subset
return ImageManifoldSubset(self, inverse=inverse, domain_subset=subset)

def pullback(self, codomain_subset, name=None, latex_name=None):
def preimage(self, codomain_subset, name=None, latex_name=None):
r"""
Return the preimage of ``codomain_subset`` under ``self``.
INPUT:
- ``codomain_subset`` -- an instance of :class:`ManifoldSubset`
- ``name`` -- string; name (symbol) given to the subset
- ``latex_name`` -- (default: ``None``) string; LaTeX symbol to
denote the subset; if none are provided, it is set to ``name``
OUTPUT:
- an instance of
:class:`~sage.manifolds.subsets.pullback.ManifoldSubsetPullback`
EXAMPLES::
sage: R = Manifold(1, 'R', structure='topological') # field R
sage: T.<t> = R.chart() # canonical chart on R
sage: R2 = Manifold(2, 'R^2', structure='topological') # R^2
sage: c_xy.<x,y> = R2.chart() # Cartesian coordinates on R^2
sage: Phi = R.continuous_map(R2, [cos(t), sin(t)], name='Phi'); Phi
Continuous map Phi
from the 1-dimensional topological manifold R
to the 2-dimensional topological manifold R^2
sage: Q1 = R2.open_subset('Q1', coord_def={c_xy: [x>0, y>0]}); Q1
Open subset Q1 of the 2-dimensional topological manifold R^2
sage: Phi_inv_Q1 = Phi.preimage(Q1); Phi_inv_Q1
Subset Phi_inv_Q1 of the 1-dimensional topological manifold R
sage: R.point([pi/4]) in Phi_inv_Q1
True
sage: R.point([0]) in Phi_inv_Q1
False
sage: R.point([3*pi/4]) in Phi_inv_Q1
False
"""
from sage.manifolds.subsets.pullback import ManifoldSubsetPullback
return ManifoldSubsetPullback(self, codomain_subset=codomain_subset,
name=name, latex_name=latex_name)

pullback = preimage

#
# Monoid methods
#
Expand Down
7 changes: 6 additions & 1 deletion src/sage/manifolds/differentiable/diff_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ def jacobian_matrix(self, chart1=None, chart2=None):
return matrix([[diff_funct[i][j].expr() for j in range(n1)]
for i in range(n2)])

def pullback(self, tensor):
def pullback(self, tensor_or_codomain_subset, name=None, latex_name=None):
r"""
Pullback operator associated with ``self``.
Expand Down Expand Up @@ -934,6 +934,11 @@ def pullback(self, tensor):
(2*cos(t) + 2) dt*dt
"""
if not hasattr(tensor_or_codomain_subset, '_domain'):
return super().pullback(tensor_or_codomain_subset,
name=name, latex_name=latex_name)
tensor = tensor_or_codomain_subset

from sage.manifolds.differentiable.tensorfield_paral import TensorFieldParal
from sage.manifolds.differentiable.vectorframe import CoordFrame
from sage.tensor.modules.comp import (Components, CompWithSym,
Expand Down
13 changes: 9 additions & 4 deletions src/sage/manifolds/subsets/pullback.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.manifolds.subset import ManifoldSubset
from sage.manifolds.continuous_map import ContinuousMap
from sage.manifolds.chart import Chart
from sage.sets.real_set import RealSet
from sage.geometry.polyhedron.base import is_Polyhedron
Expand Down Expand Up @@ -157,7 +158,7 @@ def __classcall_private__(cls, map, inverse=None, codomain_subset=None,
if cls._is_open(codomain_subset):

try:
coord_def = cls._coord_def(codomain_subset)
coord_def = cls._coord_def(map, codomain_subset)
except NotImplementedError:
pass
else:
Expand Down Expand Up @@ -200,7 +201,9 @@ def _is_open(codomain_subset):
return False

@staticmethod
def _coord_def(codomain_subset):
def _coord_def(map, codomain_subset):

#if isinstance(map, ContinuousMap) and isinstance(codomain_subset, Manifold):

raise NotImplementedError

Expand Down Expand Up @@ -230,8 +233,8 @@ def is_open(self):
Return if ``self`` is an open set.
"""
# Because the map is continuous, the pullback is open if and only
# if the codomain_subset is open. But because other code assumes
# Because the map is continuous, the pullback is open if the
# codomain_subset is open. But because other code assumes
# that open subsets are instances of Manifold, we do not use this
# fact here. Instead, the constructor is responsible for creating
# an instance of the appropriate subclass.
Expand Down Expand Up @@ -319,6 +322,8 @@ def is_closed(self):
False
"""
if self.manifold().dimension() == 0:
return True
if isinstance(self._codomain_subset, ManifoldSubset):
if self._codomain_subset.is_closed():
# known closed
Expand Down

0 comments on commit 79232db

Please sign in to comment.