summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-13 23:51:24 +0200
committerEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-13 23:51:24 +0200
commitd65f654de942ede34956278de1b1921f34eed445 (patch)
tree5280e887456a6e999c8bf95e65b6a653ef9f3172
parentImprovement in simplify_sqrt_real(); TestSuite run non-verbose (diff)
Introduce open covers on top manifolds + many improvements in the documentation
-rw-r--r--src/sage/manifolds/chart.py101
-rw-r--r--src/sage/manifolds/continuous_map.py230
-rw-r--r--src/sage/manifolds/coord_func.py4
-rw-r--r--src/sage/manifolds/coord_func_symb.py2
-rw-r--r--src/sage/manifolds/manifold.py133
-rw-r--r--src/sage/manifolds/manifold_homset.py60
-rw-r--r--src/sage/manifolds/point.py60
-rw-r--r--src/sage/manifolds/scalarfield.py243
-rw-r--r--src/sage/manifolds/scalarfield_algebra.py126
-rw-r--r--src/sage/manifolds/subset.py147
-rw-r--r--src/sage/manifolds/utilities.py30
11 files changed, 688 insertions, 448 deletions
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index 927b73b..cde5f4f 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -47,9 +47,9 @@ class Chart(UniqueRepresentation, SageObject):
Chart on a topological manifold.
Given a topological manifold `M` of dimension `n` over a topological field
- `K`, a *chart* is a pair `(U,\varphi)`, where `U` is an open subset of `M`
- and `\varphi: U \rightarrow V \subset K^n` is a homeomorphism from `U` to
- an open subset `V` of `K^n`.
+ `K`, a *chart* on `M` is a pair `(U,\varphi)`, where `U` is an open subset
+ of `M` and `\varphi: U \rightarrow V \subset K^n` is a homeomorphism from
+ `U` to an open subset `V` of `K^n`.
The components `(x^1,\ldots,x^n)` of `\varphi`, defined by
`\varphi(p) = (x^1(p),\ldots,x^n(p))\in K^n` for any point `p\in U`,
@@ -57,7 +57,8 @@ class Chart(UniqueRepresentation, SageObject):
INPUT:
- - ``domain`` -- open subset `U` on which the chart is defined
+ - ``domain`` -- open subset `U` on which the chart is defined (must be
+ an instance of :class:`~sage.manifolds.manifold.TopManifold`)
- ``coordinates`` -- (default: '' (empty string)) single string defining
the coordinate symbols, with ' ' (whitespace) as a separator; each item
has at most two fields, separated by ':':
@@ -74,7 +75,7 @@ class Chart(UniqueRepresentation, SageObject):
used via Sage preparser (see examples below)
- ``names`` -- (default: ``None``) unused argument, except if
``coordinates`` is not provided; it must then be a tuple containing
- the coordinate symbols (this is guaranted if the shortcut operator
+ the coordinate symbols (this is guaranteed if the shortcut operator
``<,>`` is used).
EXAMPLES:
@@ -549,21 +550,22 @@ class Chart(UniqueRepresentation, SageObject):
def restrict(self, subset, restrictions=None):
r"""
- Return the restriction of ``self`` to some subset.
+ Return the restriction of the chart to some open subset of its domain.
- If ``self`` is the chart `(U,\varphi)`, a restriction (or subchart)
+ If the current chart is `(U,\varphi)`, a *restriction* (or *subchart*)
is a chart `(V,\psi)` such that `V\subset U` and `\psi = \varphi |_V`.
If such subchart has not been defined yet, it is constructed here.
The coordinates of the subchart bare the same names as the coordinates
- of the mother chart.
+ of the current chart.
INPUT:
- - ``subset`` -- open subset `V` of the chart domain `U`
- - ``restrictions`` -- (default: ``None``) list of coordinate restrictions
- defining the subset `V`.
+ - ``subset`` -- open subset `V` of the chart domain `U` (must be an
+ instance of :class:`~sage.manifolds.manifold.TopManifold`)
+ - ``restrictions`` -- (default: ``None``) list of coordinate
+ restrictions defining the subset `V`.
A restriction can be any symbolic equality or
inequality involving the coordinates, such as x>y or x^2+y^2 != 0.
The items of the list ``restrictions`` are combined with the ``and``
@@ -597,8 +599,8 @@ class Chart(UniqueRepresentation, SageObject):
return self
if subset not in self._dom_restrict:
if not subset.is_subset(self._domain):
- raise ValueError("The specified subset is not a subset " +
- "of the domain of definition of the chart.")
+ raise ValueError("the specified subset is not a subset " +
+ "of the domain of definition of the chart")
coordinates = ""
for coord in self._xx:
coordinates += repr(coord) + ' '
@@ -1047,8 +1049,8 @@ class RealChart(Chart):
r"""
Chart on a topological manifold over `\RR`.
- Given a topological manifold `M` of dimension `n` over `\RR`, a *chart* is
- a pair `(U,\varphi)`, where `U` is an open subset of `M` and
+ Given a topological manifold `M` of dimension `n` over `\RR`, a *chart*
+ on `M` is a pair `(U,\varphi)`, where `U` is an open subset of `M` and
`\varphi: U \rightarrow V \subset \RR^n` is a homeomorphism from `U` to
an open subset `V` of `\RR^n`.
@@ -1085,7 +1087,7 @@ class RealChart(Chart):
shortcut operator ``<,>`` is used via Sage preparser (see examples below)
- ``names`` -- (default: ``None``) unused argument, except if
``coordinates`` is not provided; it must then be a tuple containing
- the coordinate symbols (this is guaranted if the shortcut operator
+ the coordinate symbols (this is guaranteed if the shortcut operator
``<,>`` is used).
EXAMPLES:
@@ -1446,8 +1448,8 @@ class RealChart(Chart):
INPUT:
- ``xx`` -- (default: ``None``) symbolic expression corresponding to a
- coordinate of ``self``; if ``None``, the ranges of all coordinates
- are displayed.
+ coordinate of the current chart; if ``None``, the ranges of all
+ coordinates are displayed.
EXAMPLES:
@@ -1633,21 +1635,22 @@ class RealChart(Chart):
def restrict(self, subset, restrictions=None):
r"""
- Return the restriction of ``self`` to some subset.
+ Return the restriction of the chart to some open subset of its domain.
- If ``self`` is the chart `(U,\varphi)`, a restriction (or subchart)
+ If the current chart is `(U,\varphi)`, a *restriction* (or *subchart*)
is a chart `(V,\psi)` such that `V\subset U` and `\psi = \varphi |_V`.
If such subchart has not been defined yet, it is constructed here.
The coordinates of the subchart bare the same names as the coordinates
- of the mother chart.
+ of the current chart.
INPUT:
- - ``subset`` -- open subset `V` of the chart domain `U`
- - ``restrictions`` -- (default: ``None``) list of coordinate restrictions
- defining the subset `V`.
+ - ``subset`` -- open subset `V` of the chart domain `U` (must be an
+ instance of :class:`~sage.manifolds.manifold.TopManifold`)
+ - ``restrictions`` -- (default: ``None``) list of coordinate
+ restrictions defining the subset `V`.
A restriction can be any symbolic equality or
inequality involving the coordinates, such as x>y or x^2+y^2 != 0.
The items of the list ``restrictions`` are combined with the ``and``
@@ -1663,7 +1666,7 @@ class RealChart(Chart):
OUTPUT:
- - chart `(V,\psi)`, as an instance of :class:`Chart`.
+ - chart `(V,\psi)`, as an instance of :class:`RealChart`.
EXAMPLES:
@@ -1696,8 +1699,8 @@ class RealChart(Chart):
return self
if subset not in self._dom_restrict:
if not subset.is_subset(self._domain):
- raise ValueError("The specified subset is not a subset " +
- "of the domain of definition of the chart.")
+ raise ValueError("the specified subset is not a subset " +
+ "of the domain of definition of the chart")
coordinates = ""
for coord in self._xx:
coordinates += repr(coord) + ' '
@@ -2155,12 +2158,12 @@ class RealChart(Chart):
if coord not in ambient_coords:
fixed_coords[coord] = 0
else:
- transf = None # to be the MultiFunctionChart relating self to
- # the ambient chart
+ transf = None # to be the MultiCoordFunction object relating self
+ # to the ambient chart
if mapping is None:
if not self._domain.is_subset(chart._domain):
- raise TypeError("the domain of {} is not ".format(self) +
- "included in that of {}".format(chart))
+ raise ValueError("the domain of {} is not ".format(self) +
+ "included in that of {}".format(chart))
coord_changes = chart._domain._coord_changes
for chart_pair in coord_changes:
if chart_pair == (self, chart):
@@ -2177,11 +2180,11 @@ class RealChart(Chart):
raise TypeError("the argument 'mapping' must be a " +
"continuous manifold map")
if not self._domain.is_subset(mapping._domain):
- raise TypeError("the domain of {} is not ".format(self) +
- "included in that of {}".format(mapping))
+ raise ValueError("the domain of {} is not ".format(self) +
+ "included in that of {}".format(mapping))
if not chart._domain.is_subset(mapping._codomain):
- raise TypeError("the domain of {} is not ".format(chart) +
- "included in the codomain of {}".format(
+ raise ValueError("the domain of {} is not ".format(chart) +
+ "included in the codomain of {}".format(
mapping))
try:
transf = mapping.coord_functions(chart1=self, chart2=chart)
@@ -2208,7 +2211,7 @@ class RealChart(Chart):
ambient_coords = tuple(ambient_coords)
nca = len(ambient_coords)
if nca != 2 and nca !=3:
- raise TypeError("bad number of ambient coordinates: {}".format(nca))
+ raise ValueError("bad number of ambient coordinates: {}".format(nca))
if ranges is None:
ranges = {}
ranges0 = {}
@@ -2277,7 +2280,7 @@ class RealChart(Chart):
xx0 = [0] * nc
if fixed_coords is not None:
if len(fixed_coords) != nc - len(coords):
- raise ValueError("Bad number of fixed coordinates.")
+ raise ValueError("bad number of fixed coordinates")
for fc, val in fixed_coords.iteritems():
xx0[self._xx.index(fc)] = val
ind_a = [chart._xx.index(ac) for ac in ambient_coords]
@@ -2518,7 +2521,7 @@ class CoordChange(SageObject):
OUTPUT:
- an instance of :class:`CoordChange` representing the inverse of
- ``self``.
+ the current coordinate transformation.
EXAMPLES:
@@ -2555,9 +2558,9 @@ class CoordChange(SageObject):
n1 = self._n1
n2 = self._n2
if n1 != n2:
- raise TypeError("the change of coordinates is not invertible " +
- "(different number of coordinates in the two " +
- "charts)")
+ raise ValueError("the change of coordinates is not invertible " +
+ "(different number of coordinates in the two " +
+ "charts)")
# New symbolic variables (different from x2 to allow for a
# correct solution even when chart2 = chart1):
if self._chart1.domain().base_field() == 'real':
@@ -2627,7 +2630,7 @@ class CoordChange(SageObject):
r"""
Sets the inverse of the coordinate transformation.
- This is usefull when the automatic computation via :meth:`inverse()`
+ This is useful when the automatic computation via :meth:`inverse()`
fails.
INPUT:
@@ -2636,7 +2639,7 @@ class CoordChange(SageObject):
list of the expressions of the "old" coordinates in terms of the
"new" ones
- ``kwds`` -- keyword arguments: only ``check=True`` (default) or
- ``check=False`` are meaningfull; it determines whether the provided
+ ``check=False`` are meaningful; it determines whether the provided
transformations are checked to be indeed the inverse coordinate
transformations.
@@ -2678,7 +2681,7 @@ class CoordChange(SageObject):
else:
check = True
self._inverse = self.__class__(self._chart2, self._chart1,
- *transformations)
+ *transformations)
if check:
print "Check of the inverse coordinate transformation:"
x1 = self._chart1._xx
@@ -2755,9 +2758,18 @@ class CoordChange(SageObject):
u = x + y
v = x - y
+ The result is cached::
+
+ sage: X_to_Y.restrict(U) is X_to_Y_U
+ True
+
"""
if dom2 is None:
dom2 = dom1
+ ch1 = self._chart1.restrict(dom1)
+ ch2 = self._chart2.restrict(dom2)
+ if (ch1, ch2) in dom1.coord_changes():
+ return dom1.coord_changes()[(ch1,ch2)]
return self.__class__(self._chart1.restrict(dom1),
self._chart2.restrict(dom2), *(self._transf.expr()))
@@ -2813,4 +2825,3 @@ class CoordChange(SageObject):
return FormattedExpansion(rtxt, rlatex)
disp = display
-
diff --git a/src/sage/manifolds/continuous_map.py b/src/sage/manifolds/continuous_map.py
index c258496..e956f35 100644
--- a/src/sage/manifolds/continuous_map.py
+++ b/src/sage/manifolds/continuous_map.py
@@ -1,14 +1,9 @@
r"""
Continuous maps between topological manifolds
-The class :class:`ContinuousMap` implements continuous maps from an open
-subset `U` of a topological manifold `M` to some topological
-manifold `N` over the same topological field `K` as `M`:
-
-.. MATH::
-
- \Phi: U\subset M \longrightarrow N
-
+The class :class:`ContinuousMap` implements continuous maps from a topological
+manifold `M` to some topological manifold `N` over the same topological field
+`K` as `M`.
AUTHORS:
@@ -18,9 +13,8 @@ REFERENCES:
- Chap. 1 of S. Kobayashi & K. Nomizu : *Foundations of Differential Geometry*,
vol. 1, Interscience Publishers (New York) (1963)
-- Chaps. 2 and 3 of J.M. Lee : *Introduction to Smooth Manifolds*, 2nd ed.,
- Springer (New York) (2013)
-
+- J.M. Lee : *Introduction to Topological Manifolds*, 2nd ed., Springer (New
+ York) (2011)
"""
@@ -45,40 +39,39 @@ class ContinuousMap(Morphism):
.. MATH::
- \Phi: U\subset M \longrightarrow V\subset N
+ \Phi: M \longrightarrow N
where `M` and `N` are topological manifolds over the same topological
- field `K`, `U` is an open subset of `M` and `V` is an open subset of `N`.
+ field `K`.
- Continuous maps are the *morphisms* of the *category* of
- topological manifolds. The set of all continuous maps from
- `U` to `V` is therefore the homset between `U` and `V` and is denoted
- by `\mathrm{Hom}(U,V)`.
+ Continuous maps are the *morphisms* of the *category* of topological
+ manifolds. The set of all continuous maps from `M` to `N` is therefore the
+ homset between `M` and `N`, which is denoted by `\mathrm{Hom}(M,N)`.
The class :class:`ContinuousMap` is a Sage *element* class, whose *parent*
class is :class:`~sage.manifolds.manifold_homset.TopManifoldHomset`.
INPUT:
- - ``parent`` -- homset `\mathrm{Hom}(U,V)` to which the continuous
+ - ``parent`` -- homset `\mathrm{Hom}(M,N)` to which the continuous
map belongs
- ``coord_functions`` -- (default: ``None``) if not ``None``, must be
a dictionary of the coordinate expressions (as lists (or tuples) of the
coordinates of the image expressed in terms of the coordinates of
the considered point) with the pairs of charts (chart1, chart2)
- as keys (chart1 being a chart on `U` and chart2 a chart on `V`).
+ as keys (chart1 being a chart on `M` and chart2 a chart on `N`).
If the dimension of the map's codomain is 1, a single coordinate
expression can be passed instead of a tuple with a single element
- ``name`` -- (default: ``None``) name given to the continuous map
- ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
- continuous map; if none is provided, the LaTeX symbol is set to
+ continuous map; if ``None``, the LaTeX symbol is set to
``name``
- ``is_isomorphism`` -- (default: ``False``) determines whether the
constructed object is a isomorphism (i.e. a homeomorphism); if set to
``True``, then the manifolds `M` and `N` must have the same dimension.
- ``is_identity`` -- (default: ``False``) determines whether the
constructed object is the identity map; if set to ``True``,
- then `V` must be `U` and the entry ``coord_functions`` is not used.
+ then `N` must be `M` and the entry ``coord_functions`` is not used.
.. NOTE::
@@ -97,15 +90,15 @@ class ContinuousMap(Morphism):
sage: V = M.open_subset('V') # complement of the South pole
sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole
sage: M.declare_union(U,V) # S^2 is the union of U and V
- sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)), \
- intersection_name='W', restrictions1= x^2+y^2!=0, \
- restrictions2= u^2+v^2!=0)
+ sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)),
+ ....: intersection_name='W', restrictions1= x^2+y^2!=0,
+ ....: restrictions2= u^2+v^2!=0)
sage: uv_to_xy = xy_to_uv.inverse()
sage: N = TopManifold(3, 'R^3', r'\RR^3') # R^3
sage: c_cart.<X,Y,Z> = N.chart() # Cartesian coordinates on R^3
- sage: Phi = M.continuous_map(N, \
- ....: {(c_xy, c_cart): [2*x/(1+x^2+y^2), 2*y/(1+x^2+y^2), (x^2+y^2-1)/(1+x^2+y^2)], \
- ....: (c_uv, c_cart): [2*u/(1+u^2+v^2), 2*v/(1+u^2+v^2), (1-u^2-v^2)/(1+u^2+v^2)]}, \
+ sage: Phi = M.continuous_map(N,
+ ....: {(c_xy, c_cart): [2*x/(1+x^2+y^2), 2*y/(1+x^2+y^2), (x^2+y^2-1)/(1+x^2+y^2)],
+ ....: (c_uv, c_cart): [2*u/(1+u^2+v^2), 2*v/(1+u^2+v^2), (1-u^2-v^2)/(1+u^2+v^2)]},
....: name='Phi', latex_name=r'\Phi')
sage: Phi
Continuous map Phi from the 2-dimensional topological manifold S^2 to
@@ -132,8 +125,9 @@ class ContinuousMap(Morphism):
sage: Phi1 = M.continuous_map(N, [2*x/(1+x^2+y^2), 2*y/(1+x^2+y^2), (x^2+y^2-1)/(1+x^2+y^2)], \
....: chart1=c_xy, chart2=c_cart, name='Phi', latex_name=r'\Phi')
- Since c_xy and c_cart are the default charts on respectively M and N, they
- can be omitted, so that the above declaration is equivalent to::
+ Since c_xy and c_cart are the default charts on respectively ``M`` and
+ ``N``, they can be omitted, so that the above declaration is equivalent
+ to::
sage: Phi1 = M.continuous_map(N, [2*x/(1+x^2+y^2), 2*y/(1+x^2+y^2), (x^2+y^2-1)/(1+x^2+y^2)], \
....: name='Phi', latex_name=r'\Phi')
@@ -153,7 +147,7 @@ class ContinuousMap(Morphism):
on U: (x, y) |--> (X, Y, Z) = (2*x/(x^2 + y^2 + 1), 2*y/(x^2 + y^2 + 1), (x^2 + y^2 - 1)/(x^2 + y^2 + 1))
on V: (u, v) |--> (X, Y, Z) = (2*u/(u^2 + v^2 + 1), 2*v/(u^2 + v^2 + 1), -(u^2 + v^2 - 1)/(u^2 + v^2 + 1))
- At this stage, Phi1 and Phi are fully equivalent::
+ At this stage, ``Phi1`` and ``Phi`` are fully equivalent::
sage: Phi1 == Phi
True
@@ -243,7 +237,7 @@ class ContinuousMap(Morphism):
sage: D = R2.open_subset('D', coord_def={c_xy: x^2+y^2<1}) # the open unit disk
sage: Phi = D.homeomorphism(R2, [x/sqrt(1-x^2-y^2), y/sqrt(1-x^2-y^2)],
- ....: name='Phi', latex_name=r'\Phi')
+ ....: name='Phi', latex_name=r'\Phi')
sage: Phi
Homeomorphism Phi from the Open subset D of the 2-dimensional
topological manifold R^2 to the 2-dimensional topological manifold R^2
@@ -265,7 +259,8 @@ class ContinuousMap(Morphism):
sage: q.coord()
(1/3*sqrt(3), 0)
- The inverse homeomorphism is computed by means of the method :meth:`inverse`::
+ The inverse homeomorphism is computed by means of the method
+ :meth:`inverse`::
sage: Phi.inverse()
Homeomorphism Phi^(-1) from the 2-dimensional topological manifold R^2
@@ -405,7 +400,7 @@ class ContinuousMap(Morphism):
if chart_pair[1] not in self._codomain.atlas():
raise ValueError("{} is not a chart ".format(
chart_pair[1]) +
- " defined on the {}".format(self._codomain))
+ "defined on the {}".format(self._codomain))
if n2 == 1:
# a single expression entry is allowed (instead of a
# tuple)
@@ -503,7 +498,8 @@ class ContinuousMap(Morphism):
INPUT:
- - ``other`` -- another instance of :class:`ContinuousMap` to compare with
+ - ``other`` -- another instance of :class:`ContinuousMap` to compare
+ with
OUTPUT:
@@ -546,7 +542,8 @@ class ContinuousMap(Morphism):
INPUT:
- - ``other`` -- another instance of :class:`ContinuousMap` to compare with
+ - ``other`` -- another instance of :class:`ContinuousMap` to compare
+ with
OUTPUT:
@@ -601,7 +598,7 @@ class ContinuousMap(Morphism):
def _call_(self, point):
r"""
- Compute the image of a point by ``self``.
+ Compute the image of a point by the continous map.
INPUT:
@@ -621,7 +618,8 @@ class ContinuousMap(Morphism):
sage: M = TopManifold(2, 'R^2', r'\RR^2') # Euclidean plane
sage: c_cart.<x,y> = M.chart() # Cartesian coordinates
sage: # A pi/3 rotation around the origin defined in Cartesian coordinates:
- sage: rot = M.continuous_map(M, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2), name='R')
+ sage: rot = M.continuous_map(M, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2),
+ ....: name='R')
sage: p = M.point((1,2), name='p')
sage: q = rot(p) ; q
Point R(p) on the 2-dimensional topological manifold R^2
@@ -696,7 +694,7 @@ class ContinuousMap(Morphism):
def is_identity(self):
r"""
- Check whether ``self`` is an identity map.
+ Check whether the continuous map is an identity map.
EXAMPLES:
@@ -715,7 +713,7 @@ class ContinuousMap(Morphism):
sage: a.is_identity()
False
- Of course, if the codomain of ``self`` does not coincide with its
+ Of course, if the codomain of the map does not coincide with its
domain, the outcome is ``False``::
sage: N = TopManifold(2, 'N')
@@ -814,8 +812,7 @@ class ContinuousMap(Morphism):
This applies only when the parent of ``self`` is a monoid, i.e. when
``self`` is an endomorphism of the category of topological manifolds,
- i.e. a continuous map U --> U, where U is some open subset of
- a topological manifold.
+ i.e. a continuous map M --> M, where M is a topological manifold.
INPUT:
@@ -834,7 +831,8 @@ class ContinuousMap(Morphism):
sage: f = M.continuous_map(M, [x+y, x*y], name='f')
sage: g = M.continuous_map(M, [1-y, 2+x], name='g')
sage: s = f._mul_(g); s
- Continuous map from the 2-dimensional topological manifold M to itself
+ Continuous map from the 2-dimensional topological manifold M to
+ itself
sage: s.display()
M --> M
(x, y) |--> (x - y + 3, -(x + 2)*y + x + 2)
@@ -880,7 +878,6 @@ class ContinuousMap(Morphism):
r"""
Delete the derived quantities
-
TEST::
sage: M = TopManifold(2, 'M')
@@ -908,12 +905,12 @@ class ContinuousMap(Morphism):
INPUT:
- - ``chart1`` -- (default: ``None``) chart on the map's domain; if ``None``,
- the display is performed on all the charts on the domain
+ - ``chart1`` -- (default: ``None``) chart on the map's domain; if
+ ``None``, the display is performed on all the charts on the domain
in which the map is known or computable via some change of
coordinates
- ``chart2`` -- (default: ``None``) chart on the map's codomain; if
- None, the display is performed on all the charts on the codomain
+ ``None``, the display is performed on all the charts on the codomain
in which the map is known or computable via some change of
coordinates
@@ -934,8 +931,8 @@ class ContinuousMap(Morphism):
sage: N = TopManifold(3, 'R^3', r'\RR^3') # R^3
sage: c_cart.<X,Y,Z> = N.chart() # Cartesian coordinates on R^3
sage: Phi = M.continuous_map(N, \
- ....: {(c_xy, c_cart): [2*x/(1+x^2+y^2), 2*y/(1+x^2+y^2), (x^2+y^2-1)/(1+x^2+y^2)], \
- ....: (c_uv, c_cart): [2*u/(1+u^2+v^2), 2*v/(1+u^2+v^2), (1-u^2-v^2)/(1+u^2+v^2)]}, \
+ ....: {(c_xy, c_cart): [2*x/(1+x^2+y^2), 2*y/(1+x^2+y^2), (x^2+y^2-1)/(1+x^2+y^2)],
+ ....: (c_uv, c_cart): [2*u/(1+u^2+v^2), 2*v/(1+u^2+v^2), (1-u^2-v^2)/(1+u^2+v^2)]},
....: name='Phi', latex_name=r'\Phi')
sage: Phi.display(c_xy, c_cart)
Phi: S^2 --> R^3
@@ -1081,10 +1078,10 @@ class ContinuousMap(Morphism):
INPUT:
- - ``chart1`` -- (default: ``None``) chart on the map's domain; if ``None``,
- the domain's default chart is assumed
- - ``chart2`` -- (default: ``None``) chart on the map's codomain; if
- None, the codomain's default chart is assumed
+ - ``chart1`` -- (default: ``None``) chart on the map's domain;
+ if ``None``, the domain's default chart is assumed
+ - ``chart2`` -- (default: ``None``) chart on the map's codomain;
+ if ``None``, the codomain's default chart is assumed
OUTPUT:
@@ -1102,7 +1099,8 @@ class ContinuousMap(Morphism):
sage: N = TopManifold(3, 'N')
sage: c_uv.<u,v> = M.chart()
sage: c_xyz.<x,y,z> = N.chart()
- sage: Phi = M.continuous_map(N, (u*v, u/v, u+v), name='Phi', latex_name=r'\Phi')
+ sage: Phi = M.continuous_map(N, (u*v, u/v, u+v), name='Phi',
+ ....: latex_name=r'\Phi')
sage: Phi.display()
Phi: M --> N
(u, v) |--> (x, y, z) = (u*v, u/v, u + v)
@@ -1120,7 +1118,8 @@ class ContinuousMap(Morphism):
sage: ch_uv_UV.inverse()(U,V)
(1/2*U + 1/2*V, -1/2*U + 1/2*V)
sage: c_XYZ.<X,Y,Z> = N.chart() # new chart on N
- sage: ch_xyz_XYZ = c_xyz.transition_map(c_XYZ, [2*x-3*y+z, y+z-x, -x+2*y-z])
+ sage: ch_xyz_XYZ = c_xyz.transition_map(c_XYZ,
+ ....: [2*x-3*y+z, y+z-x, -x+2*y-z])
sage: ch_xyz_XYZ.inverse()(X,Y,Z)
(3*X + Y + 4*Z, 2*X + Y + 3*Z, X + Y + Z)
sage: Phi.coord_functions(c_UV, c_xyz)
@@ -1131,9 +1130,10 @@ class ContinuousMap(Morphism):
-((u - 1)*v^2 - u*v - u)/v, -((u + 1)*v^2 + u*v - 2*u)/v) on the
Chart (M, (u, v))
sage: Phi.coord_functions(c_UV, c_XYZ)
- Coordinate functions (-1/2*(U^3 - (U - 2)*V^2 + V^3 - (U^2 + 2*U + 6)*V
- - 6*U)/(U - V), 1/4*(U^3 - (U + 4)*V^2 + V^3 - (U^2 - 4*U + 4)*V - 4*U)/(U - V),
- 1/4*(U^3 - (U - 4)*V^2 + V^3 - (U^2 + 4*U + 8)*V - 8*U)/(U - V))
+ Coordinate functions
+ (-1/2*(U^3 - (U - 2)*V^2 + V^3 - (U^2 + 2*U + 6)*V - 6*U)/(U - V),
+ 1/4*(U^3 - (U + 4)*V^2 + V^3 - (U^2 - 4*U + 4)*V - 4*U)/(U - V),
+ 1/4*(U^3 - (U - 4)*V^2 + V^3 - (U^2 + 4*U + 8)*V - 8*U)/(U - V))
on the Chart (M, (U, V))
Coordinate representation w.r.t. a subchart in the domain::
@@ -1250,9 +1250,9 @@ class ContinuousMap(Morphism):
# 4/ If this point is reached, the demanded value cannot be
# computed
- raise ValueError("the expression of the map in the pair of " +
- "charts (" + str(chart1) + ", " + str(chart2) + ") cannot " +
- "be computed by means of known changes of charts")
+ raise ValueError("the expression of the map in the pair " +
+ "({}, {})".format(chart1, chart2) + " cannot " +
+ "be computed by means of known changes of charts")
return self._coord_expression[(chart1, chart2)]
@@ -1266,10 +1266,10 @@ class ContinuousMap(Morphism):
INPUT:
- - ``chart1`` -- (default: ``None``) chart on the map's domain; if ``None``,
- the domain's default chart is assumed
- - ``chart2`` -- (default: ``None``) chart on the map's codomain; if
- None, the codomain's default chart is assumed
+ - ``chart1`` -- (default: ``None``) chart on the map's domain;
+ if ``None``, the domain's default chart is assumed
+ - ``chart2`` -- (default: ``None``) chart on the map's codomain;
+ if ``None``, the codomain's default chart is assumed
OUTPUT:
@@ -1286,7 +1286,8 @@ class ContinuousMap(Morphism):
sage: N = TopManifold(3, 'N')
sage: c_uv.<u,v> = M.chart()
sage: c_xyz.<x,y,z> = N.chart()
- sage: Phi = M.continuous_map(N, (u*v, u/v, u+v), name='Phi', latex_name=r'\Phi')
+ sage: Phi = M.continuous_map(N, (u*v, u/v, u+v), name='Phi',
+ ....: latex_name=r'\Phi')
sage: Phi.display()
Phi: M --> N
(u, v) |--> (x, y, z) = (u*v, u/v, u + v)
@@ -1304,7 +1305,8 @@ class ContinuousMap(Morphism):
sage: ch_uv_UV.inverse()(U,V)
(1/2*U + 1/2*V, -1/2*U + 1/2*V)
sage: c_XYZ.<X,Y,Z> = N.chart() # new chart on N
- sage: ch_xyz_XYZ = c_xyz.transition_map(c_XYZ, [2*x-3*y+z, y+z-x, -x+2*y-z])
+ sage: ch_xyz_XYZ = c_xyz.transition_map(c_XYZ,
+ ....: [2*x-3*y+z, y+z-x, -x+2*y-z])
sage: ch_xyz_XYZ.inverse()(X,Y,Z)
(3*X + Y + 4*Z, 2*X + Y + 3*Z, X + Y + Z)
sage: Phi.expr(c_UV, c_xyz)
@@ -1314,7 +1316,9 @@ class ContinuousMap(Morphism):
-((u - 1)*v^2 - u*v - u)/v,
-((u + 1)*v^2 + u*v - 2*u)/v)
sage: Phi.expr(c_UV, c_XYZ)
- (-1/2*(U^3 - (U - 2)*V^2 + V^3 - (U^2 + 2*U + 6)*V - 6*U)/(U - V), 1/4*(U^3 - (U + 4)*V^2 + V^3 - (U^2 - 4*U + 4)*V - 4*U)/(U - V), 1/4*(U^3 - (U - 4)*V^2 + V^3 - (U^2 + 4*U + 8)*V - 8*U)/(U - V))
+ (-1/2*(U^3 - (U - 2)*V^2 + V^3 - (U^2 + 2*U + 6)*V - 6*U)/(U - V),
+ 1/4*(U^3 - (U + 4)*V^2 + V^3 - (U^2 - 4*U + 4)*V - 4*U)/(U - V),
+ 1/4*(U^3 - (U - 4)*V^2 + V^3 - (U^2 + 4*U + 8)*V - 8*U)/(U - V))
A rotation in some Euclidean plane::
@@ -1328,7 +1332,8 @@ class ContinuousMap(Morphism):
Expression of the rotation in terms of Cartesian coordinates::
sage: c_cart.<x,y> = M.chart() # Declaration of Cartesian coordinates
- sage: ch_spher_cart = c_spher.transition_map(c_cart, [r*cos(ph), r*sin(ph)]) # relation to spherical coordinates
+ sage: ch_spher_cart = c_spher.transition_map(c_cart,
+ ....: [r*cos(ph), r*sin(ph)]) # relation to spherical coordinates
sage: ch_spher_cart.set_inverse(sqrt(x^2+y^2), atan2(y,x))
Check of the inverse coordinate transformation:
r == r
@@ -1370,14 +1375,16 @@ class ContinuousMap(Morphism):
sage: c_cart = c_xy.restrict(U) # Cartesian coordinates on U
sage: c_spher.<r,ph> = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi') # spherical coordinates on U
sage: # Links between spherical coordinates and Cartesian ones:
- sage: ch_cart_spher = c_cart.transition_map(c_spher, [sqrt(x*x+y*y), atan2(y,x)])
+ sage: ch_cart_spher = c_cart.transition_map(c_spher,
+ ....: [sqrt(x*x+y*y), atan2(y,x)])
sage: ch_cart_spher.set_inverse(r*cos(ph), r*sin(ph))
Check of the inverse coordinate transformation:
x == x
y == y
r == r
ph == arctan2(r*sin(ph), r*cos(ph))
- sage: rot = U.continuous_map(U, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2), name='R')
+ sage: rot = U.continuous_map(U, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2),
+ ....: name='R')
sage: rot.display(c_cart, c_cart)
R: U --> U
(x, y) |--> (-1/2*sqrt(3)*y + 1/2*x, 1/2*sqrt(3)*x + 1/2*y)
@@ -1394,7 +1401,8 @@ class ContinuousMap(Morphism):
sage: rot._coord_expression
{(Chart (U, (r, ph)),
- Chart (U, (r, ph))): Coordinate functions (r, 1/3*pi + ph) on the Chart (U, (r, ph))}
+ Chart (U, (r, ph))): Coordinate functions (r, 1/3*pi + ph)
+ on the Chart (U, (r, ph))}
It is recovered (thanks to the known change of coordinates) by a call
to :meth:`display`::
@@ -1408,25 +1416,26 @@ class ContinuousMap(Morphism):
Chart (U, (x, y))): Coordinate functions (-1/2*sqrt(3)*y + 1/2*x,
1/2*sqrt(3)*x + 1/2*y) on the Chart (U, (x, y)),
(Chart (U, (r, ph)),
- Chart (U, (r, ph))): Coordinate functions (r, 1/3*pi + ph) on the Chart (U, (r, ph))}
+ Chart (U, (r, ph))): Coordinate functions (r, 1/3*pi + ph)
+ on the Chart (U, (r, ph))}
"""
if self._is_identity:
raise NotImplementedError("set_expr() must not be used for the " +
"identity map")
if chart1 not in self._domain.atlas():
- raise ValueError("The " + str(chart1) +
- " has not been defined on the " + str(self._domain))
+ raise ValueError("the {}".format(chart1) +
+ " has not been defined on the {}".format(self._domain))
if chart2 not in self._codomain.atlas():
- raise ValueError("The " + str(chart2) +
- " has not been defined on the " + str(self._codomain))
+ raise ValueError("the {}".format(chart2) +
+ " has not been defined on the {}".format(self._codomain))
self._coord_expression.clear()
self._del_derived()
n2 = self._codomain.dim()
if n2 > 1:
if len(coord_functions) != n2:
- raise ValueError(str(n2) +
- " coordinate function must be provided.")
+ raise ValueError("{} coordinate functions must ".format(n2) +
+ "be provided.")
self._coord_expression[(chart1, chart2)] = \
chart1.multifunction(*coord_functions)
else:
@@ -1453,7 +1462,7 @@ class ContinuousMap(Morphism):
.. WARNING::
If the map has already expressions in other charts, it
- is the user's responsability to make sure that the expression
+ is the user's responsibility to make sure that the expression
to be added is consistent with them.
EXAMPLES:
@@ -1475,7 +1484,8 @@ class ContinuousMap(Morphism):
y == y
r == r
ph == arctan2(r*sin(ph), r*cos(ph))
- sage: rot = U.continuous_map(U, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2), name='R')
+ sage: rot = U.continuous_map(U, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2),
+ ....: name='R')
sage: rot.display(c_cart, c_cart)
R: U --> U
(x, y) |--> (-1/2*sqrt(3)*y + 1/2*x, 1/2*sqrt(3)*x + 1/2*y)
@@ -1506,7 +1516,8 @@ class ContinuousMap(Morphism):
Chart (U, (x, y))): Coordinate functions (-1/2*sqrt(3)*y + 1/2*x,
1/2*sqrt(3)*x + 1/2*y) on the Chart (U, (x, y)),
(Chart (U, (r, ph)),
- Chart (U, (r, ph))): Coordinate functions (r, 1/3*pi + ph) on the Chart (U, (r, ph))}
+ Chart (U, (r, ph))): Coordinate functions (r, 1/3*pi + ph)
+ on the Chart (U, (r, ph))}
If, on the contrary, we use :meth:`set_expr`, the expression in
Cartesian coordinates is lost::
@@ -1514,7 +1525,8 @@ class ContinuousMap(Morphism):
sage: rot.set_expr(c_spher, c_spher, (r, ph+pi/3))
sage: rot._coord_expression
{(Chart (U, (r, ph)),
- Chart (U, (r, ph))): Coordinate functions (r, 1/3*pi + ph) on the Chart (U, (r, ph))}
+ Chart (U, (r, ph))): Coordinate functions (r, 1/3*pi + ph)
+ on the Chart (U, (r, ph))}
It is recovered (thanks to the known change of coordinates) by a call
to :meth:`display`::
@@ -1528,7 +1540,8 @@ class ContinuousMap(Morphism):
Chart (U, (x, y))): Coordinate functions (-1/2*sqrt(3)*y + 1/2*x,
1/2*sqrt(3)*x + 1/2*y) on the Chart (U, (x, y)),
(Chart (U, (r, ph)),
- Chart (U, (r, ph))): Coordinate functions (r, 1/3*pi + ph) on the Chart (U, (r, ph))}
+ Chart (U, (r, ph))): Coordinate functions (r, 1/3*pi + ph)
+ on the Chart (U, (r, ph))}
The rotation can be applied to a point by means of either coordinate
system::
@@ -1545,17 +1558,17 @@ class ContinuousMap(Morphism):
raise NotImplementedError("add_expr() must not be used for the " +
"identity map")
if chart1 not in self._domain.atlas():
- raise ValueError("The " + str(chart1) +
- " has not been defined on the " + str(self._domain))
+ raise ValueError("the {}".format(chart1) +
+ " has not been defined on the {}".format(self._domain))
if chart2 not in self._codomain.atlas():
- raise ValueError("The " + str(chart2) +
- " has not been defined on the " + str(self._codomain))
+ raise ValueError("the {}".format(chart2) +
+ " has not been defined on the {}".format(self._codomain))
self._del_derived()
n2 = self._codomain.dim()
if n2 > 1:
if len(coord_functions) != n2:
- raise ValueError(str(n2) +
- " coordinate function must be provided.")
+ raise ValueError("{} coordinate functions must ".format(n2) +
+ "be provided")
self._coord_expression[(chart1, chart2)] = \
chart1.multifunction(*coord_functions)
else:
@@ -1564,20 +1577,22 @@ class ContinuousMap(Morphism):
def restrict(self, subdomain, subcodomain=None):
r"""
- Restriction of the continuous map to some subdomain of its
+ Restriction of the continuous map to some open subset of its
domain of definition.
INPUT:
- - ``subdomain`` -- the subdomain of ``self._domain`` (instance of
- :class:`~sage.manifolds.manifold.TopManifold`)
- - ``subcodomain`` -- (default: ``None``) subdomain of ``self._codomain``;
- if ``None``, ``self._codomain`` is assumed.
+ - ``subdomain`` -- an open subset of the domain of the continuous map
+ (must be an instance of :class:`~sage.manifolds.manifold.TopManifold`)
+ - ``subcodomain`` -- (default: ``None``) an open subset of the codomain
+ of the continuous map (must be an instance of
+ :class:`~sage.manifolds.manifold.TopManifold`); if ``None``, the
+ codomain of the continuous map is assumed.
OUTPUT:
- - the restriction of ``self`` to ``dom``, as an instance of
- class :class:`ContinuousMap`
+ - the restriction of the continuous map to ``subdomain``, as an
+ instance of class :class:`ContinuousMap`
EXAMPLE:
@@ -1587,7 +1602,8 @@ class ContinuousMap(Morphism):
sage: M = TopManifold(2, 'R^2') # R^2
sage: c_xy.<x,y> = M.chart() # Cartesian coord. on R^2
sage: D = M.open_subset('D', coord_def={c_xy: x^2+y^2<1}) # the open unit disk
- sage: Phi = D.continuous_map(M, [x/sqrt(1-x^2-y^2), y/sqrt(1-x^2-y^2)], name='Phi', latex_name=r'\Phi')
+ sage: Phi = D.continuous_map(M, [x/sqrt(1-x^2-y^2), y/sqrt(1-x^2-y^2)],
+ ....: name='Phi', latex_name=r'\Phi')
sage: Phi.display()
Phi: D --> R^2
(x, y) |--> (x, y) = (x/sqrt(-x^2 - y^2 + 1), y/sqrt(-x^2 - y^2 + 1))
@@ -1595,7 +1611,8 @@ class ContinuousMap(Morphism):
sage: U = D.open_subset('U', coord_def={c_xy_D: x^2+y^2>1/2}) # the annulus 1/2 < r < 1
sage: Phi.restrict(U)
Continuous map Phi from the Open subset U of the 2-dimensional
- topological manifold R^2 to the 2-dimensional topological manifold R^2
+ topological manifold R^2 to the 2-dimensional topological
+ manifold R^2
sage: Phi.restrict(U).parent()
Set of Morphisms from Open subset U of the 2-dimensional topological
manifold R^2 to 2-dimensional topological manifold R^2 in Category
@@ -1671,7 +1688,8 @@ class ContinuousMap(Morphism):
else:
for sch2 in ch2._subcharts:
if (ch1, sch2) in resu._coord_expression:
- del resu._coord_expression[(ch1, sch2)]
+ del resu._coord_expression[(ch1,
+ sch2)]
coord_functions = \
self._coord_expression[charts].expr()
resu._coord_expression[(ch1, ch2)] = \
@@ -1682,7 +1700,7 @@ class ContinuousMap(Morphism):
def __invert__(self):
r"""
- Return the inverse of ``self`` if ``self`` is a isomorphism.
+ Return the inverse of the map whenever it is an isomorphism.
OUTPUT:
@@ -1696,7 +1714,8 @@ class ContinuousMap(Morphism):
sage: M = TopManifold(2, 'R^2', r'\RR^2')
sage: c_cart.<x,y> = M.chart()
sage: # A pi/3 rotation around the origin:
- sage: rot = M.homeomorphism(M, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2), name='R')
+ sage: rot = M.homeomorphism(M, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2),
+ ....: name='R')
sage: rot.inverse()
Homeomorphism R^(-1) of the 2-dimensional topological manifold R^2
sage: rot.inverse().display()
@@ -1734,11 +1753,12 @@ class ContinuousMap(Morphism):
sage: V = M.open_subset('V') # complement of the South pole
sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole
sage: M.declare_union(U,V) # S^2 is the union of U and V
- sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)), \
- intersection_name='W', restrictions1= x^2+y^2!=0, \
- restrictions2= u^2+v^2!=0)
+ sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)),
+ ....: intersection_name='W', restrictions1= x^2+y^2!=0,
+ ....: restrictions2= u^2+v^2!=0)
sage: uv_to_xy = xy_to_uv.inverse()
- sage: s = M.homeomorphism(M, {(c_xy, c_uv): [x, y], (c_uv, c_xy): [u, v]}, name='s')
+ sage: s = M.homeomorphism(M, {(c_xy, c_uv): [x, y], (c_uv, c_xy): [u, v]},
+ ....: name='s')
sage: s.display()
s: M --> M
on U: (x, y) |--> (u, v) = (x, y)
diff --git a/src/sage/manifolds/coord_func.py b/src/sage/manifolds/coord_func.py
index c66964d..fc4def0 100644
--- a/src/sage/manifolds/coord_func.py
+++ b/src/sage/manifolds/coord_func.py
@@ -502,7 +502,7 @@ class CoordFunction(SageObject):
def __call__(self, *coords, **options):
r"""
- Computes the value of the function at specified coordinates.
+ Compute the value of the function at specified coordinates.
INPUT:
@@ -1658,7 +1658,6 @@ class MultiCoordFunction(SageObject):
[[True, True], [True, True], [True, True]]
"""
- from sage.matrix.constructor import matrix
if self._jacob is None:
xx = self._chart[:] # coordinates x^j
self._jacob = [[ self._functions[i].diff(xx[j])
@@ -1760,4 +1759,3 @@ class MultiCoordFunction(SageObject):
self.jacobian() # forces the computation of self._jacob
self._jacob_det = simple_determinant(self._jacob)
return self._jacob_det
-
diff --git a/src/sage/manifolds/coord_func_symb.py b/src/sage/manifolds/coord_func_symb.py
index ca7c6fa..e90b977 100644
--- a/src/sage/manifolds/coord_func_symb.py
+++ b/src/sage/manifolds/coord_func_symb.py
@@ -436,7 +436,7 @@ class CoordFunctionSymb(CoordFunction):
def __call__(self, *coords, **options):
r"""
- Computes the value of the function at specified coordinates.
+ Compute the value of the function at specified coordinates.
INPUT:
diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py
index 1a8e2d1..d472f3a 100644
--- a/src/sage/manifolds/manifold.py
+++ b/src/sage/manifolds/manifold.py
@@ -159,6 +159,27 @@ Similarly::
sage: stereoN(S)
(0, 0)
+A continuous map `S^2\rightarrow \RR` (scalar field)::
+
+ sage: f = M.scalar_field({stereoN: atan(x^2+y^2), stereoS: pi/2-atan(u^2+v^2)},
+ ....: name='f')
+ sage: f
+ Scalar field f on the 2-dimensional topological manifold S^2
+ sage: f.display()
+ f: S^2 --> R
+ on U: (x, y) |--> arctan(x^2 + y^2)
+ on V: (u, v) |--> 1/2*pi - arctan(u^2 + v^2)
+ sage: f(p)
+ arctan(5)
+ sage: f(N)
+ 1/2*pi
+ sage: f(S)
+ 0
+ sage: f.parent()
+ Algebra of scalar fields on the 2-dimensional topological manifold S^2
+ sage: f.parent().category()
+ Category of commutative algebras over Symbolic Ring
+
.. RUBRIC:: Example 2: the Riemann sphere as a topological manifold of
dimension 1 over `\CC`
@@ -277,7 +298,6 @@ from sage.categories.sets_cat import Sets
#*# After #18175, this should become
# from sage.categories.manifolds import Manifolds
from sage.categories.homset import Hom
-from sage.misc.latex import latex
from sage.manifolds.subset import TopManifoldSubset
from sage.manifolds.scalarfield_algebra import ScalarFieldAlgebra
@@ -313,7 +333,7 @@ class TopManifold(TopManifoldSubset):
- ``start_index`` -- (default: 0) integer; lower value of the range of
indices used for "indexed objects" on the manifold, e.g. coordinates
in a chart
- - ``category`` -- (default: ``None``) to specify the categeory; the
+ - ``category`` -- (default: ``None``) to specify the category; the
default being ``Sets()`` (``Manifolds()`` after :trac:`18175` is
implemented)
- ``ambient_manifold`` -- (default: ``None``) if not ``None``, the created
@@ -458,11 +478,12 @@ class TopManifold(TopManifoldSubset):
ambient_manifold = self
elif not isinstance(ambient_manifold, TopManifold):
raise TypeError("the argument 'ambient_manifold' must be " +
- " a topological manifold")
+ "a topological manifold")
# Initialization as a subset of the ambient manifold (possibly itself):
TopManifoldSubset.__init__(self, ambient_manifold, name,
latex_name=latex_name, category=category)
self._is_open = True
+ self._open_covers = [[self]] # list of open covers of self
self._atlas = [] # list of charts defined on subsets of self
self._top_charts = [] # list of charts defined on subsets of self
# that are not subcharts of charts on larger subsets
@@ -812,7 +833,6 @@ class TopManifold(TopManifoldSubset):
yield i
i += 1
-
def index_generator(self, nb_indices):
r"""
Generator of index series.
@@ -900,12 +920,12 @@ class TopManifold(TopManifoldSubset):
def top_charts(self):
r"""
- Return the list of charts defined on subsets of the current set
+ Return the list of charts defined on subsets of the current manifold
that are not subcharts of charts on larger subsets.
OUTPUT:
- - list of charts defined on open subsets of ``self`` but not on
+ - list of charts defined on open subsets of the manifold but not on
larger subsets
EXAMPLES:
@@ -987,14 +1007,14 @@ class TopManifold(TopManifoldSubset):
"""
from chart import Chart
if not isinstance(chart, Chart):
- raise TypeError(str(chart) + " is not a chart.")
+ raise TypeError("{} is not a chart".format(chart))
if chart._domain is not self:
if self.is_manifestly_coordinate_domain():
- raise TypeError("The chart domain must coincide with the " +
- str(self) + ".")
+ raise TypeError("the chart domain must coincide with " +
+ "the {}".format(self))
if chart not in self._atlas:
- raise ValueError("The chart must be defined on the " +
- str(self))
+ raise ValueError("the chart must be defined on the " +
+ "{}".format(self))
self._def_chart = chart
def coord_change(self, chart1, chart2):
@@ -1031,12 +1051,11 @@ class TopManifold(TopManifoldSubset):
"""
if (chart1, chart2) not in self._coord_changes:
- raise TypeError("The change of coordinates from " + str(chart1) +
- " to " + str(chart2) + " has not been " +
- "defined on the " + str(self))
+ raise TypeError("the change of coordinates from " +
+ "{} to {}".format(chart1, chart2) + " has not " +
+ "been defined on the {}".format(self))
return self._coord_changes[(chart1, chart2)]
-
def coord_changes(self):
r"""
Return the changes of coordinates (transition maps) defined on
@@ -1087,10 +1106,9 @@ class TopManifold(TopManifoldSubset):
"""
return self._coord_changes
-
def is_manifestly_coordinate_domain(self):
r"""
- Returns ``True`` if the manifold is known to be the domain of some
+ Return ``True`` if the manifold is known to be the domain of some
coordinate chart and ``False`` otherwise.
If ``False`` is returned, either the manifold cannot be the domain of
@@ -1129,8 +1147,8 @@ class TopManifold(TopManifoldSubset):
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 on ``self`` and values the symbolic expressions formed by the
- coordinates to define the subset.
+ charts on the manifold and values the symbolic expressions formed by
+ the coordinates to define the subset.
OUTPUT:
@@ -1138,16 +1156,16 @@ class TopManifold(TopManifoldSubset):
EXAMPLES:
- Creating an open subset of a manifold::
+ Creating an open subset of a 2-dimensional manifold::
sage: TopManifold._clear_cache_() # for doctests only
sage: M = TopManifold(2, 'M')
sage: A = M.open_subset('A'); A
Open subset A of the 2-dimensional topological manifold M
- As an open subset of a topological manifold, A is itself a topological
- manifold, on the same topological field and of the same dimension a
- M::
+ As an open subset of a topological manifold, ``A`` is itself a
+ topological manifold, on the same topological field and of the same
+ dimension as ``M``::
sage: isinstance(A, TopManifold)
True
@@ -1156,7 +1174,7 @@ class TopManifold(TopManifoldSubset):
sage: dim(A) == dim(M)
True
- Creating an open subset of A::
+ Creating an open subset of ``A``::
sage: B = A.open_subset('B'); B
Open subset B of the 2-dimensional topological manifold M
@@ -1179,9 +1197,9 @@ class TopManifold(TopManifoldSubset):
sage: U = M.open_subset('U', coord_def={c_cart: x^2+y^2<1}); U
Open subset U of the 2-dimensional topological manifold R^2
- Since the argument ``coord_def`` has been set, U is automatically
+ Since the argument ``coord_def`` has been set, ``U`` is automatically
provided with a chart, which is the restriction of the Cartesian one
- to U::
+ to ``U``::
sage: U.atlas()
[Chart (U, (x, y))]
@@ -1200,15 +1218,30 @@ class TopManifold(TopManifoldSubset):
field=self._field, start_index=self._sindex,
category=self.category(),
ambient_manifold=self._manifold)
+ #!# NB: the above could have been
+ # resu = type(self).__base__(...) instead of resu = TopManifold(...)
+ # to allow for open_subset() of derived classes to call first this
+ # version,
+ # but, because of the category framework, it could NOT have been
+ # resu = self.__class__(...)
+ # cf. the discussion in
+ # https://groups.google.com/forum/#!topic/sage-devel/jHlFxhMDf3Y
resu._supersets.update(self._supersets)
for sd in self._supersets:
sd._subsets.add(resu)
self._top_subsets.add(resu)
+ # Charts on the result from the coordinate definition:
for chart, restrictions in coord_def.iteritems():
if chart not in self._atlas:
- raise ValueError("The " + str(chart) + "does not belong to " +
- "the atlas of " + str(self))
+ raise ValueError("the {} does not belong to ".format(chart) +
+ "the atlas of {}".format(self))
chart.restrict(resu, restrictions)
+ # Transition maps on the result inferred from those of self:
+ for chart1 in coord_def:
+ for chart2 in coord_def:
+ if chart2 != chart1:
+ if (chart1, chart2) in self._coord_changes:
+ self._coord_changes[(chart1, chart2)].restrict(resu)
return resu
def chart(self, coordinates='', names=None):
@@ -1258,7 +1291,7 @@ class TopManifold(TopManifoldSubset):
below)
- ``names`` -- (default: ``None``) unused argument, except if
``coordinates`` is not provided; it must then be a tuple containing
- the coordinate symbols (this is guaranted if the shortcut operator
+ the coordinate symbols (this is guaranteed if the shortcut operator
``<,>`` is used).
OUTPUT:
@@ -1448,7 +1481,7 @@ class TopManifold(TopManifoldSubset):
# check validity of entry
for chart in coord_expression:
if not chart._domain.is_subset(self):
- raise ValueError("the {} is not defined ".formart(chart) +
+ raise ValueError("the {} is not defined ".format(chart) +
"on some subset of the " + str(self))
return self.scalar_field_algebra().element_class(self,
coord_expression=coord_expression,
@@ -1516,6 +1549,11 @@ class TopManifold(TopManifoldSubset):
r"""
Return the zero scalar field defined on the manifold.
+ OUTPUT:
+
+ - instance of :class:`~sage.manifolds.scalarfield.ScalarField`
+ representing the constant scalar field with value 0.
+
EXAMPLE::
sage: TopManifold._clear_cache_() # for doctests only
@@ -1536,7 +1574,14 @@ class TopManifold(TopManifoldSubset):
def one_scalar_field(self):
r"""
- Return the constant scalar field one defined on the manifold.
+ Return the constant scalar field with value the unit element of the
+ manifold's base field.
+
+ OUTPUT:
+
+ - instance of :class:`~sage.manifolds.scalarfield.ScalarField`
+ representing the constant scalar field with value the unit element
+ of the manifold's base field.
EXAMPLE::
@@ -1600,8 +1645,8 @@ class TopManifold(TopManifoldSubset):
INPUT:
- - ``codomain`` -- the map codomain (the arrival manifold or some
- subset of it)
+ - ``codomain`` -- the map's codomain (must be an instance
+ of :class:`TopManifold`)
- ``coord_functions`` -- (default: ``None``) if not ``None``, must be
either
@@ -1614,15 +1659,15 @@ class TopManifold(TopManifoldSubset):
- (ii) a single coordinate expression in a given pair of charts, the
latter being provided by the arguments ``chart1`` and ``chart2``
- In both cases, if the dimension of the arrival manifold is 1,
- a single coordinate expression can be passed instead of a tuple with
- a single element
+ In both cases, if the dimension of the codomain is 1, a single
+ coordinate expression can be passed instead of a tuple with a single
+ element
- ``chart1`` -- (default: ``None``; used only in case (ii) above) chart
on the current manifold defining the start coordinates involved in
``coord_functions`` for case (ii); if none is provided, the
coordinates are assumed to refer to the manifold's default chart
- ``chart2`` -- (default: ``None``; used only in case (ii) above) chart
- on ``codomain`` defining the arrival coordinates involved in
+ on ``codomain`` defining the target coordinates involved in
``coord_functions`` for case (ii); if none is provided, the
coordinates are assumed to refer to the default chart of ``codomain``
- ``name`` -- (default: ``None``) name given to the continuous
@@ -1705,8 +1750,8 @@ class TopManifold(TopManifoldSubset):
INPUT:
- - ``codomain`` -- codomain of the homeomorphism (the arrival manifold
- or some subset of it)
+ - ``codomain`` -- codomain of the homeomorphism (must be an instance
+ of :class:`TopManifold`)
- ``coord_functions`` -- (default: ``None``) if not ``None``, must be
either
@@ -1719,15 +1764,15 @@ class TopManifold(TopManifoldSubset):
- (ii) a single coordinate expression in a given pair of charts, the
latter being provided by the arguments ``chart1`` and ``chart2``
- In both cases, if the dimension of the arrival manifold is 1,
- a single coordinate expression can be passed instead of a tuple with
+ In both cases, if the dimension of the codomain is 1, a single
+ coordinate expression can be passed instead of a tuple with
a single element
- ``chart1`` -- (default: ``None``; used only in case (ii) above) chart
on the current manifold defining the start coordinates involved in
``coord_functions`` for case (ii); if none is provided, the
coordinates are assumed to refer to the manifold's default chart
- ``chart2`` -- (default: ``None``; used only in case (ii) above) chart
- on ``codomain`` defining the arrival coordinates involved in
+ on ``codomain`` defining the target coordinates involved in
``coord_functions`` for case (ii); if none is provided, the
coordinates are assumed to refer to the default chart of ``codomain``
- ``name`` -- (default: ``None``) name given to the homeomorphism
@@ -1744,7 +1789,8 @@ class TopManifold(TopManifoldSubset):
Homeomorphism between the open unit disk in `\RR^2` and `\RR^2`::
- sage: TopManifold._clear_cache_() # for doctests only
+ sage: TopManifold._clear_cache_() # for doctests only
+ sage: forget() # for doctests only
sage: M = TopManifold(2, 'M') # the open unit disk
sage: c_xy.<x,y> = M.chart('x:(-1,1) y:(-1,1)') # Cartesian coord on M
sage: c_xy.add_restrictions(x^2+y^2<1)
@@ -1840,4 +1886,3 @@ class TopManifold(TopManifoldSubset):
"""
return self._identity_map
-
diff --git a/src/sage/manifolds/manifold_homset.py b/src/sage/manifolds/manifold_homset.py
index b734e00..2f10c6a 100644
--- a/src/sage/manifolds/manifold_homset.py
+++ b/src/sage/manifolds/manifold_homset.py
@@ -1,5 +1,5 @@
r"""
-Sets of morphisms between topologial manifolds
+Sets of morphisms between topological manifolds
The class :class:`TopManifoldHomset` implements sets of morphisms between
two topological manifolds over the same topological field `K`, a morphism
@@ -13,8 +13,6 @@ REFERENCES:
- J.M. Lee : *Introduction to Topological Manifolds*, 2nd ed., Springer (New
York) (2011)
-- J.M. Lee : *Introduction to Smooth Manifolds*, 2nd ed., Springer (New York)
- (2013)
- S. Kobayashi & K. Nomizu : *Foundations of Differential Geometry*, vol. 1,
Interscience Publishers (New York) (1963)
@@ -33,32 +31,29 @@ from sage.structure.parent import Parent
from sage.structure.unique_representation import UniqueRepresentation
from sage.manifolds.continuous_map import ContinuousMap
-class TopManifoldHomset(Homset, UniqueRepresentation):
+class TopManifoldHomset(UniqueRepresentation, Homset):
r"""
Set of continuous maps between two topological manifolds.
Given two topological manifolds `M` and `N` over a topological field `K`,
the class :class:`TopManifoldHomset` implements the set
- `\mathrm{Hom}(U,V)` of morphisms (i.e. continuous maps) `U\rightarrow V`,
- where `U` is an open subset of `M` and `V` an open subset of `N`.
- Note that, as open subsets of topological manifolds, `U` and `V` are
- topological manifolds by themselves.
+ `\mathrm{Hom}(M,N)` of morphisms (i.e. continuous maps) `M\rightarrow N`.
This is a Sage *parent* class, whose *element* class is
:class:`~sage.manifolds.continuous_map.ContinuousMap`.
INPUT:
- - ``domain`` -- open subset `U\subset M` (domain of the morphisms),
- as an instance of
+ - ``domain`` -- topological manifold `M` (domain of the morphisms belonging
+ to the homset), as an instance of
:class:`~sage.manifolds.manifold.TopManifold`
- - ``codomain`` -- open subset `V\subset N` (codomain of the morphisms),
- as an instance of
+ - ``codomain`` -- topological manifold `N` (codomain of the morphisms
+ belonging to the homset), as an instance of
:class:`~sage.manifolds.manifold.TopManifold`
- ``name`` -- (default: ``None``) string; name given to the homset; if
- none is provided, Hom(U,V) will be used
+ ``None``, Hom(M,N) will be used
- ``latex_name`` -- (default: ``None``) string; LaTeX symbol to denote the
- homset; if none is provided, `\mathrm{Hom}(U,V)` will be used
+ homset; if ``None``, `\mathrm{Hom}(M,N)` will be used
EXAMPLES:
@@ -209,28 +204,27 @@ class TopManifoldHomset(Homset, UniqueRepresentation):
def _element_constructor_(self, coord_functions, name=None, latex_name=None,
is_isomorphism=False, is_identity=False):
r"""
- Construct an element of ``self``, i.e. a continuous map
- U --> V, where U is the domain of ``self`` and V its codomain.
+ Construct an element of the homset, i.e. a continuous map
+ M --> N, where M is the domain of the homset and N its codomain.
INPUT:
- ``coord_functions`` -- a dictionary of the coordinate expressions
(as lists (or tuples) of the coordinates of the image expressed in
terms of the coordinates of the considered point) with the pairs of
- charts (chart1, chart2) as keys (chart1 being a chart on `U` and
- chart2 a chart on `V`). If the dimension of the arrival manifold
+ charts (chart1, chart2) as keys (chart1 being a chart on `M` and
+ chart2 a chart on `N`). If the dimension of the arrival manifold
is 1, a single coordinate expression can be passed instead of a tuple
with a single element
- ``name`` -- (default: ``None``) name given to the continuous map
- ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
- continuous map; if none is provided, the LaTeX symbol is set to
- ``name``
+ continuous map; if ``None``, the LaTeX symbol is set to ``name``
- ``is_isomorphism`` -- (default: ``False``) determines whether the
constructed object is a isomorphism (i.e. a homeomorphism); if set to
``True``, then the manifolds `M` and `N` must have the same dimension.
- ``is_identity`` -- (default: ``False``) determines whether the
constructed object is the identity map; if set to ``True``,
- then `V` must be `U` and the entry ``coord_functions`` is not used.
+ then `N` must be `M` and the entry ``coord_functions`` is not used.
.. NOTE::
@@ -251,13 +245,15 @@ class TopManifoldHomset(Homset, UniqueRepresentation):
sage: N = TopManifold(3, 'N')
sage: Y.<u,v,w> = N.chart()
sage: H = Hom(M, N)
- sage: f = H._element_constructor_({(X, Y): [x+y, x-y, x*y]}, name='f') ; f
+ sage: f = H._element_constructor_({(X, Y): [x+y, x-y, x*y]},
+ ....: name='f'); f
Continuous map f from the 2-dimensional topological manifold M to
the 3-dimensional topological manifold N
sage: f.display()
f: M --> N
(x, y) |--> (u, v, w) = (x + y, x - y, x*y)
- sage: id = Hom(M, M)._element_constructor_({}, is_identity=True) ; id
+ sage: id = Hom(M, M)._element_constructor_({}, is_identity=True)
+ sage: id
Identity map Id_M of the 2-dimensional topological manifold M
sage: id.display()
Id_M: M --> M
@@ -362,18 +358,18 @@ class TopManifoldHomset(Homset, UniqueRepresentation):
def one(self):
r"""
- Return the identity element of ``self`` considered as a monoid (case of
- an endomorphism set).
+ Return the identity element of the homset considered as a monoid (case
+ of a set of endomorphisms).
- This applies only when the codomain of ``self`` is equal to its domain,
- i.e. when ``self`` is of the type `\mathrm{Hom}(U,U)` where `U` is
- an open subset of some manifold. `\mathrm{Hom}(U,U)` equiped with the
- law of morphisms composition is then a monoid, whose identity element
- is nothing but the identity map of `U`.
+ This applies only when the codomain of the homset is equal to its
+ domain, i.e. when the homset is of the type `\mathrm{Hom}(M,M)`.
+ Indeed, `\mathrm{Hom}(M,M)` equipped with the law of morphisms
+ composition is a monoid, whose identity element is nothing but the
+ identity map of `M`.
OUTPUT:
- - the identity map of `U`, as an instance of
+ - the identity map of `M`, as an instance of
:class:`~sage.manifolds.continuous_map.ContinuousMap`
EXAMPLE:
@@ -400,7 +396,7 @@ class TopManifoldHomset(Homset, UniqueRepresentation):
sage: H.one() is H.one()
True
- If ``self`` is not a set of endomorphisms, the identity element is
+ If the homset is not a set of endomorphisms, the identity element is
meaningless::
sage: N = TopManifold(3, 'N')
diff --git a/src/sage/manifolds/point.py b/src/sage/manifolds/point.py
index 36f3641..a0a19cb 100644
--- a/src/sage/manifolds/point.py
+++ b/src/sage/manifolds/point.py
@@ -84,11 +84,11 @@ class TopManifoldPoint(Element):
- ``coords`` -- (default: ``None``) the point coordinates (as a tuple or a
list) in the chart ``chart``
- ``chart`` -- (default: ``None``) chart in which the coordinates are given;
- if none is provided, the coordinates are assumed
- to refer to the subset's default chart
+ if ``None``, the coordinates are assumed to refer to the subset's
+ default chart
- ``name`` -- (default: ``None``) name given to the point
- - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the point; if
- none is provided, the LaTeX symbol is set to ``name``
+ - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the point;
+ if ``None``, the LaTeX symbol is set to ``name``
- ``check_coords`` -- (default: ``True``) determines whether ``coords`` are
valid coordinates for the chart ``chart``; for symbolic coordinates, it
is recommended to set ``check_coords`` to ``False``.
@@ -173,18 +173,18 @@ class TopManifoldPoint(Element):
# charts, with the charts as keys
if coords is not None:
if len(coords) != self._manifold._dim:
- raise ValueError("The number of coordinates must be equal" +
- " to the manifold dimension.")
+ raise ValueError("the number of coordinates must be equal " +
+ "to the manifold's dimension")
if chart is None:
chart = self._subset._def_chart
elif self._subset._is_open:
if chart not in self._subset._atlas:
- raise ValueError("The " + str(chart) +
- " has not been defined on the " + str(self._subset))
+ raise ValueError("the {}".format(chart) + " has not " +
+ "been defined on the {}".format(self._subset))
if check_coords:
if not chart.valid_coordinates(*coords):
- raise ValueError("The coordinates " + str(coords) +
- " are not valid on the " + str(chart))
+ raise ValueError("the coordinates {}".format(coords) +
+ " are not valid on the {}".format(chart))
for schart in chart._supercharts:
self._coordinates[schart] = tuple(coords)
for schart in chart._subcharts:
@@ -249,10 +249,10 @@ class TopManifoldPoint(Element):
def containing_set(self):
r"""
- Return a manifold subset that contains ``self``.
+ Return a manifold subset that contains the point.
A priori, this method returns the manifold subset (possibly the
- manifold itself) in which the point ``self`` has been defined.
+ manifold itself) in which the point has been defined.
OUTPUT:
@@ -305,9 +305,9 @@ class TopManifoldPoint(Element):
- ``chart`` -- (default: ``None``) chart in which the coordinates are
given; if none is provided, the coordinates are assumed to refer to
the subset's default chart
- - ``old_chart`` -- (default: ``None``) chart from which the coordinates in
- ``chart`` are to be computed. If ``None``, a chart in which the point's
- coordinates are already known will be picked, priveleging the
+ - ``old_chart`` -- (default: ``None``) chart from which the coordinates
+ in ``chart`` are to be computed. If ``None``, a chart in which the
+ point's coordinates are already known will be picked, privileging the
subset's default chart.
EXAMPLES:
@@ -332,7 +332,8 @@ class TopManifoldPoint(Element):
Computing the Cartesian coordinates from the spherical ones::
sage: c_cart.<x,y,z> = M.chart() # Cartesian coordinates
- sage: c_spher.transition_map(c_cart, [r*sin(th)*cos(ph), r*sin(th)*sin(ph), r*cos(th)])
+ sage: c_spher.transition_map(c_cart, [r*sin(th)*cos(ph),
+ ....: r*sin(th)*sin(ph), r*cos(th)])
Change of coordinates from Chart (M, (r, th, ph)) to Chart (M, (x, y, z))
sage: p.coord(c_cart) # the computation is performed by means of the above change of coordinates
(-1, 0, 0)
@@ -373,7 +374,8 @@ class TopManifoldPoint(Element):
(a^3 - 3*a^2*b + 3*a*b^2 - b^3, a^3 + 3*a^2*b + 3*a*b^2 + b^3)
sage: p._coordinates # random (dictionary output)
{Chart (M, (u, v)): (a - b, a + b),
- Chart (M, (w, z)): (a^3 - 3*a^2*b + 3*a*b^2 - b^3, a^3 + 3*a^2*b + 3*a*b^2 + b^3)}
+ Chart (M, (w, z)): (a^3 - 3*a^2*b + 3*a*b^2 - b^3,
+ a^3 + 3*a^2*b + 3*a*b^2 + b^3)}
"""
if chart is None:
@@ -384,8 +386,8 @@ class TopManifoldPoint(Element):
dom = chart._domain
def_chart = dom._def_chart
if self not in dom:
- raise ValueError("The point does not belong to the domain " +
- "of " + str(chart))
+ raise ValueError("the point does not belong to the domain " +
+ "of {}".format(chart))
if chart not in self._coordinates:
# Check whether chart corresponds to a superchart of a chart
# in which the coordinates are known:
@@ -432,9 +434,9 @@ class TopManifoldPoint(Element):
if old_chart is not None:
break
if old_chart is None:
- raise ValueError("The coordinates of " + str(self) + \
- " in the " + str(chart) + " cannot be computed" + \
- " by means of known changes of charts.")
+ raise ValueError("the coordinates of {}".format(self) +
+ " in the {}".format(chart) + " cannot be computed " +
+ "by means of known changes of charts.")
else:
chcoord = dom._coord_changes[(s_old_chart, s_chart)]
self._coordinates[chart] = \
@@ -504,7 +506,7 @@ class TopManifoldPoint(Element):
.. WARNING::
If the point has already coordinates in other charts, it
- is the user's responsability to make sure that the coordinates
+ is the user's responsibility to make sure that the coordinates
to be added are consistent with them.
EXAMPLES:
@@ -541,14 +543,14 @@ class TopManifoldPoint(Element):
"""
if len(coords) != self._manifold._dim:
- raise ValueError("The number of coordinates must be equal " +
- "to the manifold dimension.")
+ raise ValueError("the number of coordinates must be equal to " +
+ "the manifold's dimension.")
if chart is None:
chart = self._subset._def_chart
else:
if chart not in self._subset._atlas:
- raise ValueError("The " + str(chart) +
- " has not been defined on the " + str(self._subset))
+ raise ValueError("the {}".format(chart) + " has not been " +
+ "defined on the {}".format(self._subset))
self._coordinates[chart] = coords
def __eq__(self, other):
@@ -631,8 +633,8 @@ class TopManifoldPoint(Element):
if common_chart is None:
return False
#!# Another option would be:
- # raise ValueError("No common chart has been found to compare " +
- # str(self) + " and " + str(other))
+ # raise ValueError("no common chart has been found to compare " +
+ # "{} and {}".format(self, other))
return self._coordinates[common_chart] == \
other._coordinates[common_chart]
diff --git a/src/sage/manifolds/scalarfield.py b/src/sage/manifolds/scalarfield.py
index d589a5c..8ebd39a 100644
--- a/src/sage/manifolds/scalarfield.py
+++ b/src/sage/manifolds/scalarfield.py
@@ -1,14 +1,13 @@
r"""
Scalar fields
-Given a topological manifold `M` over a topological field `K`, a *scalar field*
-on `M` is a continuous map
+Given a topological manifold `M` over a topological field `K` (in most
+applications, `K = \RR` or `K = \CC`), a *scalar field* on `M` is a continuous
+map
.. MATH::
- f: U\subset M \longrightarrow K
-
-where `U` is an open subset of `M`.
+ f: M \longrightarrow K
Scalar fields are implemented by the class :class:`ScalarField`.
@@ -18,11 +17,10 @@ AUTHORS:
REFERENCES:
+- J.M. Lee : *Introduction to Topological Manifolds*, 2nd ed., Springer (New
+ York) (2011)
- S. Kobayashi & K. Nomizu : *Foundations of Differential Geometry*, vol. 1,
Interscience Publishers (New York) (1963)
-- J.M. Lee : *Introduction to Smooth Manifolds*, 2nd ed., Springer (New York)
- (2013)
-- B O'Neill : *Semi-Riemannian Geometry*, Academic Press (San Diego) (1983)
"""
@@ -45,21 +43,21 @@ class ScalarField(CommutativeAlgebraElement):
r"""
Scalar field on a topological manifold.
- Given a topological manifold `M` over a topological field `K`
- and an open subset `U` of `M`, a *scalar field* defined on `U` is a
+ Given a topological manifold `M` over a topological field `K` (in most
+ applications, `K = \RR` or `K = \CC`), a *scalar field on* `M` is a
continuous map
.. MATH::
- f: U\subset M \longrightarrow K .
+ f: M \longrightarrow K .
The class :class:`ScalarField` inherits from the class :class:`~sage.structure.element.CommutativeAlgebraElement`, a scalar field
- on `U` being an element of the commutative algebra `C^0(U)` (see
+ on `M` being an element of the commutative algebra `C^0(M)` (see
:class:`~sage.manifolds.scalarfield_algebra.ScalarFieldAlgebra`).
INPUT:
- - ``domain`` -- the manifold open subset `U` on which the scalar field is
+ - ``domain`` -- the topological manifold `M` on which the scalar field is
defined (must be an instance of class
:class:`~sage.manifolds.manifold.TopManifold`)
- ``coord_expression`` -- (default: ``None``) coordinate expression(s) of
@@ -113,18 +111,21 @@ class ScalarField(CommutativeAlgebraElement):
can be passed instead of the dictionary over the charts::
sage: g = U.scalar_field(x*y, chart=c_xy, name='g') ; g
- Scalar field g on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field g on the Open subset U of the 2-dimensional topological
+ manifold M
The above is indeed equivalent to::
sage: g = U.scalar_field({c_xy: x*y}, name='g') ; g
- Scalar field g on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field g on the Open subset U of the 2-dimensional topological
+ manifold M
Since ``c_xy`` is the default chart of ``U``, the argument ``chart`` can
be skipped::
sage: g = U.scalar_field(x*y, name='g') ; g
- Scalar field g on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field g on the Open subset U of the 2-dimensional topological
+ manifold M
The scalar field `g` is defined on `U` and has an expression in terms of
the coordinates `(u,v)` on `W=U\cap V`::
@@ -176,7 +177,8 @@ class ScalarField(CommutativeAlgebraElement):
coordinates::
sage: h = U.scalar_field(function('H', x, y), name='h') ; h
- Scalar field h on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field h on the Open subset U of the 2-dimensional topological
+ manifold M
sage: h.display()
h: U --> R
(x, y) |--> H(x, y)
@@ -339,7 +341,8 @@ class ScalarField(CommutativeAlgebraElement):
sage: f.parent() is M.scalar_field_algebra()
True
sage: g.parent()
- Algebra of scalar fields on the Open subset U of the 2-dimensional topological manifold M
+ Algebra of scalar fields on the Open subset U of the 2-dimensional
+ topological manifold M
sage: g.parent() is U.scalar_field_algebra()
True
@@ -416,13 +419,15 @@ class ScalarField(CommutativeAlgebraElement):
sage: g.domain()
Open subset U of the 2-dimensional topological manifold M
sage: s = f + g ; s
- Scalar field on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field on the Open subset U of the 2-dimensional topological
+ manifold M
sage: s.domain()
Open subset U of the 2-dimensional topological manifold M
sage: s.display()
U --> R
(x, y) |--> (x*y^3 + (x^3 + x)*y + 1)/(x^2 + y^2 + 1)
- on W: (u, v) |--> (u^6 + 3*u^4*v^2 + 3*u^2*v^4 + v^6 + u*v^3 + (u^3 + u)*v)/(u^6 + v^6 + (3*u^2 + 1)*v^4 + u^4 + (3*u^4 + 2*u^2)*v^2)
+ on W: (u, v) |--> (u^6 + 3*u^4*v^2 + 3*u^2*v^4 + v^6 + u*v^3
+ + (u^3 + u)*v)/(u^6 + v^6 + (3*u^2 + 1)*v^4 + u^4 + (3*u^4 + 2*u^2)*v^2)
The operation actually performed is `f|_U + g`::
@@ -496,9 +501,11 @@ class ScalarField(CommutativeAlgebraElement):
sage: s.display()
f*f: M --> R
on U: (x, y) |--> 1/(x^4 + y^4 + 2*(x^2 + 1)*y^2 + 2*x^2 + 1)
- on V: (u, v) |--> (u^4 + 2*u^2*v^2 + v^4)/(u^4 + v^4 + 2*(u^2 + 1)*v^2 + 2*u^2 + 1)
+ on V: (u, v) |--> (u^4 + 2*u^2*v^2 + v^4)/(u^4 + v^4 + 2*(u^2 + 1)*v^2
+ + 2*u^2 + 1)
sage: s = g*h ; s
- Scalar field g*h on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field g*h on the Open subset U of the 2-dimensional topological
+ manifold M
sage: s.display()
g*h: U --> R
(x, y) |--> x*y*H(x, y)
@@ -513,7 +520,8 @@ class ScalarField(CommutativeAlgebraElement):
(2-dimensional topological manifold M,
Open subset U of the 2-dimensional topological manifold M)
sage: s = f*g ; s
- Scalar field on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field on the Open subset U of the 2-dimensional topological
+ manifold M
sage: s.display()
U --> R
(x, y) |--> x*y/(x^2 + y^2 + 1)
@@ -530,13 +538,15 @@ class ScalarField(CommutativeAlgebraElement):
on U: (x, y) |--> 1/(a*x^2 + a*y^2 + a)
on V: (u, v) |--> (u^2 + v^2)/(a*u^2 + a*v^2 + a)
sage: s = g/h ; s
- Scalar field g/h on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field g/h on the Open subset U of the 2-dimensional topological
+ manifold M
sage: s.display()
g/h: U --> R
(x, y) |--> x*y/H(x, y)
on W: (u, v) |--> u*v/((u^4 + 2*u^2*v^2 + v^4)*H(u/(u^2 + v^2), v/(u^2 + v^2)))
sage: s = f/g ; s
- Scalar field on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field on the Open subset U of the 2-dimensional topological
+ manifold M
sage: s.display()
U --> R
(x, y) |--> 1/(x*y^3 + (x^3 + x)*y)
@@ -548,7 +558,8 @@ class ScalarField(CommutativeAlgebraElement):
arithmetics with symbolic expressions involving the chart coordinates::
sage: s = g + x^2 - y ; s
- Scalar field on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field on the Open subset U of the 2-dimensional topological
+ manifold M
sage: s.display()
U --> R
(x, y) |--> x^2 + (x - 1)*y
@@ -557,7 +568,8 @@ class ScalarField(CommutativeAlgebraElement):
::
sage: s = g*x ; s
- Scalar field on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field on the Open subset U of the 2-dimensional topological
+ manifold M
sage: s.display()
U --> R
(x, y) |--> x^2*y
@@ -566,13 +578,15 @@ class ScalarField(CommutativeAlgebraElement):
::
sage: s = g/x ; s
- Scalar field on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field on the Open subset U of the 2-dimensional topological
+ manifold M
sage: s.display()
U --> R
(x, y) |--> y
on W: (u, v) |--> v/(u^2 + v^2)
sage: s = x/g ; s
- Scalar field on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field on the Open subset U of the 2-dimensional topological
+ manifold M
sage: s.display()
U --> R
(x, y) |--> 1/y
@@ -599,14 +613,14 @@ class ScalarField(CommutativeAlgebraElement):
sage: isinstance(f, ScalarField)
True
sage: f.parent()
- Algebra of scalar fields on the 2-dimensional topological manifold M
+ Algebra of scalar fields on the 2-dimensional topological
+ manifold M
sage: TestSuite(f).run()
"""
CommutativeAlgebraElement.__init__(self, domain.scalar_field_algebra())
self._manifold = domain._manifold
self._domain = domain
- self._tensor_type = (0,0)
self._is_zero = False # a priori, may be changed below or via
# method __nonzero__()
self._name = name
@@ -810,9 +824,12 @@ class ScalarField(CommutativeAlgebraElement):
sage: f = M.scalar_field({X: x+y})
sage: U = M.open_subset('U', coord_def={X: x>0})
sage: f.restrict(U)
- Scalar field on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field on the Open subset U of the 2-dimensional topological
+ manifold M
sage: f._restrictions
- {Open subset U of the 2-dimensional topological manifold M: Scalar field on the Open subset U of the 2-dimensional topological manifold M}
+ {Open subset U of the 2-dimensional topological manifold M:
+ Scalar field on the Open subset U of the 2-dimensional topological
+ manifold M}
sage: f._del_derived()
sage: f._restrictions # restrictions are derived quantities
{}
@@ -822,7 +839,7 @@ class ScalarField(CommutativeAlgebraElement):
def _repr_(self):
r"""
- String representation of ``self``.
+ String representation of the object.
TESTS::
@@ -846,7 +863,7 @@ class ScalarField(CommutativeAlgebraElement):
def _latex_(self):
r"""
- LaTeX representation of ``self``.
+ LaTeX representation of the object.
TESTS::
@@ -872,7 +889,7 @@ class ScalarField(CommutativeAlgebraElement):
def set_name(self, name=None, latex_name=None):
r"""
- Set (or change) the text name and LaTeX name of ``self``.
+ Set (or change) the text name and LaTeX name of the scalar field.
INPUT:
@@ -931,25 +948,9 @@ class ScalarField(CommutativeAlgebraElement):
"""
return self._domain
- def tensor_type(self):
- r"""
- Return the tensor type of ``self``, i.e. (0,0), when ``self`` is
- considered as a tensor field on the manifold.
-
- EXAMPLE::
-
- sage: M = TopManifold(2, 'M')
- sage: c_xy.<x,y> = M.chart()
- sage: f = M.scalar_field(x+2*y)
- sage: f.tensor_type()
- (0, 0)
-
- """
- return self._tensor_type
-
def copy(self):
r"""
- Return an exact copy of ``self``.
+ Return an exact copy of the scalar field.
EXAMPLES:
@@ -985,10 +986,11 @@ class ScalarField(CommutativeAlgebraElement):
- ``chart`` -- (default: ``None``) chart with respect to which the
coordinate expression is to be returned; if ``None``, the
- default chart of the domain of ``self`` will be