summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRelease Manager <release@sagemath.org>2016-05-16 11:10:14 +0200
committerVolker Braun <vbraun.name@gmail.com>2016-05-16 11:10:14 +0200
commit7caa929c60af33550c2eafd2412e81d83e97b976 (patch)
tree69b64b97b50789b0f23fa39996ea0c187669dd74
parentTrac #18659: Python 3 preparation: Change more integer divisions from / to //... (diff)
parentModify authorship for continuous maps. (diff)
Trac #18725: Topological manifolds: morphisms
This ticket implements morphisms of topological manifolds, i.e. continuous maps between topological manifolds. This is a follow-up of #18640 within the [http://sagemanifolds.obspm.fr/ SageManifolds project]. See the metaticket #18528 for an overview. Two new Python classes are introduced in this ticket: - the parent class `TopologicalManifoldHomset` for sets Hom(M,N) of morphisms between two topological manifolds M and N over the same topological field K - the element class `ContinuousMap` for elements of Hom(M,N), i.e. continuous maps M --> N Moreover, this ticket introduces plotting capabilities for charts (method `RealChart.plot()`) and for points (method `ManifoldPoint.plot()`), which require continuous maps and thus could not have been introduced in #18529. '''Documentation''': The reference manual is produced by `sage -docbuild reference/manifolds html` It can also be accessed online at http://sagemanifolds.obspm.fr/doc/18725/reference/manifolds/ More documentation (e.g. example worksheets) can be found [http://sagemanifolds.obspm.fr/documentation.html here]. URL: http://trac.sagemath.org/18725 Reported by: egourgoulhon Ticket author(s): Eric Gourgoulhon, Travis Scrimshaw Reviewer(s): Travis Scrimshaw
-rw-r--r--src/doc/en/reference/manifolds/continuous_map.rst9
-rw-r--r--src/doc/en/reference/manifolds/manifold.rst2
-rw-r--r--src/sage/manifolds/chart.py646
-rw-r--r--src/sage/manifolds/continuous_map.py1833
-rw-r--r--src/sage/manifolds/coord_func_symb.py3
-rw-r--r--src/sage/manifolds/manifold.py324
-rw-r--r--src/sage/manifolds/manifold_homset.py437
-rw-r--r--src/sage/manifolds/point.py246
-rw-r--r--src/sage/manifolds/scalarfield.py3
-rw-r--r--src/sage/manifolds/structure.py3
-rw-r--r--src/sage/manifolds/utilities.py72
11 files changed, 3516 insertions, 62 deletions
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 00000000..9c4afeb
--- /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/manifold.rst b/src/doc/en/reference/manifolds/manifold.rst
index 3ac4f04..5b1c860 100644
--- a/src/doc/en/reference/manifolds/manifold.rst
+++ b/src/doc/en/reference/manifolds/manifold.rst
@@ -15,3 +15,5 @@ Topological Manifolds
chart
scalarfield
+
+ continuous_map
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index 63b583a..3925e60 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -5,6 +5,8 @@ The class :class:`Chart` implements coordinate charts on a topological
manifold over a topological field `K`. The subclass :class:`RealChart`
is devoted to the case `K=\RR`, for which the concept of coordinate
range is meaningful.
+Moreover, :class:`RealChart` is endowed with some plotting
+capabilities (cf. method :meth:`~sage.manifolds.chart.RealChart.plot`).
Transition maps between charts are implemented via the class
:class:`CoordChange`.
@@ -40,7 +42,7 @@ from sage.structure.unique_representation import UniqueRepresentation
from sage.symbolic.ring import SR
from sage.rings.infinity import Infinity
from sage.misc.latex import latex
-from sage.manifolds.coord_func_symb import CoordFunctionSymb
+from sage.misc.decorators import options
class Chart(UniqueRepresentation, SageObject):
r"""
@@ -311,7 +313,6 @@ class Chart(UniqueRepresentation, SageObject):
# subsets of self._domain, with the
# subsets as keys
# The null and one functions of the coordinates:
- base_field_type = self._domain.base_field_type()
# Expression in self of the zero and one scalar fields of open sets
# containing the domain of self:
for dom in self._domain._supersets:
@@ -545,10 +546,10 @@ class Chart(UniqueRepresentation, SageObject):
restrictions = [x > y, (x != 0, y != 0), z^2 < x]
- means (``x > y``) and ((``x != 0``) or (``y != 0``)) and
- (``z^2 < x``). If the list ``restrictions`` contains only one
- item, this item can be passed as such, i.e. writing ``x > y``
- instead of the single element list ``[x > y]``.
+ means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``.
+ If the list ``restrictions`` contains only one item, this
+ item can be passed as such, i.e. writing ``x > y`` instead
+ of the single element list ``[x > y]``.
EXAMPLES::
@@ -568,7 +569,7 @@ class Chart(UniqueRepresentation, SageObject):
def restrict(self, subset, restrictions=None):
r"""
- Return the restriction of the chart to some open subset of its domain.
+ Return the restriction of ``self`` to some open subset of its domain.
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`.
@@ -594,14 +595,14 @@ class Chart(UniqueRepresentation, SageObject):
restrictions = [x > y, (x != 0, y != 0), z^2 < x]
- means (``x > y``) and ((``x != 0``) or (``y != 0``)) and
- (``z^2 < x``). If the list ``restrictions`` contains only one
- item, this item can be passed as such, i.e. writing ``x > y``
- instead of the single element list ``[x > y]``.
+ means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``.
+ If the list ``restrictions`` contains only one item, this
+ item can be passed as such, i.e. writing ``x > y`` instead
+ of the single element list ``[x > y]``.
OUTPUT:
- - chart `(V,\psi)`, as an instance of :class:`Chart`.
+ - chart `(V, \psi)` as a :class:`Chart`
EXAMPLES:
@@ -754,15 +755,15 @@ class Chart(UniqueRepresentation, SageObject):
restrictions = [x > y, (x != 0, y != 0), z^2 < x]
- means (``x > y``) and ((``x != 0``) or (``y != 0``)) and
- (``z^2 < x``). If the list ``restrictions`` contains only one
- item, this item can be passed as such, i.e. writing ``x > y``
- instead of the single element list ``[x > y]``.
+ means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``.
+ If the list ``restrictions`` contains only one item, this
+ item can be passed as such, i.e. writing ``x > y`` instead
+ of the single element list ``[x > y]``.
OUTPUT:
- the transition map `\psi \circ \varphi^{-1}` defined on
- `U \cap V`, as an instance of :class:`CoordChange`
+ `U \cap V` as a :class:`CoordChange`
EXAMPLES:
@@ -865,7 +866,7 @@ class Chart(UniqueRepresentation, SageObject):
& (x^1,\ldots, x^n) & \longmapsto & f(x^1,\ldots, x^n),
\end{array}
- where `V` is the chart codomain and `(x^1,\ldots, x^n)` are the
+ where `V` is the chart codomain and `(x^1, \ldots, x^n)` are the
chart coordinates.
The coordinate function can be either a symbolic one or a numerical
@@ -932,13 +933,13 @@ class Chart(UniqueRepresentation, SageObject):
where `V` is the chart codomain.
- See class :class:`~sage.manifolds.coord_func_symb.CoorFunctionSymb`
+ See class :class:`~sage.manifolds.coord_func_symb.CoordFunctionSymb`
for a complete documentation.
+
OUTPUT:
- - instance of class
- :class:`~sage.manifolds.coord_func_symb.CoorFunctionSymb`
- representing the zero coordinate function `f`.
+ - a :class:`~sage.manifolds.coord_func_symb.CoordFunctionSymb`
+ representing the zero coordinate function `f`
EXAMPLES::
@@ -986,13 +987,13 @@ class Chart(UniqueRepresentation, SageObject):
where `V` is the chart codomain.
- See class :class:`~sage.manifolds.coord_func_symb.CoorFunctionSymb`
+ See class :class:`~sage.manifolds.coord_func_symb.CoordFunctionSymb`
for a complete documentation.
+
OUTPUT:
- - instance of class
- :class:`~sage.manifolds.coord_func_symb.CoorFunctionSymb`
- representing the one coordinate function `f`.
+ - a :class:`~sage.manifolds.coord_func_symb.CoordFunctionSymb`
+ representing the one coordinate function `f`
EXAMPLES::
@@ -1044,7 +1045,7 @@ class Chart(UniqueRepresentation, SageObject):
where `V` is the codomain of `\varphi`. In other words, `f` is a
`K^m`-valued function of the coordinates associated to the chart
- `(U,\varphi)`.
+ `(U, \varphi)`.
See :class:`~sage.manifolds.coord_func.MultiCoordFunction` for a
complete documentation.
@@ -1308,6 +1309,10 @@ class RealChart(Chart):
*and* `x < 0`::
c_cartU.add_restrictions([y!=0, x<0])
+
+ Chart grids can be drawn in 2D or 3D graphics thanks to the method
+ :meth:`plot`.
+
"""
def __init__(self, domain, coordinates='', names=None):
r"""
@@ -1577,10 +1582,10 @@ class RealChart(Chart):
restrictions = [x > y, (x != 0, y != 0), z^2 < x]
- means (``x > y``) and ((``x != 0``) or (``y != 0``)) and
- (``z^2 < x``). If the list ``restrictions`` contains only one
- item, this item can be passed as such, i.e. writing ``x > y``
- instead of the single element list ``[x > y]``.
+ means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``.
+ If the list ``restrictions`` contains only one item, this
+ item can be passed as such, i.e. writing ``x > y`` instead
+ of the single element list ``[x > y]``.
EXAMPLES:
@@ -1675,8 +1680,8 @@ class RealChart(Chart):
r"""
Return the restriction of the chart to some open subset of its domain.
- 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 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.
@@ -1699,14 +1704,14 @@ class RealChart(Chart):
restrictions = [x > y, (x != 0, y != 0), z^2 < x]
- means (``x > y``) and ((``x != 0``) or (``y != 0``)) and
- (``z^2 < x``). If the list ``restrictions`` contains only one
- item, this item can be passed as such, i.e. writing ``x > y``
- instead of the single element list ``[x > y]``.
+ means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``.
+ If the list ``restrictions`` contains only one item, this
+ item can be passed as such, i.e. writing ``x > y`` instead
+ of the single element list ``[x > y]``.
OUTPUT:
- - chart `(V,\psi)`, as an instance of :class:`RealChart`.
+ - the chart `(V, \psi)` as a :class:`RealChart`
EXAMPLES:
@@ -1724,7 +1729,7 @@ class RealChart(Chart):
sage: q in D
False
- Cartesian coordinates on the annulus `1 < \sqrt{x^2+y^2} < 2`::
+ Cartesian coordinates on the annulus `1 < \sqrt{x^2 + y^2} < 2`::
sage: A = M.open_subset('A')
sage: c_cart_A = c_cart.restrict(A, [x^2+y^2>1, x^2+y^2<4])
@@ -1858,6 +1863,569 @@ class RealChart(Chart):
# All tests have been passed:
return True
+ @options(color='red', style='-', thickness=1, plot_points=75, label_axes=True)
+ def plot(self, chart=None, ambient_coords=None, mapping=None,
+ fixed_coords=None, ranges=None, max_range=8, nb_values=None,
+ steps=None, parameters=None, **kwds):
+ r"""
+ Plot ``self`` as a grid in a Cartesian graph based on
+ the coordinates of some ambient chart.
+
+ The grid is formed by curves along which a chart coordinate
+ varies, the other coordinates being kept fixed. It is drawn in
+ terms of two (2D graphics) or three (3D graphics) coordinates
+ of another chart, called hereafter the *ambient chart*.
+
+ The ambient chart is related to the current chart either by
+ a transition map if both charts are defined on the same manifold,
+ or by the coordinate expression of some continuous map (typically an
+ immersion). In the latter case, the two charts may be defined on two
+ different manifolds.
+
+ INPUT:
+
+ - ``chart`` -- (default: ``None``) the ambient chart (see above); if
+ ``None``, the ambient chart is set to the current chart
+ - ``ambient_coords`` -- (default: ``None``) tuple containing the 2
+ or 3 coordinates of the ambient chart in terms of which the plot
+ is performed; if ``None``, all the coordinates of the ambient
+ chart are considered
+ - ``mapping`` -- (default: ``None``)
+ :class:`~sage.manifolds.continuous_map.ContinuousMap`; continuous
+ manifold map providing the link between the current chart and the
+ ambient chart (cf. above); if ``None``, both charts are supposed
+ to be defined on the same manifold and related by some transition
+ map (see :meth:`~sage.manifolds.chart.Chart.transition_map`)
+ - ``fixed_coords`` -- (default: ``None``) dictionary with keys the
+ chart coordinates that are not drawn and with values the fixed
+ value of these coordinates; if ``None``, all the coordinates of the
+ current chart are drawn
+ - ``ranges`` -- (default: ``None``) dictionary with keys the
+ coordinates to be drawn and values tuples ``(x_min, x_max)``
+ specifying the coordinate range for the plot; if ``None``, the
+ entire coordinate range declared during the chart construction
+ is considered (with ``-Infinity`` replaced by ``-max_range``
+ and ``+Infinity`` by ``max_range``)
+ - ``max_range`` -- (default: 8) numerical value substituted to
+ +Infinity if the latter is the upper bound of the range of a
+ coordinate for which the plot is performed over the entire coordinate
+ range (i.e. for which no specific plot range has been set in
+ ``ranges``); similarly ``-max_range`` is the numerical valued
+ substituted for ``-Infinity``
+ - ``nb_values`` -- (default: ``None``) either an integer or a dictionary
+ with keys the coordinates to be drawn and values the number of
+ constant values of the coordinate to be considered; if ``nb_values``
+ is a single integer, it represents the number of constant values for
+ all coordinates; if ``nb_values`` is ``None``, it is set to 9 for a
+ 2D plot and to 5 for a 3D plot
+ - ``steps`` -- (default: ``None``) dictionary with keys the coordinates
+ to be drawn and values the step between each constant value of
+ the coordinate; if ``None``, the step is computed from the coordinate
+ range (specified in ``ranges``) and ``nb_values``. On the contrary
+ if the step is provided for some coordinate, the corresponding
+ number of constant values is deduced from it and the coordinate range.
+ - ``parameters`` -- (default: ``None``) dictionary giving the numerical
+ values of the parameters that may appear in the relation between
+ the two coordinate systems
+ - ``color`` -- (default: ``'red'``) either a single color or a
+ dictionary of colors, with keys the coordinates to be drawn,
+ representing the colors of the lines along which the coordinate
+ varies, the other being kept constant; if ``color`` is a single