summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-14 16:11:37 +0200
committerEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-14 16:11:37 +0200
commit2f231b66a3245337301370a33be8d56c76013cdb (patch)
tree06945bf58609662f3646bede352260db31bec5ee
parentImprovement in simplify_sqrt_real(); minor modif. in documentation (diff)
Major improvements in the documentation of diff. manifolds (basic part)
-rw-r--r--src/doc/en/reference/manifolds/chart.rst11
-rw-r--r--src/doc/en/reference/manifolds/continuous_map.rst9
-rw-r--r--src/doc/en/reference/manifolds/diff_manifold.rst9
-rw-r--r--src/doc/en/reference/manifolds/diff_map.rst9
-rw-r--r--src/doc/en/reference/manifolds/diff_scalarfield.rst9
-rw-r--r--src/doc/en/reference/manifolds/index.rst4
-rw-r--r--src/doc/en/reference/manifolds/manifold.rst15
-rw-r--r--src/doc/en/reference/manifolds/scalarfield.rst9
-rw-r--r--src/sage/manifolds/all.py3
-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/differentiable/chart.py6
-rw-r--r--src/sage/manifolds/differentiable/diff_map.py86
-rw-r--r--src/sage/manifolds/differentiable/manifold.py123
-rw-r--r--src/sage/manifolds/differentiable/manifold_homset.py18
-rw-r--r--src/sage/manifolds/differentiable/scalarfield.py74
-rw-r--r--src/sage/manifolds/differentiable/scalarfield_algebra.py82
-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.py50
26 files changed, 981 insertions, 642 deletions
diff --git a/src/doc/en/reference/manifolds/chart.rst b/src/doc/en/reference/manifolds/chart.rst
new file mode 100644
index 0000000..352828f
--- /dev/null
+++ b/src/doc/en/reference/manifolds/chart.rst
@@ -0,0 +1,11 @@
+Coordinate charts
+=================
+
+.. toctree::
+ :maxdepth: 2
+
+ sage/manifolds/chart
+
+ sage/manifolds/coord_func
+
+ sage/manifolds/coord_func_symb
diff --git a/src/doc/en/reference/manifolds/continuous_map.rst b/src/doc/en/reference/manifolds/continuous_map.rst
new file mode 100644
index 0000000..4b67487
--- /dev/null
+++ b/src/doc/en/reference/manifolds/continuous_map.rst
@@ -0,0 +1,9 @@
+Continuous maps
+===============
+
+.. toctree::
+ :maxdepth: 2
+
+ sage/manifolds/manifold_homset
+
+ sage/manifolds/continuous_map
diff --git a/src/doc/en/reference/manifolds/diff_manifold.rst b/src/doc/en/reference/manifolds/diff_manifold.rst
index 1dc6059..a49fda2 100644
--- a/src/doc/en/reference/manifolds/diff_manifold.rst
+++ b/src/doc/en/reference/manifolds/diff_manifold.rst
@@ -8,11 +8,6 @@ Differentiable manifolds
sage/manifolds/differentiable/chart
- sage/manifolds/differentiable/scalarfield_algebra
-
- sage/manifolds/differentiable/scalarfield
-
- sage/manifolds/differentiable/manifold_homset
-
- sage/manifolds/differentiable/diff_map
+ diff_scalarfield
+ diff_map
diff --git a/src/doc/en/reference/manifolds/diff_map.rst b/src/doc/en/reference/manifolds/diff_map.rst
new file mode 100644
index 0000000..51162b4
--- /dev/null
+++ b/src/doc/en/reference/manifolds/diff_map.rst
@@ -0,0 +1,9 @@
+Differentiable maps
+===================
+
+.. toctree::
+ :maxdepth: 2
+
+ sage/manifolds/differentiable/manifold_homset
+
+ sage/manifolds/differentiable/diff_map
diff --git a/src/doc/en/reference/manifolds/diff_scalarfield.rst b/src/doc/en/reference/manifolds/diff_scalarfield.rst
new file mode 100644
index 0000000..2991cd9
--- /dev/null
+++ b/src/doc/en/reference/manifolds/diff_scalarfield.rst
@@ -0,0 +1,9 @@
+Scalar fields
+=============
+
+.. toctree::
+ :maxdepth: 2
+
+ sage/manifolds/differentiable/scalarfield_algebra
+
+ sage/manifolds/differentiable/scalarfield
diff --git a/src/doc/en/reference/manifolds/index.rst b/src/doc/en/reference/manifolds/index.rst
index eac1337..dd546af 100644
--- a/src/doc/en/reference/manifolds/index.rst
+++ b/src/doc/en/reference/manifolds/index.rst
@@ -11,7 +11,7 @@ More documentation (in particular example worksheets) can be found
`here <http://sagemanifolds.obspm.fr/documentation.html>`_.
.. toctree::
- :maxdepth: 2
+ :maxdepth: 3
manifold
@@ -20,5 +20,3 @@ More documentation (in particular example worksheets) can be found
sage/manifolds/utilities
.. include:: ../footer.txt
-
-
diff --git a/src/doc/en/reference/manifolds/manifold.rst b/src/doc/en/reference/manifolds/manifold.rst
index 4a3d76c..0466d72 100644
--- a/src/doc/en/reference/manifolds/manifold.rst
+++ b/src/doc/en/reference/manifolds/manifold.rst
@@ -10,17 +10,8 @@ Topological manifolds
sage/manifolds/subset
- sage/manifolds/chart
+ chart
- sage/manifolds/coord_func
-
- sage/manifolds/coord_func_symb
-
- sage/manifolds/scalarfield_algebra
-
- sage/manifolds/scalarfield
-
- sage/manifolds/manifold_homset
-
- sage/manifolds/continuous_map
+ scalarfield
+ continuous_map
diff --git a/src/doc/en/reference/manifolds/scalarfield.rst b/src/doc/en/reference/manifolds/scalarfield.rst
new file mode 100644
index 0000000..99989a0
--- /dev/null
+++ b/src/doc/en/reference/manifolds/scalarfield.rst
@@ -0,0 +1,9 @@
+Scalar fields
+=============
+
+.. toctree::
+ :maxdepth: 2
+
+ sage/manifolds/scalarfield_algebra
+
+ sage/manifolds/scalarfield
diff --git a/src/sage/manifolds/all.py b/src/sage/manifolds/all.py
index 9724ef2..9918902 100644
--- a/src/sage/manifolds/all.py
+++ b/src/sage/manifolds/all.py
@@ -1,3 +1,4 @@
from manifold import TopManifold
from differentiable.manifold import DiffManifold
-from utilities import nice_derivatives, omit_function_args
+from utilities import nice_derivatives, omit_function_args, set_axes_labels
+from utilities import Manifold # deprecated
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/differentiable/chart.py b/src/sage/manifolds/differentiable/chart.py
index 09bd5a7..baf466f 100644
--- a/src/sage/manifolds/differentiable/chart.py
+++ b/src/sage/manifolds/differentiable/chart.py
@@ -69,7 +69,7 @@ class DiffChart(Chart):
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:
@@ -421,7 +421,7 @@ class RealDiffChart(DiffChart, RealChart):
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:
@@ -626,7 +626,7 @@ class RealDiffChart(DiffChart, RealChart):
"""
RealChart.__init__(self, domain, coordinates=coordinates, names=names)
- #!# vector frame shall be initialized here
+ #!# vector frame shall be initialized here in ticket #18843
#*****************************************************************************
diff --git a/src/sage/manifolds/differentiable/diff_map.py b/src/sage/manifolds/differentiable/diff_map.py
index 87359aa..324756f 100644
--- a/src/sage/manifolds/differentiable/diff_map.py
+++ b/src/sage/manifolds/differentiable/diff_map.py
@@ -1,14 +1,13 @@
r"""
Differentiable maps between differentiable manifolds
-The class :class:`DiffMap` implements differentiable maps from an open
-subset `U` of a differentiable manifold `M` to some differentiable
-manifold `N` over the same topological field `K` as `M` (in most
-applications, `K = \RR` or `K = \CC`):
+The class :class:`DiffMap` implements differentiable maps from a differentiable
+manifold `M` to a differentiable manifold `N` over the same topological field
+`K` as `M` (in most applications, `K = \RR` or `K = \CC`):
.. MATH::
- \Phi: U\subset M \longrightarrow N
+ \Phi: M \longrightarrow N
AUTHORS:
@@ -17,10 +16,10 @@ AUTHORS:
REFERENCES:
-.. [1] Chap. 1 of S. Kobayashi & K. Nomizu : *Foundations of Differential Geometry*,
- vol. 1, Interscience Publishers (New York) (1963)
-.. [2] Chaps. 2 and 3 of J.M. Lee : *Introduction to Smooth Manifolds*, 2nd ed.,
- Springer (New York) (2013)
+.. [1] Chap. 1 of S. Kobayashi & K. Nomizu : *Foundations of Differential
+ Geometry*, vol. 1, Interscience Publishers (New York) (1963)
+.. [2] Chaps. 2 and 3 of J.M. Lee : *Introduction to Smooth Manifolds*,
+ 2nd ed., Springer (New York) (2013)
"""
@@ -44,16 +43,15 @@ class DiffMap(ContinuousMap):
.. MATH::
- \Phi: U\subset M \longrightarrow V\subset N
+ \Phi: M \longrightarrow N
where `M` and `N` are differentiable manifolds over the same topological
- field `K` (in most applications, `K = \RR` or `K = \CC`), `U` is an open
- subset of `M` and `V` is an open subset of `N`.
+ field `K` (in most applications, `K = \RR` or `K = \CC`).
Differentiable maps are the *morphisms* of the *category* of
- differentiable manifolds. The set of all differentiable maps from
- `U` to `V` is therefore the homset between `U` and `V` and is denoted
- by `\mathrm{Hom}(U,V)`.
+ differentiable manifolds. The set of all differentiable maps from `M` to
+ `N` is therefore the homset between `M` and `N`, which is denoted by
+ `\mathrm{Hom}(M,N)`.
The class :class:`DiffMap` is a Sage *element* class, whose *parent*
class is
@@ -64,13 +62,13 @@ class DiffMap(ContinuousMap):
INPUT:
- - ``parent`` -- homset `\mathrm{Hom}(U,V)` to which the differentiable
+ - ``parent`` -- homset `\mathrm{Hom}(M,N)` to which the differentiable
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 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 differentiable map
@@ -82,7 +80,7 @@ class DiffMap(ContinuousMap):
``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::
@@ -102,19 +100,19 @@ class DiffMap(ContinuousMap):
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 = DiffManifold(3, 'R^3', r'\RR^3') # R^3
sage: c_cart.<X,Y,Z> = N.chart() # Cartesian coordinates on R^3
- sage: Phi = M.diff_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.diff_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
- Differentiable map Phi from the 2-dimensional differentiable manifold S^2 to
- the 3-dimensional differentiable manifold R^3
+ Differentiable map Phi from the 2-dimensional differentiable manifold
+ S^2 to the 3-dimensional differentiable manifold R^3
sage: Phi.parent()
Set of Morphisms from 2-dimensional differentiable manifold S^2 to
3-dimensional differentiable manifold R^3 in Category of sets
@@ -124,8 +122,10 @@ class DiffMap(ContinuousMap):
<class 'sage.manifolds.differentiable.diff_map.DiffManifoldHomset_with_category.element_class'>
sage: Phi.display()
Phi: S^2 --> R^3
- 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))
+ 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))
It is possible to create the map via the method
:meth:`~sage.manifolds.differentiable.manifold.DiffManifold.diff_map`
@@ -134,13 +134,17 @@ class DiffMap(ContinuousMap):
arguments ``chart1`` and ``chart2`` have to be provided if the charts
differ from the default ones on the domain and/or the codomain::
- sage: Phi1 = M.diff_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')
+ sage: Phi1 = M.diff_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.diff_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)],
+ sage: Phi1 = M.diff_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')
With such a declaration, the differentiable map is only partially defined
@@ -163,7 +167,7 @@ class DiffMap(ContinuousMap):
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
@@ -175,12 +179,12 @@ class DiffMap(ContinuousMap):
The map acts on points::
- sage: np = M.point((0,0), chart=c_uv) # the North pole
+ sage: np = M.point((0,0), chart=c_uv, name='N') # the North pole
sage: Phi(np)
- Point on the 3-dimensional differentiable manifold R^3
+ Point Phi(N) on the 3-dimensional differentiable manifold R^3
sage: Phi(np).coord() # Cartesian coordinates
(0, 0, 1)
- sage: sp = M.point((0,0), chart=c_xy) # the South pole
+ sage: sp = M.point((0,0), chart=c_xy, name='S') # the South pole
sage: Phi(sp).coord() # Cartesian coordinates
(0, 0, -1)
@@ -192,7 +196,7 @@ class DiffMap(ContinuousMap):
sage: P = DiffManifold(2, 'R^2', r'\RR^2') # R^2 (equatorial plane)
sage: cP.<xP, yP> = P.chart()
sage: Psi = N.diff_map(P, (X/(1-Z), Y/(1-Z)), name='Psi',
- ....: latex_name=r'\Psi')
+ ....: latex_name=r'\Psi')
sage: Psi
Differentiable map Psi from the 3-dimensional differentiable manifold
R^3 to the 2-dimensional differentiable manifold R^2
@@ -227,7 +231,7 @@ class DiffMap(ContinuousMap):
sage: N = DiffManifold(1, 'N')
sage: c_N = N.chart('X')
- sage: Phi = M.diff_map(N, {(c_xy, c_N): x^2+y^2, \
+ sage: Phi = M.diff_map(N, {(c_xy, c_N): x^2+y^2,
....: (c_uv, c_N): 1/(u^2+v^2)}) # not ...[1/(u^2+v^2)] or (1/(u^2+v^2),)
An example of differentiable map `\RR \rightarrow \RR^2`::
@@ -345,8 +349,8 @@ class DiffMap(ContinuousMap):
True
"""
- def __init__(self, parent, coord_functions=None, name=None, latex_name=None,
- is_isomorphism=False, is_identity=False):
+ def __init__(self, parent, coord_functions=None, name=None,
+ latex_name=None, is_isomorphism=False, is_identity=False):
r"""
Construct a differentiable map.
diff --git a/src/sage/manifolds/differentiable/manifold.py b/src/sage/manifolds/differentiable/manifold.py
index 0abf4d6..2653b0a 100644
--- a/src/sage/manifolds/differentiable/manifold.py
+++ b/src/sage/manifolds/differentiable/manifold.py
@@ -85,9 +85,9 @@ and `V`::
sage: M.declare_union(U,V)
and we provide the transition map between the charts ``stereoN`` = `(U, (x, y))`
-and ``stereoS`` = `(V, (u, v))`, denoting by W the intersection of U and V
-(W is the subset of U defined by `x^2+y^2\not=0`, as well as the subset of V
-defined by`u^2+v^2\not=0`)::
+and ``stereoS`` = `(V, (u, v))`, denoting by `W` the intersection of `U` and
+`V` (`W` is the subset of `U` defined by `x^2+y^2\not=0`, as well as the subset
+of `V` defined by `u^2+v^2\not=0`)::
sage: stereoN_to_S = stereoN.transition_map(stereoS,
....: [x/(x^2+y^2), y/(x^2+y^2)], intersection_name='W',
@@ -123,7 +123,6 @@ At this stage, we have four open subsets on `S^2`::
sage: N in W or S in W
False
-
The North pole lies in `V` and the South pole in `U`::
sage: N in V, N in U
@@ -185,6 +184,7 @@ A differentiable scalar field on the sphere::
sage: f.parent().category()
Category of commutative algebras over Symbolic Ring
+
.. RUBRIC:: Example 2: the Riemann sphere as a differentiable manifold of
dimension 1 over `\CC`
@@ -289,6 +289,8 @@ REFERENCES:
.. [5] W. Bertram : *Differential Geometry, Lie Groups and Symmetric Spaces
over General Base Fields and Rings*, Memoirs of the American Mathematical
Society, vol. 192 (2008); :doi:`10.1090/memo/0900`; :arxiv:`math/0502168`
+.. [6] M. Berger & B. Gostiaux : *Differential Geometry: Manifolds, Curves and
+ Surfaces*, Springer (New York) (1988); :doi:`10.1007/978-1-4612-1033-7`
"""
@@ -307,10 +309,11 @@ from sage.categories.sets_cat import Sets
#*# After #18175:
# from sage.categories.manifolds import Manifolds
from sage.categories.homset import Hom
-from sage.rings.infinity import infinity
+from sage.rings.infinity import infinity, minus_infinity
from sage.misc.latex import latex
from sage.manifolds.manifold import TopManifold
-from sage.manifolds.differentiable.scalarfield_algebra import DiffScalarFieldAlgebra
+from sage.manifolds.differentiable.scalarfield_algebra import \
+ DiffScalarFieldAlgebra
class DiffManifold(TopManifold):
r"""
@@ -351,7 +354,7 @@ class DiffManifold(TopManifold):
- ``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()`` (``DiffManifolds()`` after :trac:`18175` is
implemented)
- ``ambient_manifold`` -- (default: ``None``) ``None`` or a differentiable
@@ -487,7 +490,7 @@ class DiffManifold(TopManifold):
ambient_manifold = self
elif not isinstance(ambient_manifold, DiffManifold):
raise TypeError("the argument 'ambient_manifold' must be " +
- " a differentiable manifold")
+ "a differentiable manifold")
TopManifold.__init__(self, n, name, latex_name=latex_name, field=field,
start_index=start_index, category=category,
ambient_manifold=ambient_manifold)
@@ -547,8 +550,9 @@ class DiffManifold(TopManifold):
r"""
Return the manifold's degree of differentiability.
- The degree of differentiablity is the integer `k` (possibly `k=\infty`)
- such that the manifold is a `C^k`-manifold over its base field.
+ The degree of differentiability is the integer `k` (possibly
+ `k=\infty`) such that the manifold is a `C^k`-manifold over its base
+ field.
EXAMPLES::
@@ -649,16 +653,31 @@ class DiffManifold(TopManifold):
field=self._field, diff_degree=self._diff_degree,
start_index=self._sindex, category=self.category(),
ambient_manifold=self._manifold)
+ #!# NB: the above could have been
+ # resu = type(self).__base__(...) instead of resu = DiffManifold(...)
+ # 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)
- #!# update tensor spaces
+ # 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)
+ #!# update vector frames and change of frames
return resu
def chart(self, coordinates='', names=None):
@@ -710,7 +729,7 @@ class DiffManifold(TopManifold):
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:
@@ -965,6 +984,31 @@ class DiffManifold(TopManifold):
coord_functions = {(chart1, chart2): coord_functions}
return homset(coord_functions, name=name, latex_name=latex_name)
+ def diff_mapping(self, codomain, coord_functions=None, chart1=None,
+ chart2=None, name=None, latex_name=None):
+ r"""
+ Deprecated.
+
+ Use :meth:`diff_map` instead.
+
+ EXAMPLE::
+
+ sage: M = DiffManifold(2, 'M'); X.<x,y> = M.chart()
+ sage: N = DiffManifold(2, 'M'); Y.<u,v> = N.chart()
+ sage: Phi = M.diff_mapping(N, {(X,Y): [x+y, x-y]}, name='Phi')
+ doctest:...: DeprecationWarning: Use diff_map() instead.
+ See http://trac.sagemath.org/18783 for details.
+ sage: Phi
+ Differentiable map Phi from the 2-dimensional differentiable
+ manifold M to itself
+
+ """
+ from sage.misc.superseded import deprecation
+ deprecation(18783, 'Use diff_map() instead.')
+ return self.diff_map(codomain, coord_functions=coord_functions,
+ chart1=chart1, chart2=chart2, name=name,
+ latex_name=latex_name)
+
def diffeomorphism(self, codomain, coord_functions=None, chart1=None,
chart2=None, name=None, latex_name=None):
r"""
@@ -1016,6 +1060,7 @@ class DiffManifold(TopManifold):
sage: DiffManifold._clear_cache_() # for doctests only
sage: M = DiffManifold(2, 'M') # the open unit disk
+ sage: forget() # for doctests only
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)
sage: N = DiffManifold(2, 'N') # R^2
@@ -1061,53 +1106,3 @@ class DiffManifold(TopManifold):
coord_functions = {(chart1, chart2): coord_functions}
return homset(coord_functions, name=name, latex_name=latex_name,
is_isomorphism=True)
-
- def identity_map(self):
- r"""
- Identity map of the manifold.
-
- The identity map of a differentiable manifold `M` is the trivial
- diffeomorphism
-
- .. MATH::
-
- \begin{array}{cccc}
- \mathrm{Id}_M: & M & \longrightarrow & M \\
- & p & \longmapsto & p
- \end{array}
-
- See :class:`~sage.manifolds.differentiable.diff_map.DiffMap` for a
- complete documentation.
-
- OUTPUT:
-
- - the identity map, as an instance of
- :class:`~sage.manifolds.differentiable.diff_map.DiffMap`
-
- EXAMPLE:
-
- Identity map of a complex manifold::
-
- sage: M = DiffManifold(2, 'M', field='complex')
- sage: X.<x,y> = M.chart()
- sage: id = M.identity_map(); id
- Identity map Id_M of the 2-dimensional complex manifold M
- sage: id.parent()
- Set of Morphisms from 2-dimensional complex manifold M to
- 2-dimensional complex manifold M in Category of sets
- sage: id.display()
- Id_M: M --> M
- (x, y) |--> (x, y)
-
- The identity map acting on a point::
-
- sage: p = M((1+I, 3-I), name='p'); p
- Point p on the 2-dimensional complex manifold M
- sage: id(p)
- Point p on the 2-dimensional complex manifold M
- sage: id(p) == p
- True
-
- """
- return self._identity_map
-
diff --git a/src/sage/manifolds/differentiable/manifold_homset.py b/src/sage/manifolds/differentiable/manifold_homset.py
index 70305d6..f914e16 100644
--- a/src/sage/manifolds/differentiable/manifold_homset.py
+++ b/src/sage/manifolds/differentiable/manifold_homset.py
@@ -14,8 +14,8 @@ REFERENCES:
.. [1] J.M. Lee : *Introduction to Smooth Manifolds*, 2nd ed., Springer
(New York) (2013)
-.. [2] S. Kobayashi & K. Nomizu : *Foundations of Differential Geometry*, vol. 1,
- Interscience Publishers (New York) (1963)
+.. [2] S. Kobayashi & K. Nomizu : *Foundations of Differential Geometry*,
+ vol. 1, Interscience Publishers (New York) (1963)
"""
#******************************************************************************
@@ -36,26 +36,24 @@ class DiffManifoldHomset(TopManifoldHomset):
Given two differentiable manifolds `M` and `N` over a topological field `K`,
the class :class:`DiffManifoldHomset` implements the set
- `\mathrm{Hom}(U,V)` of morphisms (i.e. differentiable 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 differentiable manifolds, `U`
- and `V` are differentiable manifolds by themselves.
+ `\mathrm{Hom}(M,N)` of morphisms (i.e. differentiable maps)
+ `M\rightarrow N`.
This is a Sage *parent* class, whose *element* class is
:class:`~sage.manifolds.differentiable.diff_map.DiffMap`.
INPUT:
- - ``domain`` -- open subset `U\subset M` (domain of the morphisms),
+ - ``domain`` -- differentiable manifold `M` (domain of the morphisms),
as an instance of
:class:`~sage.manifolds.differentiable.manifold.DiffManifold`
- - ``codomain`` -- open subset `V\subset N` (codomain of the morphisms),
+ - ``codomain`` -- differentiable manifold `N` (codomain of the morphisms),
as an instance of
:class:`~sage.manifolds.differentiable.manifold.DiffManifold`
- ``name`` -- (default: ``None``) string; name given to the homset; if
- none is provided, Hom(U,V) will be used
+ none is provided, 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 is provided, `\mathrm{Hom}(M,N)` will be used
EXAMPLES:
diff --git a/src/sage/manifolds/differentiable/scalarfield.py b/src/sage/manifolds/differentiable/scalarfield.py
index bf70613..9aaa0a1 100644
--- a/src/sage/manifolds/differentiable/scalarfield.py
+++ b/src/sage/manifolds/differentiable/scalarfield.py
@@ -3,13 +3,13 @@ Differentiable scalar fields
Given a differentiable manifold `M` of class `C^k` over a topological field `K`
(in most applications, `K = \RR` or `K = \CC`), a *differentiable scalar field*
-on `M` is a map of class `C^k`
+on `M` is a map
.. MATH::
- f: U\subset M \longrightarrow K
+ f: M \longrightarrow K
-where `U` is an open subset of `M`.
+of class `C^k`.
Differentiable scalar fields are implemented by the class
:class:`DiffScalarField`.
@@ -45,12 +45,12 @@ class DiffScalarField(ScalarField):
Differentiable scalar field on a differentiable manifold.
Given a differentiable manifold `M` of class `C^k` over a topological field
- `K` (in most applications, `K = \RR` or `K = \CC`), and an open subset `U`
- of `M`, a *differentiable scalar field* defined on `U` a map
+ `K` (in most applications, `K = \RR` or `K = \CC`), a *differentiable
+ scalar field* defined on `M` is a map
.. MATH::
- f: U\subset M \longrightarrow K
+ f: M \longrightarrow K
that is `k`-times continuously differentiable.
@@ -58,12 +58,12 @@ class DiffScalarField(ScalarField):
*parent* class is
:class:`~sage.manifolds.differentiable.scalarfield_algebra.DiffScalarFieldAlgebra`.
It inherits from the class :class:`~sage.manifolds.scalarfield.ScalarField`
- devoted to generic continuous scalar fields on a topological manifold.
+ devoted to generic continuous scalar fields on topological manifolds.
INPUT:
- - ``domain`` -- the manifold open subset `U` on which the scalar field is
- defined (must be an instance of class
+ - ``domain`` -- the differentiable manifold `M` on which the scalar field
+ is defined (must be an instance of class
:class:`~sage.manifolds.differentiable.manifold.DiffManifold`)
- ``coord_expression`` -- (default: ``None``) coordinate expression(s) of
the scalar field; this can be either
@@ -118,18 +118,21 @@ class DiffScalarField(ScalarField):
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 differentiable manifold M
+ Scalar field g on the Open subset U of the 2-dimensional differentiable
+ 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 differentiable manifold M
+ Scalar field g on the Open subset U of the 2-dimensional differentiable
+ 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 differentiable manifold M
+ Scalar field g on the Open subset U of the 2-dimensional differentiable
+ 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`::
@@ -183,7 +186,8 @@ class DiffScalarField(ScalarField):
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 differentiable manifold M
+ Scalar field h on the Open subset U of the 2-dimensional differentiable
+ manifold M
sage: h.display()
h: U --> R
(x, y) |--> H(x, y)
@@ -427,13 +431,15 @@ class DiffScalarField(ScalarField):
sage: g.domain()
Open subset U of the 2-dimensional differentiable manifold M
sage: s = f + g ; s
- Scalar field on the Open subset U of the 2-dimensional differentiable manifold M
+ Scalar field on the Open subset U of the 2-dimensional differentiable
+ manifold M
sage: s.domain()
Open subset U of the 2-dimensional differentiable 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`::
@@ -443,7 +449,7 @@ class DiffScalarField(ScalarField):
In Sage framework, the addition of `f` and `g` is permitted because
there is a *coercion* of the parent of `f`, namely `C^k(M)`, to
the parent of `g`, namely `C^k(U)` (see
- :class:`~sage.manifolds.scalarfield_algebra.ScalarFieldAlgebra`)::
+ :class:`~sage.manifolds.differentiable.scalarfield_algebra.DiffScalarFieldAlgebra`)::
sage: CM = M.scalar_field_algebra()
sage: CU = U.scalar_field_algebra()
@@ -509,7 +515,8 @@ class DiffScalarField(ScalarField):
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)
sage: s = g*h ; s
- Scalar field g*h on the Open subset U of the 2-dimensional differentiable manifold M
+ Scalar field g*h on the Open subset U of the 2-dimensional
+ differentiable manifold M
sage: s.display()
g*h: U --> R
(x, y) |--> x*y*H(x, y)
@@ -524,7 +531,8 @@ class DiffScalarField(ScalarField):
(2-dimensional differentiable manifold M,
Open subset U of the 2-dimensional differentiable manifold M)
sage: s = f*g ; s
- Scalar field on the Open subset U of the 2-dimensional differentiable manifold M
+ Scalar field on the Open subset U of the 2-dimensional differentiable
+ manifold M
sage: s.display()
U --> R
(x, y) |--> x*y/(x^2 + y^2 + 1)
@@ -541,13 +549,15 @@ class DiffScalarField(ScalarField):
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 differentiable manifold M
+ Scalar field g/h on the Open subset U of the 2-dimensional
+ differentiable 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 differentiable manifold M
+ Scalar field on the Open subset U of the 2-dimensional differentiable
+ manifold M
sage: s.display()
U --> R
(x, y) |--> 1/(x*y^3 + (x^3 + x)*y)
@@ -559,7 +569,8 @@ class DiffScalarField(ScalarField):
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 differentiable manifold M
+ Scalar field on the Open subset U of the 2-dimensional differentiable
+ manifold M
sage: s.display()
U --> R
(x, y) |--> x^2 + (x - 1)*y
@@ -568,7 +579,8 @@ class DiffScalarField(ScalarField):
::
sage: s = g*x ; s
- Scalar field on the Open subset U of the 2-dimensional differentiable manifold M
+ Scalar field on the Open subset U of the 2-dimensional differentiable
+ manifold M
sage: s.display()
U --> R
(x, y) |--> x^2*y
@@ -577,13 +589,15 @@ class DiffScalarField(ScalarField):
::
sage: s = g/x ; s
- Scalar field on the Open subset U of the 2-dimensional differentiable manifold M
+ Scalar field on the Open subset U of the 2-dimensional differentiable
+ 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 differentiable manifold M
+ Scalar field on the Open subset U of the 2-dimensional differentiable
+ manifold M
sage: s.display()
U --> R
(x, y) |--> 1/y
@@ -633,7 +647,7 @@ class DiffScalarField(ScalarField):
"""
ScalarField._init_derived(self) # derived quantities of the mother class
- self._differential = None # differential 1-form of the scalar field
+ # More to come in ticket #18843
def _del_derived(self):
r"""
@@ -646,13 +660,17 @@ class DiffScalarField(ScalarField):
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 differentiable manifold M
+ Scalar field on the Open subset U of the 2-dimensional
+ differentiable manifold M
sage: f._restrictions
- {Open subset U of the 2-dimensional differentiable manifold M: Scalar field on the Open subset U of the 2-dimensional differentiable manifold M}
+ {Open subset U of the 2-dimensional differentiable manifold M:
+ Scalar field on the Open subset U of the 2-dimensional
+ differentiable manifold M}
sage: f._del_derived()
sage: f._restrictions # restrictions are derived quantities
{}
"""
ScalarField._del_derived(self) # derived quantities of the mother class
- self._differential = None # reset of the differential
+ # More to come in ticket #18843
+
diff --git a/src/sage/manifolds/differentiable/scalarfield_algebra.py b/src/sage/manifolds/differentiable/scalarfield_algebra.py
index b061b5b..cd313ed 100644
--- a/src/sage/manifolds/differentiable/scalarfield_algebra.py
+++ b/src/sage/manifolds/differentiable/scalarfield_algebra.py
@@ -2,11 +2,11 @@ r"""
Algebra of differentiable scalar fields
The class :class:`DiffScalarFieldAlgebra` implements the commutative algebra
-`C^k(U)` of differentiable scalar fields on some open subset `U` of a
-differentiable manifold `M` of class `C^k` over a topological field `K` (in
+`C^k(M)` of differentiable scalar fields on a differentiable manifold `M` of
+class `C^k` over a topological field `K` (in
most applications, `K = \RR` or `K = \CC`). By *differentiable scalar field*,
-it is meant a function `U\rightarrow K` that is `k`-times continuously
-differentiable. `C^k(U)` is an algebra over `K`, whose ring product is the
+it is meant a function `M\rightarrow K` that is `k`-times continuously
+differentiable. `C^k(M)` is an algebra over `K`, whose ring product is the
pointwise multiplication of `K`-valued functions, which is clearly commutative.
AUTHORS:
@@ -44,18 +44,19 @@ class DiffScalarFieldAlgebra(ScalarFieldAlgebra):
a differentiable manifold.
If `M` is a differentiable manifold of class `C^k` over a topological
- field `K` and `U` is an open subset of `M`, the *commutative algebra of
- scalar fields on* `U` is the set `C^k(U)` of all `k`-times continuously
- differentiable maps `U\rightarrow K`. The set `C^k(U)` is an algebra over
- `K`, whose ring product is the pointwise multiplication of `K`-valued
- functions, which is clearly commutative.
+ field `K`, the *commutative algebra of scalar fields on* `M` is the set
+ `C^k(M)` of all `k`-times continuously differentiable maps `M\rightarrow K`.
+ The set `C^k(M)` is an algebra over `K`, whose ring product is the
+ pointwise multiplication of `K`-valued functions, which is clearly
+ commutative.
If `K = \RR` or `K = \CC`, the field `K` over which the
- albegra `C^k(U)` is constructed,
- is represented by Sage's Symbolic Ring SR, since there is no exact
- representation of `\RR` nor `\CC` in Sage.
+ algebra `C^k(M)` is constructed is represented by Sage's Symbolic Ring
+ ``SR``, since there is no exact representation of `\RR` nor `\CC` in Sage.
- The class :class:`DiffScalarFieldAlgebra` inherits from
+ Via its base class
+ :class:`~sage.manifolds.scalarfield_algebra.ScalarFieldAlgebra`,
+ the class :class:`DiffScalarFieldAlgebra` inherits from
:class:`~sage.structure.parent.Parent`, with the category set to
:class:`~sage.categories.commutative_algebras.CommutativeAlgebras`.
The corresponding *element* class is
@@ -63,13 +64,14 @@ class DiffScalarFieldAlgebra(ScalarFieldAlgebra):
INPUT:
- - ``domain`` -- the manifold open subset `U` on which the scalar fields are
- defined (must be an instance of class
+ - ``domain`` -- the differentiable manifold `M` on which the scalar fields
+ are defined (must be an instance of class
:class:`~sage.manifolds.differentiable.manifold.DiffManifold`)
EXAMPLES:
- Algebras of scalar fields on the sphere `S^2` and on some subdomain of it::
+ Algebras of scalar fields on the sphere `S^2` and on some open subset of
+ it::
sage: M = DiffManifold(2, 'M') # the 2-dimensional sphere S^2
sage: U = M.open_subset('U') # complement of the North pole
@@ -77,9 +79,9 @@ class DiffScalarFieldAlgebra(ScalarFieldAlgebra):
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: CM = M.scalar_field_algebra() ; CM
Algebra of differentiable scalar fields on the 2-dimensional
@@ -189,7 +191,8 @@ class DiffScalarFieldAlgebra(ScalarFieldAlgebra):
the domain (this allows one to set the name of the scalar field at the
construction)::
- sage: f1 = M.scalar_field({c_xy: atan(x^2+y^2), c_uv: pi/2 - atan(u^2+v^2)}, name='f')
+ sage: f1 = M.scalar_field({c_xy: atan(x^2+y^2), c_uv: pi/2 - atan(u^2+v^2)},
+ ....: name='f')
sage: f1.parent()
Algebra of differentiable scalar fields on the 2-dimensional
differentiable manifold M
@@ -238,9 +241,14 @@ class DiffScalarFieldAlgebra(ScalarFieldAlgebra):
(x, y) |--> 2*arctan(x^2 + y^2)
(u, v) |--> pi - 2*arctan(u^2 + v^2)
- Other coercions are those from the Symbolic Ring, leading to constant
- scalar fields (if the symbolic expression does not involve any chart
- coordinate)::
+ Another coercion is that from the Symbolic Ring, the parent of all
+ symbolic expressions (cf. :class:`~sage.symbolic.ring.SymbolicRing`).
+ Since the Symbolic Ring is the base ring for the algebra ``CM``, the
+ coercion of a symbolic expression ``s`` is performed by the operation
+ ``s*CM.one()``, which invokes the reflected multiplication operator
+ :meth:`sage.manifolds.scalarfield.ScalarField._rmul_`. If the symbolic
+ expression does not involve any chart coordinate, the outcome is a
+ constant scalar field::
sage: h = CM(pi*sqrt(2)) ; h
Scalar field on the 2-dimensional differentiable manifold M
@@ -248,11 +256,34 @@ class DiffScalarFieldAlgebra(ScalarFieldAlgebra):
M --> R
on U: (x, y) |--> sqrt(2)*pi
on V: (u, v) |--> sqrt(2)*pi
+ sage: a = var('a')
+ sage: h = CM(a); h.display()
+ M --> R
+ on U: (x, y) |--> a
+ on V: (u, v) |--> a
+
+ If the symbolic expression involves some coordinate of one of the
+ manifold's charts, the outcome is initialized only on the chart domain::
+
+ sage: h = CM(a+x); h.display()
+ M --> R
+ on U: (x, y) |--> a + x
+ sage: h = CM(a+u); h.display()
+ M --> R
+ on V: (u, v) |--> a + u
+
+ If the symbolic expression involves coordinates of different charts,
+ the scalar field is created as a Python object, but is not initialized,
+ in order to avoid any ambiguity::
+
+ sage: h = CM(x+u); h.display()
+ M --> R
- TESTS OF THE ALGEBRA LAWS:
+ .. RUBRIC:: TESTS OF THE ALGEBRA LAWS:
Ring laws::
+ sage: h = CM(pi*sqrt(2))
sage: s = f + h ; s
Scalar field on the 2-dimensional differentiable manifold M
sage: s.display()
@@ -408,7 +439,8 @@ class DiffScalarFieldAlgebra(ScalarFieldAlgebra):
'Algebra of differentiable scalar fields on the 2-dimensional differentiable manifold M'
"""
- return "Algebra of differentiable scalar fields on the {}".format(self._domain)
+ return "Algebra of differentiable scalar fields on " + \
+ "the {}".format(self._domain)
def _latex_(self):
r"""
diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py
index 8d2f250..794d092 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:
@@ -1452,7 +1485,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,
@@ -1520,6 +1553,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
@@ -1540,7 +1578,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::
@@ -1604,8 +1649,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
@@ -1618,15 +1663,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
@@ -1709,8 +1754,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
@@ -1723,15 +1768,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
@@ -1748,7 +1793,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)
@@ -1844,4 +1890,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 used
+ default chart of the scalar field's domain will be used
- ``from_chart`` -- (default: ``None``) chart from which the
required expression is computed if it is not known already in the
- chart ``chart``; if ``None``, a chart is picked in ``self._express``
+ chart ``chart``; if ``None``, a chart is picked in the known
+ expressions.
OUTPUT:
@@ -1077,7 +1079,7 @@ class ScalarField(CommutativeAlgebraElement):
break
if not found:
raise ValueError("no starting chart could be found to " +
- "compute the expression in the {}".format(chart))
+ "compute the expression in the {}".format(chart))
change = self._domain._coord_changes[(chart, from_chart)]
# old coordinates expressed in terms of the new ones:
coords = [ change._transf._functions[i]._express
@@ -1087,6 +1089,27 @@ class ScalarField(CommutativeAlgebraElement):
self._del_derived()
return self._express[chart]
+ def function_chart(self, chart=None, from_chart=None):
+ r"""
+ Deprecated.
+
+ Use :meth:`coord_function` instead.
+
+ EXAMPLE::
+
+ sage: M = TopManifold(2, 'M')
+ sage: c_xy.<x,y> = M.chart()
+ sage: f = M.scalar_field(x*y^2)
+ sage: fc = f.function_chart()
+ doctest:...: DeprecationWarning: Use coord_function() instead.
+ See http://trac.sagemath.org/18640 for details.
+ sage: fc
+ x*y^2
+
+ """
+ from sage.misc.superseded import deprecation
+ deprecation(18640, 'Use coord_function() instead.')
+ return self.coord_function(chart=chart, from_chart=from_chart)
def expr(self, chart=None, from_chart=None):
r"""
@@ -1097,7 +1120,7 @@ class ScalarField(CommutativeAlgebraElement):
- ``chart`` -- (default: ``None``) chart with respect to which the
coordinate expression is required; if ``None``, the default
- chart of the domain of ``self`` will be used
+ chart of the scalar field's domain will be used
- ``from_chart`` -- (default: ``None``) chart from which the
required expression is computed if it is not known already in the
chart ``chart``; if ``None``, a chart is picked in ``self._express``
@@ -1149,9 +1172,9 @@ class ScalarField(CommutativeAlgebraElement):
INPUT:
- ``coord_expression`` -- coordinate expression of the scalar field
- - ``chart`` -- (default: ``None``) chart in which ``coord_expression`` is
- defined; if ``None``, the default chart of the domain of ``self`` is
- assumed
+ - ``chart`` -- (default: ``None``) chart in which ``coord_expression``
+ is defined; if ``None``, the default chart of the scalar field's
+ domain is assumed
EXAMPLES:
@@ -1193,13 +1216,13 @@ class ScalarField(CommutativeAlgebraElement):
- ``coord_expression`` -- coordinate expression of the scalar field
- ``chart`` -- (default: ``None``) chart in which ``coord_expression``
- is defined; if ``None``, the default chart of the domain of ``self`` is
- assumed
+ is defined; if ``None``, the default chart of the scalar field's
+ domain is assumed
.. WARNING::
If the scalar field 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:
@@ -1252,9 +1275,9 @@ class ScalarField(CommutativeAlgebraElement):
sage: U = M.open_subset('U') ; V = M.open_subset('V') # the complement of resp. N pole and S pole
sage: M.declare_union(U,V) # S^2 is the union of U and V
sage: c_xy.<x,y> = U.chart() ; c_uv.<u,v> = V.chart() # stereographic coordinates
- 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: W = U.intersection(V) # S^2 minus the two poles
sage: f = M.scalar_field(atan(x^2+y^2), chart=c_xy, name='f')
@@ -1359,10 +1382,11 @@ class ScalarField(CommutativeAlgebraElement):
result._latex += " & "
else:
result._txt += "on " + chart._domain._name + ": "
- result._latex += r"\mbox{on}\ " + latex(chart._domain) + r": & "
+ result._latex += r"\mbox{on}\ " + latex(chart._domain) + \
+ r": & "
result._txt += repr(coords) + " |--> " + repr(expression) + "\n"
result._latex += latex(coords) + r"& \longmapsto & " + \
- latex(expression) + r"\\"
+ latex(expression) + r"\\"
except (TypeError, ValueError):
pass
@@ -1404,18 +1428,18 @@ class ScalarField(CommutativeAlgebraElement):
def restrict(self, subdomain):
r"""
- Restriction of the scalar field to a subdomain of its domain of
+ Restriction of the scalar field to an open subset of its domain of
definition.
INPUT:
- - ``subdomain`` -- the subdomain (instance of
- :class:`~sage.manifolds.manifold.TopManifold`)
+ - ``subdomain`` -- an open subset of the scalar field's domain (must
+ be an instance of :class:`~sage.manifolds.manifold.TopManifold`)
OUTPUT:
- instance of :class:`ScalarField` representing the restriction of
- ``self`` to ``subdomain``.
+ the scalar field to ``subdomain``.
EXAMPLE:
@@ -1427,14 +1451,17 @@ class ScalarField(CommutativeAlgebraElement):
sage: U = M.open_subset('U', coord_def={X: x^2+y^2 < 1}) # U unit open disc
sage: f = M.scalar_field(cos(x*y), name='f')
sage: f_U = f.restrict(U) ; f_U
- Scalar field f on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field f on the Open subset U of the 2-dimensional
+ topological manifold M
sage: f_U.display()
f: U --> R
(x, y) |--> cos(x*y)
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: f_U.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
The restriction to the whole domain is the identity::
@@ -1446,7 +1473,8 @@ class ScalarField(CommutativeAlgebraElement):
Restriction of the zero scalar field::
sage: M.zero_scalar_field().restrict(U)
- Scalar field zero on the Open subset U of the 2-dimensional topological manifold M
+ Scalar field zero on the Open subset U of the 2-dimensional
+ topological manifold M
sage: M.zero_scalar_field().restrict(U) is U.zero_scalar_field()
True
@@ -1455,9 +1483,8 @@ class ScalarField(CommutativeAlgebraElement):
return self
if subdomain not in self._restrictions:
if not subdomain.is_subset(self._domain):
- raise ValueError("the specified domain is not a subset " +
- "of the domain of definition of the scalar " +
- "field")
+ raise ValueError("the specified domain is not a subset of " +
+ "the domain of definition of the scalar field")
# Special case of the zero scalar field:
if self._is_zero:
return subdomain._zero_scalar_field
@@ -1476,7 +1503,8 @@ class ScalarField(CommutativeAlgebraElement):
def common_charts(self, other):
r"""
- Find common charts for the expressions of ``self`` and ``other``.
+ Find common charts for the expressions of the scalar field and
+ ``other``.
INPUT:
@@ -1517,7 +1545,8 @@ class ScalarField(CommutativeAlgebraElement):
sage: trans = c_xy.transition_map(c_uv, (x+y, x-y), 'W', x<0, u+v<0)
sage: M.atlas()
- [Chart (U, (x, y)), Chart (V, (u, v)), Chart (W, (x, y)), Chart (W, (u, v))]
+ [Chart (U, (x, y)), Chart (V, (u, v)), Chart (W, (x, y)),
+ Chart (W, (u, v))]
sage: c_xy_W = M.atlas()[2]
sage: c_uv_W = M.atlas()[3]
sage: trans.inverse()
@@ -1535,14 +1564,16 @@ class ScalarField(CommutativeAlgebraElement):
sage: f.expr(c_uv_W)
1/4*u^2 + 1/2*u*v + 1/4*v^2
sage: f._express # random (dictionary output)
- {Chart (U, (x, y)): x^2, Chart (W, (x, y)): x^2, Chart (W, (u, v)): 1/4*u^2 + 1/2*u*v + 1/4*v^2}
+ {Chart (U, (x, y)): x^2, Chart (W, (x, y)): x^2,
+ Chart (W, (u, v)): 1/4*u^2 + 1/2*u*v + 1/4*v^2}
sage: g._express # random (dictionary output)
{Chart (U, (x, y)): x + y, Chart (V, (u, v)): u}
sage: f.common_charts(g)
[Chart (U, (x, y)), Chart (W, (u, v))]
sage: # the expressions have been updated on the subcharts
sage: g._express # random (dictionary output)
- {Chart (U, (x, y)): x + y, Chart (V, (u, v)): u, Chart (W, (u, v)): u}
+ {Chart (U, (x, y)): x + y, Chart (V, (u, v)): u,
+ Chart (W, (u, v)): u}
Common charts found by computing some coordinate changes::
@@ -1556,13 +1587,14 @@ class ScalarField(CommutativeAlgebraElement):
sage: f.common_charts(g)
[Chart (W, (u, v)), Chart (W, (x, y))]
sage: f._express # random (dictionary output)
- {Chart (W, (u, v)): 1/4*u^2 + 1/2*u*v + 1/4*v^2, Chart (W, (x, y)): x^2}
+ {Chart (W, (u, v)): 1/4*u^2 + 1/2*u*v + 1/4*v^2,
+ Chart (W, (x, y)): x^2}
sage: g._express # random (dictionary output)
{Chart (W, (u, v)): u + 1, Chart (W, (x, y)): x + y + 1}
"""
if not isinstance(other, ScalarField):
- raise TypeError("The second argument must be a scalar field.")
+ raise TypeError("the second argument must be a scalar field")
dom1 = self._domain
dom2 = other._domain
coord_changes = self._manifold._coord_changes
@@ -1612,11 +1644,11 @@ class ScalarField(CommutativeAlgebraElement):
INPUT:
- ``p`` -- point in the scalar field's domain (type:
- :class:`~sage.manifolds.point.ManifoldPoint`)
+ :class:`~sage.manifolds.point.TopManifoldPoint`)
- ``chart`` -- (default: ``None``) chart in which the coordinates of p
are to be considered; if none is provided, a chart in which both p's
- coordinates and the expression of ``self`` are known is searched,
- starting from the default chart of self._domain
+ coordinates and the expression of the scalar field are known is
+ searched, starting from the default chart of self._domain
OUTPUT:
@@ -1654,8 +1686,8 @@ class ScalarField(CommutativeAlgebraElement):
#!# it should be "if p not in self_domain:" instead, but this test is
# skipped for efficiency
if p not in self._manifold:
- raise ValueError("the point " + str(p) +
- " does not belong to the " + str(self._manifold))
+ raise ValueError("the {} ".format(p) + "does not belong " +
+ "to the {}".format(self._manifold))
if self._is_zero:
return 0
if chart is None:
@@ -1698,7 +1730,7 @@ class ScalarField(CommutativeAlgebraElement):
OUTPUT:
- - an exact copy of ``self``
+ - an exact copy of the scalar field
TESTS::
@@ -1726,7 +1758,7 @@ class ScalarField(CommutativeAlgebraElement):
OUTPUT:
- - the negative of ``self``
+ - the negative of the scalar field
TESTS::
@@ -2021,10 +2053,26 @@ class ScalarField(CommutativeAlgebraElement):
if chart_var:
# Some symbolic variables in number are chart coordinates
for chart, expr in self._express.iteritems():
- # The multiplication is performed only if all the
- # symbolic variables involved in number are chart
- # coordinates:
- if all(s in chart[:] for s in var):
+ # The multiplication is performed only if
+ # either
+ # (i) all the symbolic variables in number are
+ # coordinates of this chart
+ # or (ii) no symbolic variable in number belongs to a
+ # different chart
+ chart_coords = chart[:]
+ var_not_in_chart = [s for s in var
+ if not s in chart_coords]
+ any_in_other_chart = False
+ if var_not_in_chart != []:
+ for other_chart in self._domain.atlas():
+ other_chart_coords = other_chart[:]
+ for s in var_not_in_chart:
+ if s in other_chart_coords:
+ any_in_other_chart = True
+ break
+ if any_in_other_chart:
+ break
+ if not any_in_other_chart:
result._express[chart] = number * expr
return result
# General case: the multiplication is performed on all charts:
@@ -2257,7 +2305,8 @@ class ScalarField(CommutativeAlgebraElement):
sage: M = TopManifold(2, 'M')
sage: X.<x,y> = M.chart()
- sage: f = M.scalar_field({X: 1+x^2+y^2}, name='f', latex_name=r"\Phi")
+ sage: f = M.scalar_field({X: 1+x^2+y^2}, name='f',
+ ....: latex_name=r"\Phi")
sage: g = sqrt(f) ; g
Scalar field sqrt(f) on the 2-dimensional topological manifold M
sage: latex(g)
diff --git a/src/sage/manifolds/scalarfield_algebra.py b/src/sage/manifolds/scalarfield_algebra.py
index a8f8e25..ed6bf87 100644
--- a/src/sage/manifolds/scalarfield_algebra.py
+++ b/src/sage/manifolds/scalarfield_algebra.py
@@ -2,10 +2,10 @@ r"""
Scalar field algebra
The class :class:`ScalarFieldAlgebra` implements the commutative algebra
-`C^0(U)` of scalar fields on some open subset `U` of a
-topological manifold `M` over a topological field `K`. By *scalar field*, it
-is meant a continuous function `U\rightarrow K`.
-`C^0(U)` is an algebra over `K`, whose ring product is the pointwise
+`C^0(M)` of scalar fields on a topological manifold `M` over a topological
+field `K`. By *scalar field*, it
+is meant a continuous function `M\rightarrow K`. The set
+`C^0(M)` is an algebra over `K`, whose ring product is the pointwise
multiplication of `K`-valued functions, which is clearly commutative.
AUTHORS:
@@ -14,11 +14,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)
"""
@@ -40,19 +39,17 @@ from sage.manifolds.scalarfield import ScalarField
class ScalarFieldAlgebra(UniqueRepresentation, Parent):
r"""
- Commutative algebra of scalar fields on some open subset of a
- topological manifold.
+ Commutative algebra of scalar fields on a topological manifold.
- If `M` is a topological manifold over a topological field `K` and `U`
- an open subset of `M`, the commutative algebra of scalar fields on `U`
- is the set `C^0(U)` of all continuous maps `U\rightarrow K`.
- `C^0(U)` is an algebra over `K`, whose ring product is the pointwise
- multiplication of `K`-valued functions, which is clearly commutative.
+ If `M` is a topological manifold over a topological field `K`, the
+ commutative algebra of scalar fields on `M` is the set `C^0(M)` of all
+ continuous maps `M\rightarrow K`. The set `C^0(M)` is an algebra over `K`,
+ whose ring product is the pointwise multiplication of `K`-valued functions,
+ which is clearly commutative.
If `K = \RR` or `K = \CC`, the field `K` over which the
- albegra `C^0(U)` is constructed,
- is represented by Sage's Symbolic Ring SR, since there is no exact
- representation of `\RR` nor `\CC` in Sage.
+ algebra `C^0(M)` is constructed is represented by Sage's Symbolic Ring
+ ``SR``, since there is no exact representation of `\RR` nor `\CC` in Sage.
The class :class:`ScalarFieldAlgebra` inherits from
:class:`~sage.structure.parent.Parent`, with the category set to
@@ -62,13 +59,14 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
INPUT:
- - ``domain`` -- the manifold open subset `U` on which the scalar fields are
+ - ``domain`` -- the topological manifold `M` on which the scalar fields are
defined (must be an instance of class
:class:`~sage.manifolds.manifold.TopManifold`)
EXAMPLES:
- Algebras of scalar fields on the sphere `S^2` and on some subdomain of it::
+ Algebras of scalar fields on the sphere `S^2` and on some open subsets of
+ it::
sage: M = TopManifold(2, 'M') # the 2-dimensional sphere S^2
sage: U = M.open_subset('U') # complement of the North pole
@@ -76,18 +74,20 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
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: CM = M.scalar_field_algebra() ; CM
Algebra of scalar fields on the 2-dimensional topological manifold M
sage: W = U.intersection(V) # S^2 minus the two poles
sage: CW = W.scalar_field_algebra() ; CW
- Algebra of scalar fields on the Open subset W of the 2-dimensional topological manifold M
+ Algebra of scalar fields on the Open subset W of the 2-dimensional
+ topological manifold M
`C^0(M)` and `C^0(W)` belong to the category of commutative
- algebras over `\RR` (represented here by Sage's Symbolic Ring)::
+ algebras over `\RR` (represented here by Sage's
+ :class:`~sage.symbolic.ring.SymbolicRing`)::
sage: CM.category()
Category of commutative algebras over Symbolic Ring
@@ -110,7 +110,8 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
Those of `C^0(W)` are scalar fields on `W`::
sage: CW.an_element()
- Scalar field on the Open subset W of the 2-dimensional topological manifold M
+ Scalar field on the Open subset W of the 2-dimensional topological
+ manifold M
sage: CW.an_element().display() # this sample element is a constant field
W --> R
(x, y) |--> 2
@@ -128,7 +129,8 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
::
sage: CW.zero()
- Scalar field zero on the Open subset W of the 2-dimensional topological manifold M
+ Scalar field zero on the Open subset W of the 2-dimensional
+ topological manifold M
sage: CW.zero().display()
zero: W --> R
(x, y) |--> 0
@@ -146,15 +148,16 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
::
sage: CW.one()
- Scalar field 1 on the Open subset W of the 2-dimensional topological manifold M
+ Scalar field 1 on the Open subset W of the 2-dimensional topological
+ manifold M
sage: CW.one().display()
1: W --> R
(x, y) |--> 1
(u, v) |--> 1
A generic element can be constructed as for any parent in Sage, namely
- by means of the ``__call__`` operator on the parent (here with the dictionary
- of the coordinate expressions defining the scalar field)::
+ by means of the ``__call__`` operator on the parent (here with the
+ dictionary of the coordinate expressions defining the scalar field)::
sage: f = CM({c_xy: atan(x^2+y^2), c_uv: pi/2 - atan(u^2+v^2)}); f
Scalar field on the 2-dimensional topological manifold M
@@ -182,7 +185,8 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
the domain (this allows one to set the name of the scalar field at the
construction)::
- sage: f1 = M.scalar_field({c_xy: atan(x^2+y^2), c_uv: pi/2 - atan(u^2+v^2)}, name='f')
+ sage: f1 = M.scalar_field({c_xy: atan(x^2+y^2), c_uv: pi/2 - atan(u^2+v^2)},
+ ....: name='f')
sage: f1.parent()
Algebra of scalar fields on the 2-dimensional topological manifold M
sage: f1 == f
@@ -205,7 +209,8 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
on `M`::
sage: fW = CW(f) ; fW
- Scalar field on the Open subset W of the 2-dimensional topological manifold M
+ Scalar field on the Open subset W of the 2-dimensional topological
+ manifold M
sage: fW.display()
W --> R
(x, y) |--> arctan(x^2 + y^2)
@@ -222,15 +227,21 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
sage: s = fW + f
sage: s.parent()
- Algebra of scalar fields on the Open subset W of the 2-dimensional topological manifold M
+ Algebra of scalar fields on the Open subset W of the 2-dimensional
+ topological manifold M
sage: s.display()
W --> R
(x, y) |--> 2*arctan(x^2 + y^2)
(u, v) |--> pi - 2*arctan(u^2 + v^2)
- Other coercions are those from the Symbolic Ring, leading to constant
- scalar fields (if the symbolic expression does not involve any chart
- coordinate)::
+ Another coercion is that from the Symbolic Ring, the parent of all
+ symbolic expressions (cf. :class:`~sage.symbolic.ring.SymbolicRing`).
+ Since the Symbolic Ring is the base ring for the algebra ``CM``, the
+ coercion of a symbolic expression ``s`` is performed by the operation
+ ``s*CM.one()``, which invokes the reflected multiplication operator
+ :meth:`sage.manifolds.scalarfield.ScalarField._rmul_`. If the symbolic
+ expression does not involve any chart coordinate, the outcome is a
+ constant scalar field::
sage: h = CM(pi*sqrt(2)) ; h
Scalar field on the 2-dimensional topological manifold M
@@ -238,11 +249,34 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
M --> R
on U: (x, y) |--> sqrt(2)*pi
on V: (u, v) |--> sqrt(2)*pi
+ sage: a = var('a')
+ sage: h = CM(a); h.display()
+ M --> R
+ on U: (x, y) |--> a
+ on V: (u, v) |--> a
+
+ If the symbolic expression involves some coordinate of one of the
+ manifold's charts, the outcome is initialized only on the chart domain::
+
+ sage: h = CM(a+x); h.display()
+ M --> R
+ on U: (x, y) |--> a + x
+ sage: h = CM(a+u); h.display()
+ M --> R
+ on V: (u, v) |--> a + u
+
+ If the symbolic expression involves coordinates of different charts,
+ the scalar field is created as a Python object, but is not initialized,
+ in order to avoid any ambiguity::
+
+ sage: h = CM(x+u); h.display()
+ M --> R
- TESTS OF THE ALGEBRA LAWS:
+ .. RUBRIC:: TESTS OF THE ALGEBRA LAWS:
Ring laws::
+ sage: h = CM(pi*sqrt(2))
sage: s = f + h ; s
Scalar field on the 2-dimensional topological manifold M
sage: s.display()
@@ -289,7 +323,8 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
sage: f/fW == CW.one()
True
sage: s = f*fW ; s
- Scalar field on the Open subset W of the 2-dimensional topological manifold M
+ Scalar field on the Open subset W of the 2-dimensional topological
+ manifold M
sage: s.display()
W --> R
(x, y) |--> arctan(x^2 + y^2)^2
@@ -342,7 +377,8 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.scalarfield_algebra import ScalarFieldAlgebra
sage: CM = ScalarFieldAlgebra(M); CM
- Algebra of scalar fields on the 2-dimensional topological manifold M
+ Algebra of scalar fields on the 2-dimensional topological
+ manifold M
sage: TestSuite(CM).run()
"""
@@ -404,12 +440,14 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
sage: f.display()
M --> R
(x, y) |--> y^2 + x
- sage: f = CM._element_constructor_(coord_expression={X: x+y^2}, name='f'); f
+ sage: f = CM._element_constructor_(coord_expression={X: x+y^2},
+ ....: name='f'); f
Scalar field f on the 2-dimensional topological manifold M
sage: f.display()
f: M --> R
(x, y) |--> y^2 + x
- sage: f1 = CM._element_constructor_(coord_expression=x+y^2, chart=X, name='f'); f1
+ sage: f1 = CM._element_constructor_(coord_expression=x+y^2,
+ ....: chart=X, name='f'); f1
Scalar field f on the 2-dimensional topological manifold M
sage: f1 == f
True
@@ -420,7 +458,8 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
sage: U = M.open_subset('U', coord_def={X: x>0})
sage: CU = U.scalar_field_algebra()
sage: fU = CU._element_constructor_(f); fU
- 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: fU.display()
U --> R
(x, y) |--> y^2 + x
@@ -438,8 +477,9 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
coord_expression=sexpress, name=name,
latex_name=latex_name)
else:
- raise TypeError("Cannot coerce the " + str(coord_expression) +
- "to a scalar field on the " + str(self._domain))
+ raise TypeError("cannot convert the " +
+ "{} to a scalar ".format(coord_expression) +
+ "field on the {}".format(self._domain))
else:
# generic constructor:
resu = self.element_class(self._domain,
diff --git a/src/sage/manifolds/subset.py b/src/sage/manifolds/subset.py
index 781b980..4fb66c8 100644
--- a/src/sage/manifolds/subset.py
+++ b/src/sage/manifolds/subset.py
@@ -1,8 +1,8 @@
r"""
Subsets of topological manifolds
-The class :class:`TopManifoldSubset` implements generic subsets of a topological
-manifold. Open subsets are implemented by the class
+The class :class:`TopManifoldSubset` implements generic subsets of a
+topological manifold. Open subsets are implemented by the class
:class:`~sage.manifolds.manifold.TopManifold` (since an open subset of a
manifold is a manifold by itself), which inherits from
:class:`TopManifoldSubset`.
@@ -181,7 +181,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
Parent.__init__(self, category=category, facade=manifold)
for dom in manifold._subsets:
if name == dom._name:
- raise ValueError("The name '" + name +
+ raise ValueError("the name '" + name +
"' is already used for another " +
"subset of the {}".format(manifold))
manifold._subsets.add(self)
@@ -201,6 +201,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
# (key: subset name)
self._unions = {} # dict. of unions with other subsets (key: subset
# name)
+ self._open_covers = [] # list of open covers of self
self._is_open = False # a priori (may be redifined by subclasses)
#### Methods required for any Parent in the category of sets:
@@ -260,14 +261,15 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
Point on the 2-dimensional topological manifold M
sage: Y(p)
(0, 1/2)
- sage: p = A._element_constructor_((0,1/2), chart=Y, check_coords=False); p
+ sage: p = A._element_constructor_((0,1/2), chart=Y,
+ ....: check_coords=False); p
Point on the 2-dimensional topological manifold M
sage: Y(p)
(0, 1/2)
sage: p = A._element_constructor_((3,1/2), chart=Y)
Traceback (most recent call last):
...
- ValueError: The coordinates (3, 1/2) are not valid on the Chart (M, (u, v))
+ ValueError: the coordinates (3, 1/2) are not valid on the Chart (M, (u, v))
Specifying the name of the point::
@@ -300,7 +302,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def _an_element_(self):
r"""
- Construct some point in ``self``.
+ Construct some point in the subset.
EXAMPLES::
@@ -320,7 +322,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def _repr_(self):
r"""
- String representation of ``self``.
+ String representation of the object.
TESTS::
@@ -336,7 +338,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def _latex_(self):
r"""
- LaTeX representation of ``self``.
+ LaTeX representation of the object.
TESTS::
@@ -355,7 +357,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def manifold(self):
r"""
- Return the manifold of which ``self`` is a subset.
+ Return the manifold of which the current object is a subset.
EXAMPLES::
@@ -373,14 +375,62 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
"""
return self._manifold
+ def open_covers(self):
+ r"""
+ Return the list 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 list (indexed set) `(U_i)_{i\in I}` of
+ open subsets of `M` such that
+
+ .. MATH::
+
+ A \subset \bigcup_{i \in I} U_i
+
+ If `A` is open, we ask that the above inclusion is actually an
+ identity:
+
+ .. MATH::
+
+ A = \bigcup_{i \in I} U_i
+
+ EXAMPLES::
+
+ sage: TopManifold._clear_cache_() # for doctests only
+ sage: M = TopManifold(2, 'M')
+ sage: M.open_covers()
+ [[2-dimensional topological manifold M]]
+ sage: U = M.open_subset('U')
+ sage: U.open_covers()
+ [[Open subset U 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_covers()
+ [[Open subset U of the 2-dimensional topological manifold M],
+ [Open subset A of the 2-dimensional topological manifold M,
+ Open subset B of the 2-dimensional topological manifold M]]
+ sage: V = M.open_subset('V')
+ sage: M.declare_union(U,V)
+ sage: M.open_covers()
+ [[2-dimensional topological manifold M],
+ [Open subset U of the 2-dimensional topological manifold M,
+ Open subset V of the 2-dimensional topological manifold M],
+ [Open subset A of the 2-dimensional topological manifold M,
+ Open subset B of the 2-dimensional topological manifold M,
+ Open subset V of the 2-dimensional topological manifold M]]
+
+ """
+ return self._open_covers
+
def subsets(self):
r"""
- Return the set of subsets that have been defined on ``self``.
+ Return the set of subsets that have been defined on the current subset.
OUTPUT:
- A Python set containing all the subsets that have been defined on
- ``self``.
+ the current subset.
.. NOTE::
@@ -425,7 +475,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- A list containing all the subsets that have been defined on
- ``self``.
+ the current subset.
.. NOTE::
@@ -457,7 +507,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def subset(self, name, latex_name=None, is_open=False):
r"""
- Create a subset of ``self``.
+ Create a subset of the current subset.
INPUT:
@@ -508,9 +558,10 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def superset(self, name, latex_name=None, is_open=False):
r"""
- Create a superset of ``self``.
+ Create a superset of the current subset.
- A *superset* is a manifold subset in which ``self`` is included.
+ A *superset* is a manifold subset in which the current subset is
+ included.
INPUT:
@@ -573,7 +624,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def intersection(self, other, name=None, latex_name=None):
r"""
- Return the intersection of ``self`` with another subset.
+ Return the intersection of the current subset with another subset.
INPUT:
@@ -588,7 +639,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- instance of :class:`TopManifoldSubset` representing the subset that
- is the intersection of ``self`` with ``other``
+ is the intersection of the current subset with ``other``
EXAMPLES:
@@ -631,8 +682,8 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
"""
if other._manifold != self._manifold:
- raise TypeError(
- "The two subsets do not belong to the same manifold.")
+ raise ValueError(
+ "the two subsets do not belong to the same manifold")
# Particular cases:
if self is self._manifold:
return other
@@ -669,7 +720,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def union(self, other, name=None, latex_name=None):
r"""
- Return the union of ``self`` with another subset.
+ Return the union of the current subset with another subset.
INPUT:
@@ -684,7 +735,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- instance of :class:`TopManifoldSubset` representing the subset that
- is the union of ``self`` with ``other``
+ is the union of the current subset with ``other``
EXAMPLES:
@@ -727,8 +778,8 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
"""
if other._manifold != self._manifold:
- raise TypeError(
- "The two subsets do not belong to the same manifold.")
+ raise ValueError(
+ "the two subsets do not belong to the same manifold")
# Particular cases:
if (self is self._manifold) or (other is self._manifold):
return self._manifold
@@ -766,18 +817,26 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
res._coord_changes.update(other._coord_changes)
self._unions[other._name] = res
other._unions[self._name] = res
+ # Open covers of the union:
+ for oc1 in self._open_covers:
+ for oc2 in other._open_covers:
+ oc = oc1[:]
+ for s in oc2:
+ if s not in oc:
+ oc.append(s)
+ res._open_covers.append(oc)
return res
def declare_union(self, dom1, dom2):
r"""
- Declare that ``self`` is the union of two subsets, i.e.
+ Declare that the current subset is the union of two subsets, i.e.
that
.. MATH::
U = U_1 \cup U_2
- where `U` is ``self``, `U_1\subset U` and `U_2\subset U`.
+ where `U` is the current subset, `U_1\subset U` and `U_2\subset U`.
INPUT:
@@ -794,22 +853,34 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
2-dimensional topological manifold M
"""
+ if dom1 == dom2:
+ if dom1 != self:
+ raise ValueError("the union of two identical sets must be " +
+ "this set")
+ return
if not dom1.is_subset(self):
- raise TypeError("The " + str(dom1) + " is not a subset of " +
- "the " + str(self) + ".")
+ raise TypeError("the {} is not a subset of ".format(dom1) +
+ "the {}".format(self))
if not dom2.is_subset(self):
- raise TypeError("The " + str(dom2) + " is not a subset of " +
- "the " + str(self) + ".")
+ raise TypeError("the {} is not a subset of ".format(dom2) +
+ "the {}".format(self))
dom1._unions[dom2._name] = self
dom2._unions[dom1._name] = self
+ for oc1 in dom1._open_covers:
+ for oc2 in dom2._open_covers:
+ oc = oc1[:]
+ for s in oc2:
+ if s not in oc:
+ oc.append(s)
+ self._open_covers.append(oc)
def is_subset(self, other):
r"""
- Return ``True`` iff ``self`` is included in ``other``.
+ Return ``True`` iff the current subset is included in ``other``.
EXAMPLES:
- Subsubsets on a 2-dimensional manifold::
+ Subsets on a 2-dimensional manifold::
sage: M = TopManifold(2, 'M')
sage: a = M.subset('A')
@@ -831,7 +902,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def __contains__(self, point):
r"""
- Check whether a point is contained in ``self``.
+ Check whether a point is contained in the current subset.
TESTS::
@@ -863,7 +934,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def point(self, coords=None, chart=None, name=None, latex_name=None):
r"""
- Define a point in ``self``.
+ Define a point in the subset.
See :class:`~sage.manifolds.point.TopManifoldPoint` for a
complete documentation.
@@ -872,12 +943,12 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
- ``coords`` -- the point coordinates (as a tuple or a list) in the
chart specified by ``chart``
- - ``chart`` -- (default: ``None``) chart in which the point coordinates are
- given; if none is provided, the coordinates are assumed to refer to
- the default chart of ``self``
+ - ``chart`` -- (default: ``None``) chart in which the point coordinates
+ are given; if ``None``, the coordinates are assumed to refer to
+ the default chart of the current subset
- ``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``
OUTPUT:
diff --git a/src/sage/manifolds/utilities.py b/src/sage/manifolds/utilities.py
index 0412302..264c176 100644
--- a/src/sage/manifolds/utilities.py
+++ b/src/sage/manifolds/utilities.py
@@ -242,7 +242,7 @@ def simplify_abs_trig(expr):
def simplify_chain_real(expr):
r"""
- Apply a chain of simplications to a symbolic expression, assuming the
+ Apply a chain of simplifications to a symbolic expression, assuming the
real domain.
This is the simplification chain used in calculus involving coordinate
@@ -344,7 +344,7 @@ def simplify_chain_real(expr):
def simplify_chain_generic(expr):
r"""
- Apply a chain of simplications to a symbolic expression
+ Apply a chain of simplifications to a symbolic expression.
This is the simplification chain used in calculus involving coordinate
functions on manifolds over fields different from `\RR`, as implemented in
@@ -451,7 +451,7 @@ class ExpressionNice(Expression):
y {\left(z - \frac{\partial\,h}{\partial z}\right)}^{2}
+ x \frac{\partial^2\,f}{\partial x\partial y}
- An example when function variables are themselve functions::
+ An example when function variables are themselves functions::
sage: f = function('f', x, y)
sage: g = function('g', x, f) # the second variable is the function f
@@ -489,7 +489,7 @@ class ExpressionNice(Expression):
\left(\frac{\partial\,f}{\partial y}\right)^{2}
The explicit mention of function arguments can be omitted for the sake of
- brievety::
+ brevity::
sage: fun = fun*f
sage: ExpressionNice(fun)
@@ -574,10 +574,13 @@ class ExpressionNice(Expression):
variables = m[4]
# dictionary to group multiple occurences of differentiation: d/dxdx -> d/dx^2 etc.
- occ = dict((i, str(variables[i]) + "^" + str(diffargs.count(i)) if(diffargs.count(i)>1) else str(variables[i])) for i in diffargs)
+ occ = dict((i, str(variables[i]) + "^" + str(diffargs.count(i))
+ if (diffargs.count(i)>1) else str(variables[i]))
+ for i in diffargs)
# re.sub for removing the brackets of possible composite variables
- res = "d" + str(numargs) + "(" + str(funcname) + ")/d" + "d".join([re.sub("\(.*?\)","", i) for i in occ.values()])
+ res = "d" + str(numargs) + "(" + str(funcname) + ")/d" + "d".join(
+ [re.sub("\(.*?\)","", i) for i in occ.values()])
# str representation of the operator
s = self._parent._repr_element_(m[0])
@@ -669,9 +672,13 @@ class ExpressionNice(Expression):
variables = m[4]
# dictionary to group multiple occurences of differentiation: d/dxdx -> d/dx^2 etc.
- occ = dict((i, str(variables[i]) + "^" + str(diffargs.count(i)) if(diffargs.count(i)>1) else str(variables[i])) for i in diffargs)
+ occ = dict((i, str(variables[i]) + "^" + str(diffargs.count(i))
+ if (diffargs.count(i)>1) else str(variables[i]))
+ for i in diffargs)
- res = "\\frac{\partial" + numargs + "\," + funcname + "}{\partial " + "\partial ".join([re.sub("\(.*?\)", "", i) for i in occ.values()]) + "}"
+ res = "\\frac{\partial" + numargs + "\," + funcname + \
+ "}{\partial " + "\partial ".join(
+ [re.sub("\(.*?\)", "", i) for i in occ.values()]) + "}"
# representation of the operator
s = self._parent._latex_element_(m[0])
@@ -700,7 +707,7 @@ class ExpressionNice(Expression):
def _list_derivatives(ex, list_d, exponent=0):
r"""
- Function to find the occurences of FDerivativeOperator in a symbolic
+ Function to find the occurrences of FDerivativeOperator in a symbolic
expression; inspired by http://ask.sagemath.org/question/10256/how-can-extract-different-terms-from-a-symbolic-expression/?answer=26136#post-id-26136
INPUT:
@@ -755,7 +762,8 @@ def _list_derivatives(ex, list_d, exponent=0):
if function == latex_function:
latex_function = latex_variable_name(str(op.function()))
- list_d.append((ex, function, latex_function, parameter_set, operands, exponent))
+ list_d.append((ex, function, latex_function, parameter_set,
+ operands, exponent))
for operand in operands:
_list_derivatives(operand, list_d, exponent)
@@ -763,7 +771,7 @@ def _list_derivatives(ex, list_d, exponent=0):
def _list_functions(ex, list_f):
r"""
- Function to find the occurences of symbolic functions in a symbolic
+ Function to find the occurrences of symbolic functions in a symbolic
expression.
INPUT:
@@ -956,3 +964,23 @@ def set_axes_labels(graph, xlabel, ylabel, zlabel, **kwds):
graph += text3d(' ' + ylabel, (xmax1, y1, zmin1), **kwds)
graph += text3d(' ' + zlabel, (xmin1, ymin1, z1), **kwds)
return graph
+
+def Manifold(*args, **kwargs):
+ r"""
+ Deprecated function.
+
+ Use :class:`~sage.manifolds.differentiable.manifold.DiffManifold` instead.
+
+ EXAMPLE::
+
+ sage: M = Manifold(3, 'M', start_index=1)
+ doctest:...: DeprecationWarning: Use DiffManifold() instead.
+ See http://trac.sagemath.org/18783 for details.
+ sage: M
+ 3-dimensional differentiable manifold M
+
+ """
+ from sage.misc.superseded import deprecation
+ from sage.manifolds.differentiable.manifold import DiffManifold
+ deprecation(18783, 'Use DiffManifold() instead.')
+ return DiffManifold(*args, **kwargs)