summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTravis Scrimshaw <tscrimsh at umn.edu>2016-01-23 19:13:44 -0600
committerTravis Scrimshaw <tscrimsh at umn.edu>2016-01-23 19:13:44 -0600
commit4ed37cece6c44c8c55e79b4dd9990eafe29c20d9 (patch)
treeb76f1e6e976ae1ebb29591bc01272fcd8f8f731c
parentSome final reviewer changes and tweaks. (diff)
Some documentation rewording and other small tweaks.
-rw-r--r--src/sage/manifolds/chart.py39
-rw-r--r--src/sage/manifolds/manifold.py95
-rw-r--r--src/sage/manifolds/point.py145
-rw-r--r--src/sage/manifolds/structure.py4
-rw-r--r--src/sage/manifolds/subset.py122
5 files changed, 214 insertions, 191 deletions
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index 5f43999..f291712 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -45,8 +45,8 @@ class Chart(UniqueRepresentation, SageObject):
Chart on a topological manifold.
Given a topological manifold `M` of dimension `n` over a topological
- field `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
+ field `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
@@ -644,7 +644,7 @@ class Chart(UniqueRepresentation, SageObject):
- ``True`` if the coordinate values are admissible in the chart
image, ``False`` otherwise
- EXAMPLE::
+ EXAMPLES::
sage: M = Manifold(2, 'M', field='complex', structure='topological')
sage: X.<x,y> = M.chart()
@@ -832,12 +832,12 @@ class RealChart(Chart):
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
+ `\varphi : U \to V \subset \RR^n` is a homeomorphism from `U` to
an open subset `V` of `\RR^n`.
The components `(x^1, \ldots, x^n)` of `\varphi`, defined by
- `\varphi(p) = (x^1(p), \ldots, x^n(p))\in \RR^n` for any point `p \in U`,
- are called the *coordinates* of the chart `(U, \varphi)`.
+ `\varphi(p) = (x^1(p), \ldots, x^n(p))\in \RR^n` for any point
+ `p \in U`, are called the *coordinates* of the chart `(U, \varphi)`.
INPUT:
@@ -1607,7 +1607,7 @@ class CoordChange(SageObject):
Giving two coordinate charts `(U, \varphi)` and `(V, \psi)` on a
topological manifold `M` of dimension `n` over a topological field `K`,
- the *transition map from* `(U,\varphi)` *to* `(V,\psi)` is the map
+ the *transition map from* `(U, \varphi)` *to* `(V, \psi)` is the map
.. MATH::
@@ -1747,9 +1747,9 @@ class CoordChange(SageObject):
return True
if not isinstance(other, CoordChange):
return False
- return (self._chart1 == other._chart1) and \
- (self._chart2 == other._chart2) and \
- (self._transf == other._transf)
+ return ((self._chart1 == other._chart1)
+ and (self._chart2 == other._chart2)
+ and (self._transf == other._transf))
def __ne__(self, other):
r"""
@@ -1780,7 +1780,7 @@ class CoordChange(SageObject):
- tuple of values of coordinates of ``chart2``
- EXAMPLE::
+ EXAMPLES::
sage: M = Manifold(2, 'M', structure='topological')
sage: X.<x,y> = M.chart()
@@ -1793,10 +1793,9 @@ class CoordChange(SageObject):
#*# When MultiCoordFunction is implemented (trac #18640):
# return self._transf(*coords)
#*# for now:
- substitutions = dict([(self._chart1._xx[j], coords[j]) for j in
- range(self._n1)])
- return tuple(self._transf[i].subs(substitutions).simplify_full()
- for i in range(self._n2))
+ substitutions = {self._chart1._xx[j]: coords[j] for j in range(self._n1)}
+ return tuple([self._transf[i].subs(substitutions).simplify_full()
+ for i in range(self._n2)])
def inverse(self):
r"""
@@ -1856,12 +1855,12 @@ class CoordChange(SageObject):
if x2[i].is_positive():
coord_domain[i] = 'positive'
xp2 = [ SR.var('xxxx' + str(i), domain=coord_domain[i])
- for i in range(n2) ]
+ for i in range(n2) ]
#*# when MultiCoordFunction will be implemented (trac #18640):
# xx2 = self._transf.expr()
#*# for now:
xx2 = self._transf
- equations = [ xp2[i] == xx2[i] for i in range(n2) ]
+ equations = [xp2[i] == xx2[i] for i in range(n2)]
try:
solutions = solve(equations, *x1, solution_dict=True)
except RuntimeError:
@@ -1972,7 +1971,7 @@ class CoordChange(SageObject):
- the change of coordinates `X_1 \to X_3`, where `X_1` is the initial
chart of ``other`` and `X_3` is the final chart of ``self``
- EXAMPLE::
+ EXAMPLES::
sage: M = Manifold(2, 'M', structure='topological')
sage: X.<x,y> = M.chart()
@@ -2014,7 +2013,7 @@ class CoordChange(SageObject):
- the transition map between the charts restricted to the
specified subsets
- EXAMPLE::
+ EXAMPLES::
sage: M = Manifold(2, 'M', structure='topological')
sage: X.<x,y> = M.chart()
@@ -2053,7 +2052,7 @@ class CoordChange(SageObject):
The output is either text-formatted (console mode) or LaTeX-formatted
(notebook mode).
- EXAMPLE:
+ EXAMPLES:
From spherical coordinates to Cartesian ones in the plane::
diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py
index 09ff835..98f095f 100644
--- a/src/sage/manifolds/manifold.py
+++ b/src/sage/manifolds/manifold.py
@@ -7,7 +7,7 @@ dimension* `n` *over K* is a topological space `M` such that
- `M` is a Hausdorff space,
- `M` is second countable,
-- every point in `M` has a neighborhood homeomorphic to `K^n`
+- every point in `M` has a neighborhood homeomorphic to `K^n`.
Topological manifolds are implemented via the class
:class:`TopologicalManifold`. Open subsets of topological manifolds
@@ -62,7 +62,7 @@ they are Sage's symbolic variables::
sage: type(y)
<type 'sage.symbolic.expression.Expression'>
-The South pole is the point of coordinates `(x,y)=(0,0)` in the above
+The South pole is the point of coordinates `(x, y) = (0, 0)` in the above
chart::
sage: S = U.point((0,0), chart=stereoN, name='S'); S
@@ -77,7 +77,7 @@ the South pole to the equatorial plane::
sage: stereoS.<u,v> = V.chart(); stereoS
Chart (V, (u, v))
-The North pole is the point of coordinates `(u,v)=(0,0)` in this chart::
+The North pole is the point of coordinates `(u, v) = (0, 0)` in this chart::
sage: N = V.point((0,0), chart=stereoS, name='N'); N
Point N on the 2-dimensional topological manifold S^2
@@ -142,7 +142,7 @@ being restrictions of charts to a smaller domain::
[Chart (U, (x, y)), Chart (V, (u, v)),
Chart (W, (x, y)), Chart (W, (u, v))]
-Let us consider the point of coordinates (1,2) in the chart ``stereoN``::
+Let us consider the point of coordinates `(1, 2)` in the chart ``stereoN``::
sage: p = M.point((1,2), chart=stereoN, name='p'); p
Point p on the 2-dimensional topological manifold S^2
@@ -200,7 +200,7 @@ Another open subset of `\CC^*` is `V = \CC^*\setminus\{O\}`::
sage: V = M.open_subset('V')
We define a chart on `V` such that the point at infinity is the point of
-coordinate 0 in this chart::
+coordinate `0` in this chart::
sage: W.<w> = V.chart(); W
Chart (V, (w,))
@@ -339,12 +339,12 @@ class TopologicalManifold(ManifoldSubset):
topological manifold; the created object is then an open subset of
``ambient``
- ``latex_name`` -- (default: ``None``) string; LaTeX symbol to
- denote the manifold; if none is provided, it is set to ``name``
+ denote the manifold; if none are provided, it is set to ``name``
- ``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 category; if ``None``,
- ``Manifolds(field)`` is assumed (see the category
+ - ``category`` -- (default: ``None``) to specify the category; if
+ ``None``, ``Manifolds(field)`` is assumed (see the category
:class:`~sage.categories.manifolds.Manifolds`)
- ``unique_tag`` -- (default: ``None``) tag used to force the construction
of a new object when all the other arguments have been used previously
@@ -353,7 +353,7 @@ class TopologicalManifold(ManifoldSubset):
behavior inherited from
:class:`~sage.manifolds.subset.ManifoldSubset`
would return the previously constructed object corresponding to these
- arguments).
+ arguments)
EXAMPLES:
@@ -456,6 +456,9 @@ class TopologicalManifold(ManifoldSubset):
sage: TestSuite(M).run()
+ .. SEEALSO::
+
+ :mod:`sage.manifolds.manifold`
"""
def __init__(self, n, name, field, structure, ambient=None,
latex_name=None, start_index=0, category=None,
@@ -558,8 +561,8 @@ class TopologicalManifold(ManifoldSubset):
sage: U = M.open_subset('U')
sage: U._repr_()
- 'Open subset U of the 3-dimensional topological manifold M over the Rational Field'
-
+ 'Open subset U of the 3-dimensional topological manifold M
+ over the Rational Field'
"""
if self is self._manifold:
if self._field_type == 'real':
@@ -727,16 +730,16 @@ class TopologicalManifold(ManifoldSubset):
INPUT:
- ``name`` -- name given to the open subset
- - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
- subset; if none is provided, it is set to ``name``
+ - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote
+ the subset; if none are 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 the manifold 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:
- - the open subset, as an instance of :class:`TopologicalManifold`.
+ - the open subset, as an instance of :class:`TopologicalManifold`
EXAMPLES:
@@ -789,7 +792,8 @@ class TopologicalManifold(ManifoldSubset):
sage: U.atlas()
[Chart (U, (x, y))]
- Therefore, one can immediately check whether a point belongs to U::
+ Therefore, one can immediately check whether a point belongs
+ to ``U``::
sage: M.point((0,0)) in U
True
@@ -833,14 +837,14 @@ class TopologicalManifold(ManifoldSubset):
separated by a space
- ``domain`` -- (default: ``None``) string containing the name of the
chart's domain, which must be a subset of the current manifold; if
- ``None``, the current manifold is assumed.
+ ``None``, the current manifold is assumed
OUTPUT:
- instance of
:class:`~sage.manifolds.chart.Chart` (or of the subclass
:class:`~sage.manifolds.chart.RealChart`) representing the chart
- corresponding to the above specifications.
+ corresponding to the above specifications
EXAMPLES::
@@ -881,7 +885,7 @@ class TopologicalManifold(ManifoldSubset):
r"""
Return the dimension of the manifold over its base field.
- EXAMPLE::
+ EXAMPLES::
sage: M = Manifold(2, 'M', structure='topological')
sage: M.dimension()
@@ -935,8 +939,8 @@ class TopologicalManifold(ManifoldSubset):
- ``'real'`` for the real field `\RR`
- ``'complex'`` for the complex field `\CC`
- - ``'neither_real_nor_complex'`` for a field different from `\RR` and
- `\CC`
+ - ``'neither_real_nor_complex'`` for a field different from `\RR`
+ and `\CC`
EXAMPLES::
@@ -964,7 +968,7 @@ class TopologicalManifold(ManifoldSubset):
- the integer `i_0` such that all indices of indexed objects on the
manifold range from `i_0` to `i_0 + n - 1`, where `n` is the
- manifold's dimension.
+ manifold's dimension
EXAMPLES::
@@ -984,14 +988,14 @@ class TopologicalManifold(ManifoldSubset):
INPUT:
- - ``start`` -- (default: ``None``) initial value `i_0` of the index; if
- none is provided, the value returned by :meth:`start_index()` is
- assumed.
+ - ``start`` -- (default: ``None``) initial value `i_0` of the index;
+ if none are provided, the value returned by :meth:`start_index()`
+ is assumed
OUTPUT:
- an iterable index, starting from `i_0` and ending at
- `i_0 + n - 1`, where `n` is the manifold's dimension.
+ `i_0 + n - 1`, where `n` is the manifold's dimension
EXAMPLES:
@@ -1118,7 +1122,7 @@ class TopologicalManifold(ManifoldSubset):
sage: M.atlas()
[Chart (R^2, (x, y))]
- The complement of the half line `\{y=0,\; x\geq 0\}`::
+ The complement of the half line `\{y = 0, x \geq 0\}`::
sage: U = M.open_subset('U', coord_def={c_cart: (y!=0,x<0)})
sage: U.atlas()
@@ -1126,7 +1130,7 @@ class TopologicalManifold(ManifoldSubset):
sage: M.atlas()
[Chart (R^2, (x, y)), Chart (U, (x, y))]
- Spherical (polar) coordinates on `U`::
+ Spherical (polar) coordinates on ``U``::
sage: c_spher.<r, ph> = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi')
sage: U.atlas()
@@ -1186,7 +1190,7 @@ class TopologicalManifold(ManifoldSubset):
OUTPUT:
- instance of :class:`~sage.manifolds.chart.Chart`
- representing the default chart.
+ representing the default chart
EXAMPLES:
@@ -1490,19 +1494,31 @@ def Manifold(dim, name, latex_name=None, field='real', structure='smooth',
r"""
Construct a manifold of a given type over a topological field `K`.
+ Given a topological field `K` (in most applications, `K = \RR` or
+ `K = \CC`) and a non-negative integer `n`, a *topological manifold of
+ dimension* `n` *over K* is a topological space `M` such that
+
+ - `M` is a Hausdorff space,
+ - `M` is second countable, and
+ - every point in `M` has a neighborhood homeomorphic to `K^n`.
+
+ A *real manifold* is a manifold over `\RR`. A *differentiable* (resp.
+ *smooth*, resp. *analytic*) is a real manifold such that all transition
+ maps are *differentiable* (resp. *smooth*, resp. *analytic*).
+
INPUT:
- ``dim`` -- positive integer; dimension of the manifold
- ``name`` -- string; name (symbol) given to the manifold
- ``latex_name`` -- (default: ``None``) string; LaTeX symbol to
- denote the manifold; if none is provided, it is set to ``name``
+ denote the manifold; if none are provided, it is set to ``name``
- ``field`` -- (default: ``'real'``) field `K` on which the
manifold is defined; allowed values are
- ``'real'`` or an object of type ``RealField`` (e.g. ``RR``) for a
manifold over `\RR`
- - ``'complex'`` or an object of type ``ComplexField`` (e.g. ``CC``) for
- a manifold over `\CC`
+ - ``'complex'`` or an object of type ``ComplexField`` (e.g. ``CC``)
+ for a manifold over `\CC`
- an object in the category of topological fields (see
:class:`~sage.categories.fields.Fields` and
:class:`~sage.categories.topological_spaces.TopologicalSpaces`)
@@ -1519,14 +1535,12 @@ def Manifold(dim, name, latex_name=None, field='real', structure='smooth',
- ``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
- - ``extra_kwds`` -- keywords meaningful only for some specific types of
- manifolds
+ - ``extra_kwds`` -- keywords meaningful only for some specific types
+ of manifolds
OUTPUT:
- - a manifold of the specified type, as an instance of
- :class:`~sage.manifolds.manifold.TopologicalManifold` or one of its
- subclasses.
+ - a manifold of the specified type
EXAMPLES:
@@ -1591,8 +1605,8 @@ def Manifold(dim, name, latex_name=None, field='real', structure='smooth',
sage: M != M_old
True
- Let us introduce a chart on ``M``, using the same coordinate symbols as
- for ``M_old``::
+ Let us introduce a chart on ``M``, using the same coordinate symbols
+ as for ``M_old``::
sage: X.<x,y> = M.chart()
@@ -1640,3 +1654,4 @@ def Manifold(dim, name, latex_name=None, field='real', structure='smooth',
return TopologicalManifold(dim, name, field, structure,
latex_name=latex_name, start_index=start_index,
unique_tag=getrandbits(128)*time())
+
diff --git a/src/sage/manifolds/point.py b/src/sage/manifolds/point.py
index 34dbd88..9f97c4a 100644
--- a/src/sage/manifolds/point.py
+++ b/src/sage/manifolds/point.py
@@ -3,9 +3,10 @@ Points of Topological Manifolds
The class :class:`ManifoldPoint` implements points of a
topological manifold.
+
A :class:`ManifoldPoint` object can have coordinates in
-various charts defined on the manifold. Two points are declared equal if they
-have the same coordinates in the same chart.
+various charts defined on the manifold. Two points are declared
+equal if they have the same coordinates in the same chart.
AUTHORS:
@@ -25,7 +26,11 @@ Defining a point in `\RR^3` by its spherical coordinates::
sage: M = Manifold(3, 'R^3', structure='topological')
sage: U = M.open_subset('U') # the complement of the half-plane (y=0, x>=0)
sage: c_spher.<r,th,ph> = U.chart(r'r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
- sage: p = U((1, pi/2, pi), name='P') # coordinates in U's default chart (c_spher)
+
+We construct the point in the coordinates in the default chart of ``U``
+(``c_spher``)::
+
+ sage: p = U((1, pi/2, pi), name='P')
sage: p
Point P on the 3-dimensional topological manifold R^3
sage: latex(p)
@@ -39,7 +44,7 @@ Defining a point in `\RR^3` by its spherical coordinates::
sage: p.coord(c_spher) # equivalent to above
(1, 1/2*pi, pi)
-Computing the point's coordinates in a new chart::
+Computing the coordinates of ``p`` in a new chart::
sage: c_cart.<x,y,z> = U.chart() # Cartesian coordinates on U
sage: spher_to_cart = c_spher.transition_map(c_cart,
@@ -74,9 +79,9 @@ class ManifoldPoint(Element):
r"""
Point of a topological manifold.
- This is a Sage *element* class, the corresponding *parent* class being
- :class:`~sage.manifolds.manifold.TopologicalManifold`
- or :class:`~sage.manifolds.subset.ManifoldSubset`
+ This is a Sage *element* class, the corresponding *parent* class
+ being :class:`~sage.manifolds.manifold.TopologicalManifold`
+ or :class:`~sage.manifolds.subset.ManifoldSubset`.
INPUT:
@@ -89,9 +94,9 @@ class ManifoldPoint(Element):
- ``name`` -- (default: ``None``) name given to the point
- ``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``
+ - ``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``
EXAMPLES:
@@ -111,7 +116,8 @@ class ManifoldPoint(Element):
sage: p = M((a, b), name='P'); p
Point P on the 2-dimensional topological manifold M
- A point is an element of the manifold subset in which it has been defined::
+ A point is an element of the manifold subset in which it has
+ been defined::
sage: p in M
True
@@ -137,8 +143,8 @@ class ManifoldPoint(Element):
sage: latex(p)
\mathcal{P}
- Points can be drawn in 2D or 3D graphics thanks to the method :meth:`plot`.
-
+ Points can be drawn in 2D or 3D graphics thanks to the
+ method :meth:`plot`.
"""
def __init__(self, parent, coords=None, chart=None, name=None,
latex_name=None, check_coords=True):
@@ -238,7 +244,6 @@ class ManifoldPoint(Element):
return r'\mbox{' + str(self) + r'}'
return self._latex_name
-
def coord(self, chart=None, old_chart=None):
r"""
Return the point coordinates in the specified chart.
@@ -252,9 +257,9 @@ class ManifoldPoint(Element):
INPUT:
- - ``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
+ - ``chart`` -- (default: ``None``) chart in which the coordinates
+ are given; if none are 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,
@@ -264,12 +269,17 @@ class ManifoldPoint(Element):
Spherical coordinates of a point on `\RR^3`::
- sage: M = Manifold(3, 'M', structure='topological') # the part of R^3 covered by spherical coordinates
+ sage: M = Manifold(3, 'M', structure='topological')
sage: c_spher.<r,th,ph> = M.chart(r'r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi') # spherical coordinates
sage: p = M.point((1, pi/2, pi))
sage: p.coord() # coordinates on the manifold's default chart
(1, 1/2*pi, pi)
- sage: p.coord(c_spher) # with the chart c_spher specified (same result as above since this is the default chart)
+
+ We now give ``p`` in the coordinates of the chart ``c_spher``
+ explicitly specified. However this is same result as above
+ since this is the default chart)::
+
+ sage: p.coord(c_spher)
(1, 1/2*pi, pi)
An alternative way to get the coordinates is to let the chart act
@@ -284,7 +294,11 @@ class ManifoldPoint(Element):
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
+
+ The computation is performed by means of the above change
+ of coordinates::
+
+ sage: p.coord(c_cart)
(-1, 0, 0)
sage: p.coord(c_cart) == c_cart(p)
True
@@ -294,18 +308,21 @@ class ManifoldPoint(Element):
sage: M = Manifold(2, 'M', structure='topological')
sage: c_xy.<x,y> = M.chart()
sage: (a, b) = var('a b') # generic coordinates for the point
- sage: p = M.point((a, b), name='P')
- sage: p.coord() # coordinates of P in the manifold's default chart
+ sage: P = M.point((a, b), name='P')
+
+ Coordinates of ``P`` in the manifold's default chart::
+
+ sage: P.coord()
(a, b)
- Coordinates of P in a new chart::
+ Coordinates of ``P`` in a new chart::
sage: c_uv.<u,v> = M.chart()
sage: ch_xy_uv = c_xy.transition_map(c_uv, [x-y, x+y])
- sage: p.coord(c_uv)
+ sage: P.coord(c_uv)
(a - b, a + b)
- Coordinates of P in a third chart::
+ Coordinates of ``P`` in a third chart::
sage: c_wz.<w,z> = M.chart()
sage: ch_uv_wz = c_uv.transition_map(c_wz, [u^3, v^3])
@@ -313,14 +330,15 @@ class ManifoldPoint(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)
Actually, in the present case, it is not necessary to specify
- old_chart='uv'::
+ ``old_chart='uv'``. Note that the first command erases all
+ the coordinates except those in the chart ``c_uv``::
- sage: p.set_coord((a-b, a+b), c_uv) # erases all the coordinates except those in the chart c_uv
- sage: p._coordinates
+ sage: P.set_coord((a-b, a+b), c_uv)
+ sage: P._coordinates
{Chart (M, (u, v)): (a - b, a + b)}
- sage: p.coord(c_wz)
+ sage: P.coord(c_wz)
(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)
+ 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)}
@@ -351,8 +369,8 @@ class ManifoldPoint(Element):
else:
# A chart must be found as a starting point of the computation
# The domain's default chart is privileged:
- if def_chart in self._coordinates \
- and (def_chart, chart) in dom._coord_changes:
+ if (def_chart in self._coordinates
+ and (def_chart, chart) in dom._coord_changes):
old_chart = def_chart
s_old_chart = def_chart
s_chart = chart
@@ -401,9 +419,9 @@ class ManifoldPoint(Element):
INPUT:
- ``coords`` -- the point coordinates (as a tuple or a list)
- - ``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
+ - ``chart`` -- (default: ``None``) chart in which the coordinates
+ are given; if none are provided, the coordinates are assumed to
+ refer to the subset's default chart
EXAMPLES:
@@ -412,7 +430,10 @@ class ManifoldPoint(Element):
sage: M = Manifold(2, 'M', structure='topological')
sage: X.<x,y> = M.chart()
sage: p = M.point()
- sage: p.set_coord((2,-3)) # coordinates on the manifold's default chart
+
+ We set the coordinates on the manifold's default chart::
+
+ sage: p.set_coord((2,-3))
sage: p.coord()
(2, -3)
sage: X(p)
@@ -423,8 +444,8 @@ class ManifoldPoint(Element):
sage: Y.<u,v> = M.chart()
sage: X_to_Y = X.transition_map(Y, [x+y, x-y])
- If we set the coordinates of p in the chart Y, those in the chart X
- are lost::
+ If we set the coordinates of ``p`` in the chart ``Y``, those
+ in the chart ``X`` are lost::
sage: Y(p)
(-1, 5)
@@ -446,9 +467,9 @@ class ManifoldPoint(Element):
INPUT:
- ``coords`` -- the point coordinates (as a tuple or a list)
- - ``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
+ - ``chart`` -- (default: ``None``) chart in which the coordinates
+ are given; if none are provided, the coordinates are assumed to
+ refer to the subset's default chart
.. WARNING::
@@ -463,7 +484,10 @@ class ManifoldPoint(Element):
sage: M = Manifold(2, 'M', structure='topological')
sage: X.<x,y> = M.chart()
sage: p = M.point()
- sage: p.add_coord((2,-3)) # coordinates on the manifold's default chart
+
+ We give the point the coordinates on the manifold's default chart::
+
+ sage: p.add_coord((2,-3))
sage: p.coord()
(2, -3)
sage: X(p)
@@ -608,47 +632,30 @@ class ManifoldPoint(Element):
"""
return not (self == other)
- def __cmp__(self, other):
+ def __hash__(self):
r"""
- Old-style (Python 2) comparison operator.
+ Return the hash of ``self``.
- This is provisory, until migration to Python 3 is achieved.
+ This hash function is set to constant on a given manifold, to fulfill
+ Python's credo::
- TESTS::
+ p == q ==> hash(p) == hash(q)
- sage: M = Manifold(2, 'M', structure='topological')
- sage: X.<x,y> = M.chart()
- sage: p = M((2,-3), chart=X)
- sage: q = M((2,-3), chart=X)
- sage: p.__cmp__(q)
- 0
- sage: q = M((0,1), chart=X)
- sage: p.__cmp__(q)
- -1
+ This is necessary since ``p`` and ``q`` may be created in
+ different coordinate systems and nevertheless be equal.
- """
- if self == other:
- return 0
- else:
- return -1
+ .. TODO::
- def __hash__(self):
- r"""
- This hash function is set to constant on a given manifold, to fulfill
- Python's credo:
- p == q ==> hash(p) == hash(q)
- This is necessary since p and q may be created in different coordinate
- systems and nevertheless be equal
+ Find a better hash function.
TESTS::
sage: M = Manifold(2, 'M', structure='topological')
sage: X.<x,y> = M.chart()
sage: p = M((2,-3), chart=X)
- sage: hash(p) # random
- 8791657334475
sage: hash(p) == hash(M)
True
"""
return hash(self.parent().manifold())
+
diff --git a/src/sage/manifolds/structure.py b/src/sage/manifolds/structure.py
index 37349f0..12708d3 100644
--- a/src/sage/manifolds/structure.py
+++ b/src/sage/manifolds/structure.py
@@ -36,7 +36,7 @@ class TopologicalStructure(Singleton):
Return the subcategory of ``cat`` corresponding to the structure
of ``self``.
- EXAMPLE::
+ EXAMPLES::
sage: from sage.manifolds.structure import TopologicalStructure
sage: from sage.categories.manifolds import Manifolds
@@ -58,7 +58,7 @@ class RealTopologicalStructure(Singleton):
Return the subcategory of ``cat`` corresponding to the structure
of ``self``.
- EXAMPLE::
+ EXAMPLES::
sage: from sage.manifolds.structure import RealTopologicalStructure
sage: from sage.categories.manifolds import Manifolds
diff --git a/src/sage/manifolds/subset.py b/src/sage/manifolds/subset.py
index c60f6b1..239138a 100644
--- a/src/sage/manifolds/subset.py
+++ b/src/sage/manifolds/subset.py
@@ -3,9 +3,9 @@ Subsets of Topological Manifolds
The class :class:`ManifoldSubset` implements generic subsets of a
topological manifold. Open subsets are implemented by the class
-:class:`~sage.manifolds.manifold.TopologicalManifold` (since an open subset of
-a manifold is a manifold by itself), which inherits from
-:class:`ManifoldSubset`.
+:class:`~sage.manifolds.manifold.TopologicalManifold` (since an
+open subset of a manifold is a manifold by itself), which inherits
+from :class:`ManifoldSubset`.
AUTHORS:
@@ -95,10 +95,10 @@ class ManifoldSubset(UniqueRepresentation, Parent):
- ``manifold`` -- topological manifold on which the subset is defined
- ``name`` -- string; name (symbol) given to the subset
- - ``latex_name`` -- (default: ``None``) string; LaTeX symbol to denote the
- subset; if none is provided, it is set to ``name``
- - ``category`` -- (default: ``None``) to specify the categeory; if ``None``,
- the category for generic subsets is used
+ - ``latex_name`` -- (default: ``None``) string; LaTeX symbol to
+ denote the subset; if none are provided, it is set to ``name``
+ - ``category`` -- (default: ``None``) to specify the categeory;
+ if ``None``, the category for generic subsets is used
EXAMPLES:
@@ -265,15 +265,16 @@ class ManifoldSubset(UniqueRepresentation, Parent):
- ``coords`` -- (default: ``None``) either (i) the point coordinates
(as a tuple or a list) in the chart ``chart`` or (ii) another point
in the subset
- - ``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
+ - ``chart`` -- (default: ``None``) chart in which the coordinates
+ are given; if none are provided, 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``
- - ``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``.
+ point; if none are provided, 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``
OUTPUT:
@@ -289,7 +290,8 @@ class ManifoldSubset(UniqueRepresentation, Parent):
sage: X(p)
(-2, 3)
- A generic subset has no default chart, so the chart must be explicited::
+ A generic subset has no default chart, so the chart must
+ be explicitly given::
sage: A = M.subset('A')
sage: p = A((-2,3), chart=X); p
@@ -344,8 +346,8 @@ class ManifoldSubset(UniqueRepresentation, Parent):
else:
raise ValueError("the {}".format(point) +
" is not in {}".format(self))
- return self.element_class(self, coords=coords, chart=chart, name=name,
- latex_name=latex_name,
+ return self.element_class(self, coords=coords, chart=chart,
+ name=name, latex_name=latex_name,
check_coords=check_coords)
def _an_element_(self):
@@ -401,7 +403,7 @@ class ManifoldSubset(UniqueRepresentation, Parent):
def lift(self, p):
r"""
- Lift map.
+ Return the lift of ``p`` to the ambient manifold of ``self``.
INPUT:
@@ -411,7 +413,7 @@ class ManifoldSubset(UniqueRepresentation, Parent):
- the same point, considered as a point of the ambient manifold
- EXAMPLE::
+ EXAMPLES::
sage: M = Manifold(2, 'M', structure='topological')
sage: X.<x,y> = M.chart()
@@ -434,7 +436,7 @@ class ManifoldSubset(UniqueRepresentation, Parent):
def retract(self, p):
r"""
- Retraction map.
+ Return the retract of ``p`` to ``self``.
INPUT:
@@ -479,7 +481,7 @@ class ManifoldSubset(UniqueRepresentation, Parent):
def manifold(self):
r"""
- Return the manifold of which the current object is a subset.
+ Return the ambient manifold of ``self``.
EXAMPLES::
@@ -512,7 +514,7 @@ class ManifoldSubset(UniqueRepresentation, Parent):
:class:`~sage.manifolds.manifold.TopologicalManifold`
(which redefines ``is_open``)
- EXAMPLE::
+ EXAMPLES::
sage: M = Manifold(2, 'M', structure='topological')
sage: A = M.subset('A')
@@ -532,14 +534,14 @@ class ManifoldSubset(UniqueRepresentation, Parent):
.. MATH::
- A \subset \bigcup_{i \in I} U_i
+ 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
+ A = \bigcup_{i \in I} U_i.
EXAMPLES::
@@ -571,19 +573,20 @@ class ManifoldSubset(UniqueRepresentation, Parent):
def subsets(self):
r"""
- Return the set of subsets that have been defined on the current subset.
+ 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
- the current subset.
+ - a Python set containing all the subsets that have been defined on
+ the current subset
.. NOTE::
To get the subsets as a list, used the method
:meth:`list_of_subsets` instead.
- EXAMPLE:
+ EXAMPLES:
Subsets of a 2-dimensional manifold::
@@ -619,15 +622,15 @@ class ManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- - A list containing all the subsets that have been defined on
- the current subset.
+ - a list containing all the subsets that have been defined on
+ the current subset
.. NOTE::
To get the subsets as a Python set, used the method
:meth:`subsets` instead.
- EXAMPLE:
+ EXAMPLES:
Subsets of a 2-dimensional manifold::
@@ -666,7 +669,7 @@ class ManifoldSubset(UniqueRepresentation, Parent):
- instance of :class:`~sage.manifolds.subset.ManifoldSubset` (or
of the derived class
:class:`~sage.manifolds.manifold.TopologicalManifold` for an open
- subset) representing the subset whose name is ``name``.
+ subset) representing the subset whose name is ``name``
EXAMPLES::
@@ -702,7 +705,7 @@ class ManifoldSubset(UniqueRepresentation, Parent):
def is_subset(self, other):
r"""
- Return ``True`` iff ``self`` is included in ``other``.
+ Return ``True`` if and only if ``self`` is included in ``other``.
EXAMPLES:
@@ -727,21 +730,23 @@ class ManifoldSubset(UniqueRepresentation, Parent):
def declare_union(self, dom1, dom2):
r"""
- Declare that the current subset is the union of two subsets,
- i.e. that
+ Declare that the current subset is the union of two subsets.
+
+ Suppose `U` is the current subset, then this method declares
+ that `U`
.. MATH::
U = U_1 \cup U_2,
- where `U` is the current subset, `U_1 \subset U` and `U_2 \subset U`.
+ where `U_1 \subset U` and `U_2 \subset U`.
INPUT:
- - ``dom1`` -- subset `U_1`
- - ``dom2`` -- subset `U_2`
+ - ``dom1`` -- the subset `U_1`
+ - ``dom2`` -- the subset `U_2`
- EXAMPLE::
+ EXAMPLES::
sage: M = Manifold(2, 'M', structure='topological')
sage: A = M.subset('A')
@@ -783,9 +788,9 @@ class ManifoldSubset(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``, the coordinates are assumed to refer to
- the default chart of the current subset
+ - ``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``, the LaTeX symbol is set to ``name``
@@ -793,7 +798,7 @@ class ManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- the declared point, as an instance of
- :class:`~sage.manifolds.point.ManifoldPoint`.
+ :class:`~sage.manifolds.point.ManifoldPoint`
EXAMPLES:
@@ -828,8 +833,8 @@ class ManifoldSubset(UniqueRepresentation, Parent):
INPUT:
- ``name`` -- name given to the subset
- - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
- subset; if none is provided, it is set to ``name``
+ - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote
+ the subset; if none are provided, it is set to ``name``
- ``is_open`` -- (default: ``False``) if ``True``, the created subset
is assumed to be open with respect to the manifold's topology
@@ -837,8 +842,8 @@ class ManifoldSubset(UniqueRepresentation, Parent):
- the subset, as an instance of :class:`ManifoldSubset`, or
of the derived class
- :class:`~sage.manifolds.manifold.TopologicalManifold` if ``is_open``
- is ``True``.
+ :class:`~sage.manifolds.manifold.TopologicalManifold`
+ if ``is_open`` is ``True``
EXAMPLES:
@@ -848,7 +853,7 @@ class ManifoldSubset(UniqueRepresentation, Parent):
sage: a = M.subset('A'); a
Subset A of the 2-dimensional topological manifold M
- Creating a subset of A::
+ Creating a subset of ``A``::
sage: b = a.subset('B', latex_name=r'\mathcal{B}'); b
Subset B of the 2-dimensional topological manifold M
@@ -861,8 +866,6 @@ class ManifoldSubset(UniqueRepresentation, Parent):
True
sage: b in a.subsets()
True
-
-
"""
if is_open:
return self.open_subset(name, latex_name=latex_name)
@@ -883,8 +886,8 @@ class ManifoldSubset(UniqueRepresentation, Parent):
INPUT:
- ``name`` -- name given to the superset
- - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
- superset; if none is provided, it is set to ``name``
+ - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote
+ the superset; if none are provided, it is set to ``name``
- ``is_open`` -- (default: ``False``) if ``True``, the created subset
is assumed to be open with respect to the manifold's topology
@@ -892,8 +895,8 @@ class ManifoldSubset(UniqueRepresentation, Parent):
- the superset, as an instance of :class:`ManifoldSubset` or
of the derived class
- :class:`~sage.manifolds.manifold.TopologicalManifold` if ``is_open``
- is ``True``.
+ :class:`~sage.manifolds.manifold.TopologicalManifold`
+ if ``is_open`` is ``True``
EXAMPLES:
@@ -946,8 +949,8 @@ class ManifoldSubset(UniqueRepresentation, Parent):
INPUT:
- ``other`` -- another subset of the same manifold
- - ``name`` -- (default: ``None``) name given to the intersection in the
- case the latter has to be created; the default is
+ - ``name`` -- (default: ``None``) name given to the intersection
+ in the case the latter has to be created; the default is
``self._name`` inter ``other._name``
- ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
intersection in the case the latter has to be created; the default
@@ -998,8 +1001,7 @@ class ManifoldSubset(UniqueRepresentation, Parent):
"""
if other._manifold != self._manifold:
- raise ValueError(
- "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
@@ -1094,8 +1096,7 @@ class ManifoldSubset(UniqueRepresentation, Parent):
"""
if other._manifold != self._manifold:
- raise ValueError(
- "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
@@ -1144,3 +1145,4 @@ class ManifoldSubset(UniqueRepresentation, Parent):
return res
#### End of construction of new sets from self
+