summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-01 17:27:59 +0200
committerEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-01 17:27:59 +0200
commit26c489001c4ee64a95ee70da72210e361180eeb0 (patch)
tree95ea0614f5d82733722f9123f92c601673880976
parentSuppress verbose in TestSuite().run; minor improvements in documentation (diff)
Minor improvements in the doc of topological manifolds (basics part)
-rw-r--r--src/sage/manifolds/chart.py82
-rw-r--r--src/sage/manifolds/manifold.py67
-rw-r--r--src/sage/manifolds/point.py60
-rw-r--r--src/sage/manifolds/subset.py78
4 files changed, 157 insertions, 130 deletions
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index 37836ce..412e970 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -44,9 +44,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`,
@@ -54,7 +54,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 ':':
@@ -71,7 +72,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:
@@ -529,21 +530,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``
@@ -577,8 +579,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) + ' '
@@ -799,8 +801,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`.
@@ -837,7 +839,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:
@@ -1195,8 +1197,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:
@@ -1379,24 +1381,24 @@ class RealChart(Chart):
self._bounds = tuple(bounds)
self._restrictions = new_restrictions
-
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``
@@ -1412,7 +1414,7 @@ class RealChart(Chart):
OUTPUT:
- - chart `(V,\psi)`, as an instance of :class:`Chart`.
+ - chart `(V,\psi)`, as an instance of :class:`RealChart`.
EXAMPLES:
@@ -1445,8 +1447,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) + ' '
@@ -1725,7 +1727,7 @@ class CoordChange(SageObject):
OUTPUT:
- an instance of :class:`CoordChange` representing the inverse of
- ``self``.
+ the current coordinate transformation.
EXAMPLES:
@@ -1760,9 +1762,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':
@@ -1819,7 +1821,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:
@@ -1828,7 +1830,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.
@@ -1917,7 +1919,7 @@ class CoordChange(SageObject):
"{} is different from {}".format(other._chart2,
other._chart1))
#*# when MultiCoordFunction will be implemented (trac #18640):
- # transf = self(*(other._transf.expr()))
+ # transf = self._transf(*(other._transf.expr()))
#*# for now:
transf = self(*(other._transf))
return self.__class__(other._chart1, self._chart2, *transf)
@@ -1950,9 +1952,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)]
#*# when MultiCoordFunction will be implemented (trac #18640):
# return self.__class__(self._chart1.restrict(dom1),
# self._chart2.restrict(dom2), *(self._transf.expr()))
@@ -2015,4 +2026,3 @@ class CoordChange(SageObject):
return FormattedExpansion(rtxt, rlatex)
disp = display
-
diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py
index 989d546..bf5cf8c 100644
--- a/src/sage/manifolds/manifold.py
+++ b/src/sage/manifolds/manifold.py
@@ -310,7 +310,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
@@ -455,7 +455,7 @@ 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)
@@ -889,12 +889,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:
@@ -976,14 +976,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):
@@ -1020,12 +1020,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
@@ -1076,10 +1075,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
@@ -1118,8 +1116,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:
@@ -1127,16 +1125,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
@@ -1145,7 +1143,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
@@ -1168,9 +1166,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))]
@@ -1189,15 +1187,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):
@@ -1247,7 +1260,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:
diff --git a/src/sage/manifolds/point.py b/src/sage/manifolds/point.py
index 997250d..3e4ce31 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/subset.py b/src/sage/manifolds/subset.py
index 781b980..b88e1e5 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)
@@ -260,14 +260,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 +301,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def _an_element_(self):
r"""
- Construct some point in ``self``.
+ Construct some point in the subset.
EXAMPLES::
@@ -320,7 +321,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def _repr_(self):
r"""
- String representation of ``self``.
+ String representation of the object.
TESTS::
@@ -336,7 +337,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
def _latex_(self):
r"""
- LaTeX representation of ``self``.
+ LaTeX representation of the object.
TESTS::
@@ -355,7 +356,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::
@@ -375,12 +376,12 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
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 +426,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- A list containing all the subsets that have been defined on
- ``self``.
+ the current subset.
.. NOTE::
@@ -457,7 +458,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 +509,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 +575,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 +590,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 +633,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 +671,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 +686,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 +729,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
@@ -770,14 +772,14 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
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:
@@ -795,21 +797,21 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
"""
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
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 +833,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 +865,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 +874,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: