summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-29 17:02:58 +0100
committerEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-29 17:02:58 +0100
commitf582241f35ad8d843020580858347d763784715e (patch)
tree9cf364efde88a218d0d8734d9b7f0648a3af0c68
parentImplement topological manifolds (basics, #18529) on the new categories for ma... (diff)
Introduce function Manifold() as the global entry point to construct any type of manifold.
In addition, rename class TopManifold to TopologicalManifold.
-rw-r--r--src/sage/manifolds/all.py2
-rw-r--r--src/sage/manifolds/chart.py116
-rw-r--r--src/sage/manifolds/manifold.py220
-rw-r--r--src/sage/manifolds/point.py48
-rw-r--r--src/sage/manifolds/subset.py115
5 files changed, 296 insertions, 205 deletions
diff --git a/src/sage/manifolds/all.py b/src/sage/manifolds/all.py
index 685bb66..c7defde 100644
--- a/src/sage/manifolds/all.py
+++ b/src/sage/manifolds/all.py
@@ -1,2 +1,2 @@
from sage.misc.lazy_import import lazy_import
-lazy_import('sage.manifolds.manifold', 'TopManifold')
+lazy_import('sage.manifolds.manifold', 'Manifold')
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index e84fc80..fe705df 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -39,7 +39,7 @@ from sage.rings.all import CC
from sage.rings.real_mpfr import RR
from sage.rings.infinity import Infinity
from sage.misc.latex import latex
-from sage.manifolds.manifold import TopManifold
+from sage.manifolds.manifold import TopologicalManifold
class Chart(UniqueRepresentation, SageObject):
r"""
@@ -57,7 +57,7 @@ class Chart(UniqueRepresentation, SageObject):
INPUT:
- ``domain`` -- open subset `U` on which the chart is defined (must be
- an instance of :class:`~sage.manifolds.manifold.TopManifold`)
+ an instance of :class:`~sage.manifolds.manifold.TopologicalManifold`)
- ``coordinates`` -- (default: '' (empty string)) single string defining
the coordinate symbols, with ' ' (whitespace) as a separator; each item
has at most two fields, separated by ':':
@@ -81,7 +81,7 @@ class Chart(UniqueRepresentation, SageObject):
A chart on a complex 2-dimensional topological manifold::
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X = M.chart('x y'); X
Chart (M, (x, y))
sage: latex(X)
@@ -97,8 +97,8 @@ class Chart(UniqueRepresentation, SageObject):
side of the chart declaration (there is then no need to pass the string
``'x y'`` to ``chart()``)::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x,y> = M.chart(); X
Chart (M, (x, y))
@@ -118,8 +118,8 @@ class Chart(UniqueRepresentation, SageObject):
names and do not have to coincide with the coordinate symbols;
for instance, one may write::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x1,y1> = M.chart('x y'); X
Chart (M, (x, y))
@@ -136,8 +136,8 @@ class Chart(UniqueRepresentation, SageObject):
However, having the name of the Python variable coincide with the
coordinate symbol is quite convenient; so it is recommended to declare::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x,y> = M.chart()
In the above example, the chart X covers entirely the manifold M::
@@ -179,7 +179,8 @@ class Chart(UniqueRepresentation, SageObject):
default, it starts at 0, but this can be changed via the parameter
``start_index``::
- sage: M1 = TopManifold(2, 'M_1', field='complex', start_index=1)
+ sage: M1 = Manifold(2, 'M_1', field='complex', type='topological',
+ ....: start_index=1)
sage: Z.<u,v> = M1.chart()
sage: Z[1], Z[2]
(u, v)
@@ -203,7 +204,7 @@ class Chart(UniqueRepresentation, SageObject):
Manifold subsets have a *default chart*, which, unless changed via the
method
- :meth:`~sage.manifolds.manifold.TopManifold.set_default_chart`,
+ :meth:`~sage.manifolds.manifold.TopologicalManifold.set_default_chart`,
is the first defined chart on the subset (or on a open subset of it)::
sage: M.default_chart()
@@ -237,7 +238,7 @@ class Chart(UniqueRepresentation, SageObject):
TESTS::
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x,y> = M.chart()
sage: X
Chart (M, (x, y))
@@ -248,7 +249,7 @@ class Chart(UniqueRepresentation, SageObject):
sage: TestSuite(X).run()
"""
- if not isinstance(domain, TopManifold):
+ if not isinstance(domain, TopologicalManifold):
raise TypeError("the first argument must be an open subset of " +
"a topological manifold")
if coordinates == '':
@@ -314,7 +315,7 @@ class Chart(UniqueRepresentation, SageObject):
TESTS::
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<z1, z2> = M.chart()
sage: X._init_coordinates(['z1', 'z2'])
sage: X
@@ -345,7 +346,7 @@ class Chart(UniqueRepresentation, SageObject):
TESTS::
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x,y> = M.chart()
sage: X._repr_()
'Chart (M, (x, y))'
@@ -363,7 +364,7 @@ class Chart(UniqueRepresentation, SageObject):
TESTS::
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x,y> = M.chart()
sage: X._latex_()
'\\left(M,(x, y)\\right)'
@@ -409,7 +410,7 @@ class Chart(UniqueRepresentation, SageObject):
EXAMPLES::
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x,y> = M.chart()
sage: X[0]
x
@@ -420,7 +421,8 @@ class Chart(UniqueRepresentation, SageObject):
The index range is controlled by the parameter ``start_index``::
- sage: M = TopManifold(2, 'M', field='complex', start_index=1)
+ sage: M = Manifold(2, 'M', field='complex', type='topological',
+ ....: start_index=1)
sage: X.<x,y> = M.chart()
sage: X[1]
x
@@ -449,7 +451,7 @@ class Chart(UniqueRepresentation, SageObject):
EXAMPLES::
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M.point((1+i, 2-i), chart=X)
sage: X(p)
@@ -466,7 +468,7 @@ class Chart(UniqueRepresentation, SageObject):
EXAMPLES::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: X.domain()
2-dimensional topological manifold M
@@ -484,7 +486,7 @@ class Chart(UniqueRepresentation, SageObject):
EXAMPLES::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: U = M.open_subset('U')
sage: X.<x,y> = U.chart()
sage: X.manifold()
@@ -516,7 +518,7 @@ class Chart(UniqueRepresentation, SageObject):
EXAMPLES::
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x,y> = M.chart()
sage: X.add_restrictions(abs(x) > 1)
sage: X.valid_coordinates(2+i, 1)
@@ -545,7 +547,7 @@ class Chart(UniqueRepresentation, SageObject):
INPUT:
- ``subset`` -- open subset `V` of the chart domain `U` (must be an
- instance of :class:`~sage.manifolds.manifold.TopManifold`)
+ instance of :class:`~sage.manifolds.manifold.TopologicalManifold`)
- ``restrictions`` -- (default: ``None``) list of coordinate
restrictions defining the subset `V`.
A restriction can be any symbolic equality or
@@ -570,7 +572,7 @@ class Chart(UniqueRepresentation, SageObject):
Coordinates on the unit open ball of `\CC^2` as a subchart
of the global coordinates of `\CC^2`::
- sage: M = TopManifold(2, 'C^2', field='complex')
+ sage: M = Manifold(2, 'C^2', field='complex', type='topological')
sage: X.<z1, z2> = M.chart()
sage: B = M.open_subset('B')
sage: X_B = X.restrict(B, abs(z1)^2 + abs(z2)^2 < 1); X_B
@@ -621,8 +623,8 @@ class Chart(UniqueRepresentation, SageObject):
EXAMPLE::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M', field='complex')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x,y> = M.chart()
sage: X.add_restrictions([abs(x)<1, y!=0])
sage: X.valid_coordinates(0, i)
@@ -727,7 +729,7 @@ class Chart(UniqueRepresentation, SageObject):
Transition map between two stereographic charts on the circle `S^1`::
- sage: M = TopManifold(1, 'S^1')
+ sage: M = Manifold(1, 'S^1', type='topological')
sage: U = M.open_subset('U') # Complement of the North pole
sage: cU.<x> = U.chart() # Stereographic chart from the North pole
sage: V = M.open_subset('V') # Complement of the South pole
@@ -757,8 +759,8 @@ class Chart(UniqueRepresentation, SageObject):
Transition map between the spherical chart and the Cartesian one on
`\RR^2`::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'R^2')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'R^2', type='topological')
sage: c_cart.<x,y> = M.chart()
sage: U = M.open_subset('U') # the complement of the half line {y=0, x >= 0}
sage: c_spher.<r,phi> = U.chart(r'r:(0,+oo) phi:(0,2*pi):\phi')
@@ -848,7 +850,8 @@ class RealChart(Chart):
Cartesian coordinates on `\RR^3`::
- sage: M = TopManifold(3, 'R^3', r'\RR^3', start_index=1)
+ sage: M = Manifold(3, 'R^3', r'\RR^3', type='topological',
+ ....: start_index=1)
sage: c_cart = M.chart('x y z'); c_cart
Chart (R^3, (x, y, z))
sage: type(c_cart)
@@ -862,8 +865,9 @@ class RealChart(Chart):
side of the chart declaration (there is then no need to pass the string
``'x y z'`` to ``chart()``)::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(3, 'R^3', r'\RR^3', start_index=1)
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(3, 'R^3', r'\RR^3', type='topological',
+ ....: start_index=1)
sage: c_cart.<x,y,z> = M.chart(); c_cart
Chart (R^3, (x, y, z))
@@ -883,7 +887,7 @@ class RealChart(Chart):
names and do not have to coincide with the coordinate symbols; for instance,
one may write::
- sage: M = TopManifold(3, 'R^3', r'\RR^3', start_index=1)
+ sage: M = Manifold(3, 'R^3', r'\RR^3', type='topological', start_index=1)
sage: c_cart.<x1,y1,z1> = M.chart('x y z'); c_cart
Chart (R^3, (x, y, z))
@@ -898,9 +902,9 @@ class RealChart(Chart):
However, having the name of the Python variable coincide with the
coordinate symbol is quite convenient; so it is recommended to declare::
- sage: TopManifold._clear_cache_() # for doctests only
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
sage: forget() # for doctests only
- sage: M = TopManifold(3, 'R^3', r'\RR^3', start_index=1)
+ sage: M = Manifold(3, 'R^3', r'\RR^3', type='topological', start_index=1)
sage: c_cart.<x,y,z> = M.chart()
Spherical coordinates on the subset `U` of `\RR^3` that is the
@@ -972,7 +976,7 @@ class RealChart(Chart):
Manifold subsets have a *default chart*, which, unless changed via the
method
- :meth:`~sage.manifolds.manifold.TopManifold.set_default_chart`,
+ :meth:`~sage.manifolds.manifold.TopologicalManifold.set_default_chart`,
is the first defined chart on the subset (or on a open subset of it)::
sage: M.default_chart()
@@ -1031,7 +1035,7 @@ class RealChart(Chart):
TESTS::
sage: forget() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: X
Chart (M, (x, y))
@@ -1060,7 +1064,7 @@ class RealChart(Chart):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: X._init_coordinates(['x', 'y'])
sage: X
@@ -1157,8 +1161,8 @@ class RealChart(Chart):
Some coordinate bounds on a 2-dimensional manifold::
sage: forget() # for doctests only
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: c_xy.<x,y> = M.chart('x y:[0,1)')
sage: c_xy.coord_bounds(0) # x in (-oo,+oo) (the default)
((-Infinity, False), (+Infinity, False))
@@ -1206,7 +1210,7 @@ class RealChart(Chart):
Ranges of coordinates on a 2-dimensional manifold::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: X.coord_range()
x: (-oo, +oo); y: (-oo, +oo)
@@ -1298,8 +1302,8 @@ class RealChart(Chart):
Cartesian coordinates on the open unit disc in $\RR^2$::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M') # the open unit disc
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological') # the open unit disc
sage: X.<x,y> = M.chart()
sage: X.add_restrictions(x^2+y^2<1)
sage: X.valid_coordinates(0,2)
@@ -1398,7 +1402,7 @@ class RealChart(Chart):
INPUT:
- ``subset`` -- open subset `V` of the chart domain `U` (must be an
- instance of :class:`~sage.manifolds.manifold.TopManifold`)
+ instance of :class:`~sage.manifolds.manifold.TopologicalManifold`)
- ``restrictions`` -- (default: ``None``) list of coordinate
restrictions defining the subset `V`.
A restriction can be any symbolic equality or
@@ -1423,7 +1427,7 @@ class RealChart(Chart):
Cartesian coordinates on the unit open disc in `\RR^2` as a subchart
of the global Cartesian coordinates::
- sage: M = TopManifold(2, 'R^2')
+ sage: M = Manifold(2, 'R^2', type='topological')
sage: c_cart.<x,y> = M.chart() # Cartesian coordinates on R^2
sage: D = M.open_subset('D') # the unit open disc
sage: c_cart_D = c_cart.restrict(D, x^2+y^2<1)
@@ -1494,7 +1498,7 @@ class RealChart(Chart):
Cartesian coordinates on a square interior::
sage: forget() # for doctest only
- sage: M = TopManifold(2, 'M') # the square interior
+ sage: M = Manifold(2, 'M', type='topological') # the square interior
sage: X.<x,y> = M.chart('x:(-2,2) y:(-2,2)')
sage: X.valid_coordinates(0,1)
True
@@ -1600,7 +1604,7 @@ class CoordChange(SageObject):
Transition map on a 2-dimensional topological manifold::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: Y.<u,v> = M.chart()
sage: X_to_Y = X.transition_map(Y, [x+y, x-y])
@@ -1619,7 +1623,7 @@ class CoordChange(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: Y.<u,v> = M.chart()
sage: X_to_Y = X.transition_map(Y, [x+y, x-y])
@@ -1659,7 +1663,7 @@ class CoordChange(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: Y.<u,v> = M.chart()
sage: X_to_Y = X.transition_map(Y, [x+y, x-y])
@@ -1680,7 +1684,7 @@ class CoordChange(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: Y.<u,v> = M.chart()
sage: X_to_Y = X.transition_map(Y, [x+y, x-y])
@@ -1706,7 +1710,7 @@ class CoordChange(SageObject):
EXAMPLE::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: Y.<u,v> = M.chart()
sage: X_to_Y = X.transition_map(Y, [x+y, x-y])
@@ -1736,7 +1740,7 @@ class CoordChange(SageObject):
Inverse of a coordinate transformation corresponding to a pi/3-rotation
in the plane::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: c_xy.<x,y> = M.chart()
sage: c_uv.<u,v> = M.chart()
sage: xy_to_uv = c_xy.transition_map(c_uv, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2))
@@ -1840,7 +1844,7 @@ class CoordChange(SageObject):
From spherical coordinates to Cartesian ones in the plane::
- sage: M = TopManifold(2, 'R^2')
+ sage: M = Manifold(2, 'R^2', type='topological')
sage: U = M.open_subset('U') # the complement of the half line {y=0, x>= 0}
sage: c_cart.<x,y> = U.chart()
sage: c_spher.<r,ph> = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi')
@@ -1901,7 +1905,7 @@ class CoordChange(SageObject):
EXAMPLE::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: U.<u,v> = M.chart()
sage: X_to_U = X.transition_map(U, (x+y, x-y))
@@ -1943,7 +1947,7 @@ class CoordChange(SageObject):
EXAMPLE::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: Y.<u,v> = M.chart()
sage: X_to_Y = X.transition_map(Y, [x+y, x-y])
@@ -1984,7 +1988,7 @@ class CoordChange(SageObject):
From spherical coordinates to Cartesian ones in the plane::
- sage: M = TopManifold(2, 'R^2')
+ sage: M = Manifold(2, 'R^2', type='topological')
sage: U = M.open_subset('U') # the complement of the half line {y=0, x>= 0}
sage: c_cart.<x,y> = U.chart()
sage: c_spher.<r,ph> = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi')
diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py
index 73edb1d..c67d6ba 100644
--- a/src/sage/manifolds/manifold.py
+++ b/src/sage/manifolds/manifold.py
@@ -9,26 +9,27 @@ dimension* `n` *over K* is a topological space `M` such that
- `M` is second countable,
- every point in `M` has a neighborhood homeomorphic to `K^n`
-Topological manifolds are implemented via the class :class:`TopManifold`.
+Topological manifolds are implemented via the class :class:`TopologicalManifold`.
Open subsets of topological manifolds are also implemented via
-:class:`TopManifold`, since they are topological manifolds by themselves.
+:class:`TopologicalManifold`, since they are topological manifolds by themselves.
In the current setting, topological manifolds are mostly described by means of
charts (see :class:`~sage.manifolds.chart.Chart`).
-:class:`TopManifold` serves as a base class for more specific manifold classes.
+:class:`TopologicalManifold` serves as a base class for more specific manifold
+classes.
.. RUBRIC:: Example 1: the 2-sphere as a topological manifold of dimension
2 over `\RR`
One starts by declaring `S^2` as a 2-dimensional topological manifold::
- sage: M = TopManifold(2, 'S^2')
+ sage: M = Manifold(2, 'S^2', type='topological')
sage: M
2-dimensional topological manifold S^2
Since the base topological field has not been specified in the argument list
-of ``TopManifold``, `\RR` is assumed::
+of ``Manifold``, `\RR` is assumed::
sage: M.base_field()
Real Field with 53 bits of precision
@@ -167,7 +168,7 @@ Similarly::
We declare the Riemann sphere `\CC^*` as a 1-dimensional topological manifold
over `\CC`::
- sage: M = TopManifold(1, 'C*', field='complex'); M
+ sage: M = Manifold(1, 'C*', type='topological', field='complex'); M
Complex 1-dimensional topological manifold C*
We introduce a first open subset, which is actually
@@ -276,9 +277,9 @@ from sage.categories.fields import Fields
from sage.categories.manifolds import Manifolds
from sage.rings.all import CC
from sage.rings.real_mpfr import RR
-from sage.manifolds.subset import TopManifoldSubset
+from sage.manifolds.subset import TopologicalManifoldSubset
-class TopManifold(TopManifoldSubset):
+class TopologicalManifold(TopologicalManifoldSubset):
r"""
Topological manifold over a topological field `K`.
@@ -291,7 +292,7 @@ class TopManifold(TopManifoldSubset):
- every point in `M` has a neighborhood homeomorphic to `K^n`
This is a Sage *parent* class, the corresponding *element*
- class being :class:`~sage.manifolds.point.TopManifoldPoint`.
+ class being :class:`~sage.manifolds.point.TopologicalManifoldPoint`.
INPUT:
@@ -323,11 +324,13 @@ class TopManifold(TopManifoldSubset):
A 4-dimensional topological manifold (over `\RR`)::
- sage: M = TopManifold(4, 'M', latex_name=r'\mathcal{M}')
+ sage: M = Manifold(4, 'M', latex_name=r'\mathcal{M}', type='topological')
sage: M
4-dimensional topological manifold M
sage: latex(M)
\mathcal{M}
+ sage: type(M)
+ <class 'sage.manifolds.manifold.TopologicalManifold_with_category'>
sage: M.base_field()
Real Field with 53 bits of precision
sage: dim(M)
@@ -336,28 +339,28 @@ class TopManifold(TopManifoldSubset):
The input parameter ``start_index`` defines the range of indices on the
manifold::
- sage: M = TopManifold(4, 'M')
+ sage: M = Manifold(4, 'M', type='topological')
sage: list(M.irange())
[0, 1, 2, 3]
- sage: M = TopManifold(4, 'M', start_index=1)
+ sage: M = Manifold(4, 'M', type='topological', start_index=1)
sage: list(M.irange())
[1, 2, 3, 4]
- sage: list(TopManifold(4, 'M', start_index=-2).irange())
+ sage: list(Manifold(4, 'M', type='topological', start_index=-2).irange())
[-2, -1, 0, 1]
A complex manifold::
- sage: N = TopManifold(3, 'N', field='complex'); N
+ sage: N = Manifold(3, 'N', type='topological', field='complex'); N
Complex 3-dimensional topological manifold N
A manifold over `\QQ`::
- sage: N = TopManifold(6, 'N', field=QQ); N
+ sage: N = Manifold(6, 'N', type='topological', field=QQ); N
6-dimensional topological manifold N over the Rational Field
A manifold over `\QQ_5`, the field of 5-adic numbers::
- sage: N = TopManifold(2, 'N', field=Qp(5)); N
+ sage: N = Manifold(2, 'N', type='topological', field=Qp(5)); N
2-dimensional topological manifold N over the 5-adic Field with capped
relative precision 20
@@ -392,27 +395,28 @@ class TopManifold(TopManifoldSubset):
True
The manifold's points are instances of class
- :class:`~sage.manifolds.point.TopManifoldPoint`::
+ :class:`~sage.manifolds.point.TopologicalManifoldPoint`::
- sage: isinstance(p, sage.manifolds.point.TopManifoldPoint)
+ sage: isinstance(p, sage.manifolds.point.TopologicalManifoldPoint)
True
Manifolds are unique, as long as they are created with the same arguments::
- sage: M is TopManifold(4, 'M', start_index=1)
+ sage: M is Manifold(4, 'M', type='topological', start_index=1)
True
- sage: M is TopManifold(4, 'M')
+ sage: M is Manifold(4, 'M', type='topological')
False
- sage: M is TopManifold(4, 'M', latex_name='M', start_index=1)
+ sage: M is Manifold(4, 'M', latex_name='M', type='topological',
+ ....: start_index=1)
False
Since an open subset of a topological manifold `M` is itself a topological
manifold, open subsets of `M` are instances of the class
- :class:`TopManifold`::
+ :class:`TopologicalManifold`::
sage: U = M.open_subset('U'); U
Open subset U of the 4-dimensional topological manifold M
- sage: isinstance(U, sage.manifolds.manifold.TopManifold)
+ sage: isinstance(U, sage.manifolds.manifold.TopologicalManifold)
True
sage: U.base_field() == M.base_field()
True
@@ -432,7 +436,8 @@ class TopManifold(TopManifoldSubset):
TESTS::
- sage: M = TopManifold(3, 'M', latex_name=r'\mathbb{M}', start_index=1)
+ sage: M = Manifold(3, 'M', latex_name=r'\mathbb{M}',
+ ....: type='topological', start_index=1)
sage: M
3-dimensional topological manifold M
sage: latex(M)
@@ -466,11 +471,11 @@ class TopManifold(TopManifoldSubset):
category = Manifolds(self._field)
if ambient_manifold is None:
ambient_manifold = self
- elif not isinstance(ambient_manifold, TopManifold):
+ elif not isinstance(ambient_manifold, TopologicalManifold):
raise TypeError("the argument 'ambient_manifold' must be " +
"a topological manifold")
# Initialization as a subset of the ambient manifold (possibly itself):
- TopManifoldSubset.__init__(self, ambient_manifold, name,
+ TopologicalManifoldSubset.__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
@@ -489,17 +494,17 @@ class TopManifold(TopManifoldSubset):
TESTS::
- sage: M = TopManifold(3, 'M')
+ sage: M = Manifold(3, 'M', type='topological')
sage: M._repr_()
'3-dimensional topological manifold M'
sage: repr(M) # indirect doctest
'3-dimensional topological manifold M'
sage: M # indirect doctest
3-dimensional topological manifold M
- sage: M = TopManifold(3, 'M', field='complex')
+ sage: M = Manifold(3, 'M', type='topological', field='complex')
sage: M._repr_()
'Complex 3-dimensional topological manifold M'
- sage: M = TopManifold(3, 'M', field=QQ)
+ sage: M = Manifold(3, 'M', type='topological', field=QQ)
sage: M._repr_()
'3-dimensional topological manifold M over the Rational Field'
@@ -530,12 +535,13 @@ class TopManifold(TopManifoldSubset):
TESTS::
- sage: M = TopManifold(3, 'M')
+ sage: M = Manifold(3, 'M', type='topological')
sage: M._latex_()
'M'
sage: latex(M)
M
- sage: M = TopManifold(3, 'M', latex_name=r'\mathcal{M}')
+ sage: M = Manifold(3, 'M', latex_name=r'\mathcal{M}',
+ ....: type='topological')
sage: M._latex_()
'\\mathcal{M}'
sage: latex(M)
@@ -550,7 +556,7 @@ class TopManifold(TopManifoldSubset):
EXAMPLES::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M._an_element_(); p
Point on the 2-dimensional topological manifold M
@@ -647,7 +653,7 @@ class TopManifold(TopManifoldSubset):
EXAMPLES::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M.point((1,2), chart=X)
sage: M.__contains__(p)
@@ -688,7 +694,7 @@ class TopManifold(TopManifoldSubset):
EXAMPLE::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: M.dimension()
2
@@ -717,13 +723,13 @@ class TopManifold(TopManifoldSubset):
EXAMPLES::
- sage: M = TopManifold(3, 'M')
+ sage: M = Manifold(3, 'M', type='topological')
sage: M.base_field()
Real Field with 53 bits of precision
- sage: M = TopManifold(3, 'M', field='complex')
+ sage: M = Manifold(3, 'M', type='topological', field='complex')
sage: M.base_field()
Complex Field with 53 bits of precision
- sage: M = TopManifold(3, 'M', field=QQ)
+ sage: M = Manifold(3, 'M', type='topological', field=QQ)
sage: M.base_field()
Rational Field
@@ -745,10 +751,10 @@ class TopManifold(TopManifoldSubset):
EXAMPLES::
- sage: M = TopManifold(3, 'M')
+ sage: M = Manifold(3, 'M', type='topological')
sage: M.start_index()
0
- sage: M = TopManifold(3, 'M', start_index=1)
+ sage: M = Manifold(3, 'M', type='topological', start_index=1)
sage: M.start_index()
1
@@ -774,7 +780,7 @@ class TopManifold(TopManifoldSubset):
Index range on a 4-dimensional manifold::
- sage: M = TopManifold(4, 'M')
+ sage: M = Manifold(4, 'M', type='topological')
sage: for i in M.irange():
....: print i,
....:
@@ -788,7 +794,7 @@ class TopManifold(TopManifoldSubset):
Index range on a 4-dimensional manifold with starting index=1::
- sage: M = TopManifold(4, 'M', start_index=1)
+ sage: M = Manifold(4, 'M', type='topological', start_index=1)
sage: for i in M.irange():
....: print i,
....:
@@ -831,7 +837,7 @@ class TopManifold(TopManifoldSubset):
Indices on a 2-dimensional manifold::
- sage: M = TopManifold(2, 'M', start_index=1)
+ sage: M = Manifold(2, 'M', type='topological', start_index=1)
sage: for ind in M.index_generator(2):
....: print ind
....:
@@ -881,7 +887,7 @@ class TopManifold(TopManifoldSubset):
Charts on subsets of `\RR^2`::
- sage: M = TopManifold(2, 'R^2')
+ sage: M = Manifold(2, 'R^2', type='topological')
sage: c_cart.<x,y> = M.chart() # Cartesian coordinates on R^2
sage: M.atlas()
[Chart (R^2, (x, y))]
@@ -913,8 +919,8 @@ class TopManifold(TopManifoldSubset):
Charts on a 2-dimensional manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: U = M.open_subset('U', coord_def={X: x>0})
sage: Y.<u,v> = U.chart()
@@ -946,8 +952,8 @@ class TopManifold(TopManifoldSubset):
Default chart on a 2-dimensional manifold and on some subsets::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: M.chart('x y')
Chart (M, (x, y))
sage: M.chart('u v')
@@ -975,8 +981,8 @@ class TopManifold(TopManifoldSubset):
Charts on a 2-dimensional manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: c_xy.<x,y> = M.chart()
sage: c_uv.<u,v> = M.chart()
sage: M.default_chart()
@@ -1021,8 +1027,8 @@ class TopManifold(TopManifoldSubset):
Change of coordinates on a 2-dimensional manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: c_xy.<x,y> = M.chart()
sage: c_uv.<u,v> = M.chart()
sage: c_xy.transition_map(c_uv, (x+y, x-y)) # defines the coordinate change
@@ -1050,8 +1056,8 @@ class TopManifold(TopManifoldSubset):
Various changes of coordinates on a 2-dimensional manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: c_xy.<x,y> = M.chart()
sage: c_uv.<u,v> = M.chart()
sage: xy_to_uv = c_xy.transition_map(c_uv, [x+y, x-y])
@@ -1097,8 +1103,8 @@ class TopManifold(TopManifoldSubset):
EXAMPLES::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: U = M.open_subset('U')
sage: X.<x,y> = U.chart()
sage: U.is_manifestly_coordinate_domain()
@@ -1119,7 +1125,7 @@ class TopManifold(TopManifoldSubset):
An open subset is a set that is (i) included in the manifold and (ii)
open with respect to the manifold's topology. It is a topological
manifold by itself. Hence the returned object is an instance of
- :class:`TopManifold`.
+ :class:`TopologicalManifold`.
INPUT:
@@ -1133,14 +1139,14 @@ class TopManifold(TopManifoldSubset):
OUTPUT:
- - the open subset, as an instance of :class:`TopManifold`.
+ - the open subset, as an instance of :class:`TopologicalManifold`.
EXAMPLES:
Creating an open subset of a 2-dimensional manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: A = M.open_subset('A'); A
Open subset A of the 2-dimensional topological manifold M
@@ -1148,7 +1154,7 @@ class TopManifold(TopManifoldSubset):
topological manifold, on the same topological field and of the same
dimension as ``M``::
- sage: isinstance(A, sage.manifolds.manifold.TopManifold)
+ sage: isinstance(A, sage.manifolds.manifold.TopologicalManifold)
True
sage: A.base_field() == M.base_field()
True
@@ -1173,7 +1179,7 @@ class TopManifold(TopManifoldSubset):
Defining an open subset by some coordinate restrictions: the open
unit disk in `\RR^2`::
- sage: M = TopManifold(2, 'R^2')
+ sage: M = Manifold(2, 'R^2', type='topological')
sage: c_cart.<x,y> = M.chart() # Cartesian coordinates on R^2
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
@@ -1195,12 +1201,12 @@ class TopManifold(TopManifoldSubset):
False
"""
- resu = TopManifold(self._dim, name, latex_name=latex_name,
+ resu = TopologicalManifold(self._dim, name, latex_name=latex_name,
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(...)
+ # resu = type(self).__base__(...) instead of resu = TopologicalManifold(...)
# to allow for open_subset() of derived classes to call first this
# version,
# but, because of the category framework, it could NOT have been
@@ -1285,8 +1291,8 @@ class TopManifold(TopManifoldSubset):
Chart on a 2-dimensional manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: U = M.open_subset('U')
sage: X = U.chart('x y'); X
Chart (U, (x, y))
@@ -1316,8 +1322,8 @@ class TopManifold(TopManifoldSubset):
left-hand side of the chart declaration (there is then no need to
pass the string 'x y' to chart())::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: U = M.open_subset('U')
sage: X.<x,y> = U.chart(); X
Chart (U, (x, y))
@@ -1342,3 +1348,83 @@ class TopManifold(TopManifoldSubset):
if self._field == RR:
return RealChart(self, coordinates=coordinates, names=names)
return Chart(self, coordinates=coordinates, names=names)
+
+
+def Manifold(dim, name, latex_name=None, field='real', type='smooth',
+ start_index=0, **extra_kwds):
+ r"""
+ Construct a manifold of a given type over a topological field `K`.
+
+ 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``
+ - ``field`` -- (default: ``'real'``) field `K` on which the manifold is
+ defined; allowed values are
+
+ - ``'real'`` or ``RR`` for a manifold over `\RR`
+ - ``'complex'`` or ``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`)
+ for other types of manifolds
+
+ - ``type`` -- (default: ``'smooth'``) to specify the type of manifold;
+ allowed values are
+
+ - ``'topological'`` or ``'top'`` for a topological manifold
+ - ``'differentiable'`` or ``'diff'`` for a differentiable manifold
+ - ``'smooth'`` for a smooth manifold
+ - ``'analytic'`` for an analytic manifold
+
+ - ``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 for 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.
+
+ EXAMPLES:
+
+ A 3-dimensional real topological manifold::
+
+ sage: M = Manifold(3, 'M', type='topological'); M
+ 3-dimensional topological manifold M
+
+ Given the default value of the parameter ``field``, the above is equivalent
+ to::
+
+ sage: M = Manifold(3, 'M', type='topological', field='real'); M
+ 3-dimensional topological manifold M
+
+ A complex topological manifold::
+
+ sage: M = Manifold(3, 'M', type='topological', field='complex'); M
+ Complex 3-dimensional topological manifold M
+
+ A topological manifold over `\QQ`::
+
+ sage: M = Manifold(3, 'M', type='topological', field=QQ); M
+ 3-dimensional topological manifold M over the Rational Field
+
+ A manifold has a unique representation::
+
+ sage: M is Manifold(3, 'M', type='topological', field=QQ)
+ True
+
+ See the documentation of class
+ :class:`~sage.manifolds.manifold.TopologicalManifold` for more examples.
+
+ """
+ type_ = type # in case the built-in function type is to be restored...
+ if type_ in ['topological', 'top']:
+ return TopologicalManifold(dim, name, latex_name=latex_name,
+ field=field, start_index=start_index)
+ raise NotImplementedError("manifolds of type {} are not ".format(type_) +
+ "implemented")
diff --git a/src/sage/manifolds/point.py b/src/sage/manifolds/point.py
index 3e4ce31..078c737 100644
--- a/src/sage/manifolds/point.py
+++ b/src/sage/manifolds/point.py
@@ -1,9 +1,9 @@
r"""
Points of topological manifolds
-The class :class:`TopManifoldPoint` implements points of a
+The class :class:`TopologicalManifoldPoint` implements points of a
topological manifold.
-A :class:`TopManifoldPoint` object can have coordinates in
+A :class:`TopologicalManifoldPoint` 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.
@@ -22,7 +22,7 @@ EXAMPLES:
Defining a point in `\RR^3` by its spherical coordinates::
- sage: M = TopManifold(3, 'R^3')
+ sage: M = Manifold(3, 'R^3', type='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)
@@ -70,12 +70,12 @@ Points can be compared::
from sage.structure.element import Element
-class TopManifoldPoint(Element):
+class TopologicalManifoldPoint(Element):
r"""
Point of a topological manifold.
This is a Sage *element* class, the corresponding *parent* class being
- :class:`~sage.manifolds.manifold.TopManifold`.
+ :class:`~sage.manifolds.manifold.TopologicalManifold`.
INPUT:
@@ -97,7 +97,7 @@ class TopManifoldPoint(Element):
A point on a 2-dimensional manifold::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='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'); p
@@ -154,8 +154,8 @@ class TopManifoldPoint(Element):
TESTS::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M((2,3), name='p'); p
Point p on the 2-dimensional topological manifold M
@@ -203,7 +203,7 @@ class TopManifoldPoint(Element):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M((2,-3))
sage: p._repr_()
@@ -227,7 +227,7 @@ class TopManifoldPoint(Element):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M((2,-3))
sage: p._latex_()
@@ -257,14 +257,14 @@ class TopManifoldPoint(Element):
OUTPUT:
- an instance of
- :class:`~sage.manifolds.subset.TopManifoldSubset`
+ :class:`~sage.manifolds.subset.TopologicalManifoldSubset`
EXAMPLES:
Points on a 2-dimensional manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M.point((1,3), name='p'); p
Point p on the 2-dimensional topological manifold M
@@ -314,8 +314,8 @@ class TopManifoldPoint(Element):
Spherical coordinates of a point on `\RR^3`::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(3, 'M') # the part of R^3 covered by spherical coordinates
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(3, 'M', type='topological') # the part of R^3 covered by spherical coordinates
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
@@ -342,8 +342,8 @@ class TopManifoldPoint(Element):
Coordinates of a point on a 2-dimensional manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='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')
@@ -462,7 +462,7 @@ class TopManifoldPoint(Element):
Setting coordinates to a point on a 2-dimensional manifold::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M.point()
sage: p.set_coord((2,-3)) # coordinates on the manifold's default chart
@@ -513,7 +513,7 @@ class TopManifoldPoint(Element):
Setting coordinates to a point on a 2-dimensional manifold::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M.point()
sage: p.add_coord((2,-3)) # coordinates on the manifold's default chart
@@ -561,7 +561,7 @@ class TopManifoldPoint(Element):
Comparison with coordinates in the same chart::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M((2,-3), chart=X)
sage: q = M((2,-3), chart=X)
@@ -596,7 +596,7 @@ class TopManifoldPoint(Element):
False
"""
- if not isinstance(other, TopManifoldPoint):
+ if not isinstance(other, TopologicalManifoldPoint):
return False
if other._manifold != self._manifold:
return False
@@ -644,7 +644,7 @@ class TopManifoldPoint(Element):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M((2,-3), chart=X)
sage: q = M((0,1), chart=X)
@@ -664,7 +664,7 @@ class TopManifoldPoint(Element):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M((2,-3), chart=X)
sage: q = M((2,-3), chart=X)
@@ -690,7 +690,7 @@ class TopManifoldPoint(Element):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M((2,-3), chart=X)
sage: p.__hash__() # random
diff --git a/src/sage/manifolds/subset.py b/src/sage/manifolds/subset.py
index d488883..98b83a1 100644
--- a/src/sage/manifolds/subset.py
+++ b/src/sage/manifolds/subset.py
@@ -1,11 +1,11 @@
r"""
Subsets of topological manifolds
-The class :class:`TopManifoldSubset` implements generic subsets of a
+The class :class:`TopologicalManifoldSubset` 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
+:class:`~sage.manifolds.manifold.TopologicalManifold` (since an open subset of a
manifold is a manifold by itself), which inherits from
-:class:`TopManifoldSubset`.
+:class:`TopologicalManifoldSubset`.
AUTHORS:
@@ -20,7 +20,7 @@ EXAMPLES:
Two subsets on a manifold::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: a = M.subset('A'); a
Subset A of the 2-dimensional topological manifold M
sage: b = M.subset('B'); b
@@ -71,27 +71,28 @@ Lists of subsets after the above operations::
#*****************************************************************************
from sage.structure.parent import Parent
+from sage.misc.fast_methods import WithEqualityById
from sage.structure.unique_representation import UniqueRepresentation
from sage.categories.sets_cat import Sets
from sage.categories.homset import Hom
from sage.rings.infinity import Infinity
-from sage.manifolds.point import TopManifoldPoint
+from sage.manifolds.point import TopologicalManifoldPoint
-class TopManifoldSubset(UniqueRepresentation, Parent):
+class TopologicalManifoldSubset(UniqueRepresentation, Parent):
r"""
Subset of a topological manifold.
- The class :class:`TopManifoldSubset` inherits from the generic Sage class
+ The class :class:`TopologicalManifoldSubset` inherits from the generic Sage class
:class:`~sage.structure.parent.Parent` and is declared to belong to
the category of facade sets
(see :meth:`~sage.categories.sets_cat.Sets.SubcategoryMethods.Facade`).
The corresponding element class is
- :class:`~sage.manifolds.point.TopManifoldPoint`. A subset acts
+ :class:`~sage.manifolds.point.TopologicalManifoldPoint`. A subset acts
as a facade for the true parent of its points, which is the whole manifold
(see example below).
Note that open subsets are not implemented directly by this class, but
- by the derived class :class:`~sage.manifolds.manifold.TopManifold` (an
+ by the derived class :class:`~sage.manifolds.manifold.TopologicalManifold` (an
open subset of a topological manifold being itself a topological manifold).
INPUT:
@@ -107,17 +108,17 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
A subset of a manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
- sage: from sage.manifolds.subset import TopManifoldSubset
- sage: A = TopManifoldSubset(M, 'A', latex_name=r'\mathcal{A}'); A
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
+ sage: from sage.manifolds.subset import TopologicalManifoldSubset
+ sage: A = TopologicalManifoldSubset(M, 'A', latex_name=r'\mathcal{A}'); A
Subset A of the 2-dimensional topological manifold M
sage: latex(A)
\mathcal{A}
sage: A.is_subset(M)
True
- Instead of importing :class:`TopManifoldSubset` in the global namespace,
+ Instead of importing :class:`TopologicalManifoldSubset` in the global namespace,
it is recommended to use the method :meth:`subset` to create a new subset::
sage: B = M.subset('B', latex_name=r'\mathcal{B}'); B
@@ -129,13 +130,13 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
The manifold is itself a subset::
- sage: isinstance(M, TopManifoldSubset)
+ sage: isinstance(M, TopologicalManifoldSubset)
True
- Instances of :class:`TopManifoldSubset` are Sage's facade sets
+ Instances of :class:`TopologicalManifoldSubset` are Sage's facade sets
(see :meth:`~sage.categories.sets_cat.Sets.SubcategoryMethods.Facade`):
their elements are manifold points
- (class :class:`~sage.manifolds.point.TopManifoldPoint`),
+ (class :class:`~sage.manifolds.point.TopologicalManifoldPoint`),
which have the manifold (and not the subset) as parent::
sage: isinstance(A, Parent)
@@ -155,7 +156,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
"""
- Element = TopManifoldPoint
+ Element = TopologicalManifoldPoint
def __init__(self, manifold, name, latex_name=None, category=None):
r"""
@@ -163,8 +164,8 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
TESTS::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: A = M.subset('A'); A
Subset A of the 2-dimensional topological manifold M
@@ -232,12 +233,12 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- - an instance of :class:`~sage.manifolds.point.TopManifoldPoint`
+ - an instance of :class:`~sage.manifolds.point.TopologicalManifoldPoint`
representing a point in the current subset.
EXAMPLES::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: p = M._element_constructor_(); p
Point on the 2-dimensional topological manifold M
@@ -288,7 +289,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
(-2, 3)
"""
- if isinstance(coords, TopManifoldPoint):
+ if isinstance(coords, TopologicalManifoldPoint):
point = coords # for readability
if point._subset is self:
return point
@@ -310,7 +311,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
EXAMPLES::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: A = M.subset('A')
sage: p = A._an_element_(); p
@@ -330,7 +331,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: A = M.subset('A')
sage: A._repr_()
'Subset A of the 2-dimensional topological manifold M'
@@ -346,7 +347,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: A = M.subset('A')
sage: A._latex_()
'A'
@@ -365,8 +366,8 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
EXAMPLES::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: A = M.subset('A')
sage: A.manifold()
2-dimensional topological manifold M
@@ -400,8 +401,8 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
EXAMPLES::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: M.open_covers()
[[2-dimensional topological manifold M]]
sage: U = M.open_subset('U')
@@ -445,8 +446,8 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
Subsets of a 2-dimensional manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: U = M.open_subset('U')
sage: V = M.subset('V')
sage: M.subsets() # random (set output)
@@ -490,8 +491,8 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
Subsets of a 2-dimensional manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: U = M.open_subset('U')
sage: V = M.subset('V')
sage: M.list_of_subsets()
@@ -523,15 +524,15 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- - the subset, as an instance of :class:`TopManifoldSubset`, or of
- the derived class :class:`TopManifold` if ``is_open`` is ``True``.
+ - the subset, as an instance of :class:`TopologicalManifoldSubset`, or of
+ the derived class :class:`TopologicalManifold` if ``is_open`` is ``True``.
EXAMPLES:
Creating a subset of a manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: a = M.subset('A'); a
Subset A of the 2-dimensional topological manifold M
@@ -553,7 +554,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
"""
if is_open:
return self.open_subset(name, latex_name=latex_name)
- res = TopManifoldSubset(self._manifold, name, latex_name=latex_name)
+ res = TopologicalManifoldSubset(self._manifold, name, latex_name=latex_name)
res._supersets.update(self._supersets)
for sd in self._supersets:
sd._subsets.add(res)
@@ -577,15 +578,15 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- - the superset, as an instance of :class:`TopManifoldSubset` or of
- the derived class :class:`TopManifold` if ``is_open`` is ``True``.
+ - the superset, as an instance of :class:`TopologicalManifoldSubset` or of
+ the derived class :class:`TopologicalManifold` if ``is_open`` is ``True``.
EXAMPLES:
Creating some superset of a given subset::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: a = M.subset('A')
sage: b = a.superset('B'); b
Subset B of the 2-dimensional topological manifold M
@@ -614,7 +615,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
if is_open:
res = self._manifold.open_subset(name, latex_name=latex_name)
else:
- res = TopManifoldSubset(self._manifold, name,
+ res = TopologicalManifoldSubset(self._manifold, name,
latex_name=latex_name)
res._subsets.update(self._subsets)
for sd in self._subsets:
@@ -642,15 +643,15 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- - instance of :class:`TopManifoldSubset` representing the subset that
+ - instance of :class:`TopologicalManifoldSubset` representing the subset that
is the intersection of the current subset with ``other``
EXAMPLES:
Intersection of two subsets::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: a = M.subset('A')
sage: b = M.subset('B')
sage: c = a.intersection(b); c
@@ -738,14 +739,14 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- - instance of :class:`TopManifoldSubset` representing the subset that
+ - instance of :class:`TopologicalManifoldSubset` representing the subset that
is the union of the current subset with ``other``
EXAMPLES:
Union of two subsets::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: a = M.subset('A')
sage: b = M.subset('B')
sage: c = a.union(b); c
@@ -849,7 +850,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
EXAMPLE::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: A = M.subset('A')
sage: B = M.subset('B')
sage: M.declare_union(A, B)
@@ -886,7 +887,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
Subsets on a 2-dimensional manifold::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: a = M.subset('A')
sage: b = a.subset('B')
sage: c = M.subset('C')
@@ -910,7 +911,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: A = M.subset('A')
sage: p = A((-2,3), chart=X); p
@@ -933,14 +934,14 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
if point._subset.is_subset(self):
return True
#!# should be improved once coordinate definition have been introduced
- # in TopManifoldSubset
+ # in TopologicalManifoldSubset
return False
def point(self, coords=None, chart=None, name=None, latex_name=None):
r"""
Define a point in the subset.
- See :class:`~sage.manifolds.point.TopManifoldPoint` for a
+ See :class:`~sage.manifolds.point.TopologicalManifoldPoint` for a
complete documentation.
INPUT:
@@ -957,14 +958,14 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
OUTPUT:
- the declared point, as an instance of
- :class:`~sage.manifolds.point.TopManifoldPoint`.
+ :class:`~sage.manifolds.point.TopologicalManifoldPoint`.
EXAMPLES:
Points on a 2-dimensional manifold::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
+ sage: sage.manifolds.manifold.TopologicalManifold._clear_cache_() # for doctests only
+ sage: M = Manifold(2, 'M', type='topological')
sage: c_xy.<x,y> = M.chart()
sage: p = M.point((1,2), name='p'); p
Point p on the 2-dimensional topological manifold M