summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-11-18 12:20:12 +0100
committerEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-11-18 12:20:12 +0100
commitf31bed1df28efe0b83c0e02a3eac1cee302bb498 (patch)
tree239f3c6863761ef945768f8476c7ee3c9de9acf5
parentImplement diff. manifolds (basics, #18783) on the new manifold categories (#1... (diff)
parentMorphisms of topological manifolds with the use of base_field_type() (diff)
Remove UniqueRepresentation from differentiable manifolds
-rw-r--r--src/sage/manifolds/all.py4
-rw-r--r--src/sage/manifolds/chart.py288
-rw-r--r--src/sage/manifolds/continuous_map.py153
-rw-r--r--src/sage/manifolds/coord_func.py153
-rw-r--r--src/sage/manifolds/coord_func_symb.py140
-rw-r--r--src/sage/manifolds/differentiable/chart.py46
-rw-r--r--src/sage/manifolds/differentiable/diff_map.py35
-rw-r--r--src/sage/manifolds/differentiable/manifold.py270
-rw-r--r--src/sage/manifolds/differentiable/manifold_homset.py42
-rw-r--r--src/sage/manifolds/differentiable/scalarfield.py16
-rw-r--r--src/sage/manifolds/differentiable/scalarfield_algebra.py48
-rw-r--r--src/sage/manifolds/manifold.py653
-rw-r--r--src/sage/manifolds/manifold_homset.py87
-rw-r--r--src/sage/manifolds/point.py105
-rw-r--r--src/sage/manifolds/scalarfield.py223
-rw-r--r--src/sage/manifolds/scalarfield_algebra.py99
-rw-r--r--src/sage/manifolds/subset.py268
-rw-r--r--src/sage/manifolds/utilities.py60
18 files changed, 1778 insertions, 912 deletions
diff --git a/src/sage/manifolds/all.py b/src/sage/manifolds/all.py
index de8f57e..0a3bbc0 100644
--- a/src/sage/manifolds/all.py
+++ b/src/sage/manifolds/all.py
@@ -1,7 +1,5 @@
from sage.misc.lazy_import import lazy_import
-lazy_import('sage.manifolds.manifold', 'TopManifold')
-lazy_import('sage.manifolds.differentiable.manifold', 'DiffManifold')
+lazy_import('sage.manifolds.manifold', 'Manifold')
lazy_import('sage.manifolds.utilities', 'nice_derivatives')
lazy_import('sage.manifolds.utilities', 'omit_function_args')
lazy_import('sage.manifolds.utilities', 'set_axes_labels')
-lazy_import('sage.manifolds.utilities', 'Manifold') # deprecated
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index 77781da..c81e1dd 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -35,16 +35,14 @@ REFERENCES:
#*****************************************************************************
from sage.structure.sage_object import SageObject
-from sage.structure.unique_representation import UniqueRepresentation
+from sage.misc.fast_methods import WithEqualityById
from sage.symbolic.ring import SR
-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
from sage.manifolds.coord_func_symb import CoordFunctionSymb
-class Chart(UniqueRepresentation, SageObject):
+class Chart(WithEqualityById, SageObject):
r"""
Chart on a topological manifold.
@@ -60,7 +58,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 ':':
@@ -84,7 +82,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)
@@ -100,8 +98,7 @@ 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: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x,y> = M.chart(); X
Chart (M, (x, y))
@@ -121,8 +118,7 @@ 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: M = Manifold(2, 'M', field='complex', type='topological')
sage: X.<x1,y1> = M.chart('x y'); X
Chart (M, (x, y))
@@ -139,8 +135,7 @@ 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: 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::
@@ -182,7 +177,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)
@@ -206,7 +202,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()
@@ -240,7 +236,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))
@@ -251,12 +247,14 @@ 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 == '':
for x in names:
coordinates += x + ' '
+ coordinates = coordinates[:-1]
+ self._coordinate_string = coordinates # for pickling (cf. __reduce__)
self._manifold = domain.manifold()
self._domain = domain
# Treatment of the coordinates:
@@ -271,6 +269,15 @@ class Chart(UniqueRepresentation, SageObject):
# _init_coordinates, which sets self._xx and
# which may be redefined for subclasses (for instance RealChart).
self._init_coordinates(coord_list)
+ coord_string = ''
+ for x in self._xx:
+ coord_string += str(x) + ' '
+ coord_string = coord_string[:-1]
+ if coord_string in self._domain._charts_by_coord:
+ raise ValueError("the chart with coordinates " + coord_string +
+ " has already been declared on " +
+ "the {}".format(self._domain))
+ self._domain._charts_by_coord[coord_string] = self
#
# Additional restrictions on the coordinates
self._restrictions = [] # to be set with method add_restrictions()
@@ -302,11 +309,12 @@ class Chart(UniqueRepresentation, SageObject):
# subsets of self._domain, with the
# subsets as keys
# The null and one functions of the coordinates:
- base_field = self._domain.base_field()
- if base_field in [RR, CC]:
+ base_field_type = self._domain.base_field_type()
+ if base_field_type in ['real', 'complex']:
self._zero_function = CoordFunctionSymb(self, 0)
self._one_function = CoordFunctionSymb(self, 1)
else:
+ base_field = self._domain.base_field()
self._zero_function = CoordFunctionSymb(self, base_field.zero())
self._one_function = CoordFunctionSymb(self, base_field.one())
# Expression in self of the zero and one scalar fields of open sets
@@ -334,7 +342,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
@@ -365,7 +373,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))'
@@ -383,7 +391,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)'
@@ -413,6 +421,104 @@ class Chart(UniqueRepresentation, SageObject):
"""
return self[:]
+ def __reduce__(self):
+ r"""
+ Reduction function for the pickle protocole.
+
+ TESTS::
+
+ sage: M = Manifold(2, 'M', type='topological')
+ sage: X.<x,y> = M.chart()
+ sage: X.__reduce__()
+ (<class 'sage.manifolds.chart.RealChart'>,
+ (2-dimensional topological manifold M, 'x y'),
+ [])
+ sage: X.add_restrictions(x^2 + y^2 < 1)
+ sage: X.__reduce__()
+ (<class 'sage.manifolds.chart.RealChart'>,
+ (2-dimensional topological manifold M, 'x y'),
+ [x^2 + y^2 < 1])
+
+ Test of pickling::
+
+ sage: loads(dumps(X))
+ Chart (M, (x, y))
+
+ """
+ return (type(self), (self._domain, self._coordinate_string),
+ self.__getstate__())
+
+ def __getstate__(self):
+ r"""
+ Return the attributes of ``self`` that have been set after
+ the construction of the object.
+
+ This is used in pickling, to handle the coordinate restrictions,
+ since the latter have been defined by calls to
+ ``self.add_restrictions()`` and not at the object construction.
+
+ TESTS::
+
+ sage: M = Manifold(2, 'M', type='topological')
+ sage: X.<x,y> = M.chart()
+ sage: X.__getstate__()
+ []
+ sage: X.add_restrictions(x^2 + y^2 < 1)
+ sage: X.__getstate__()
+ [x^2 + y^2 < 1]
+
+ """
+ return self._restrictions
+
+ def __setstate__(self, coord_restrictions):
+ r"""
+ Set the attributes of ``self`` that are not initialized at the object
+ construction.
+
+ This is used in unpickling, to handle the coordinate restrictions,
+ since the latter have been defined by calls to
+ ``self.add_restrictions()`` and not at the object construction.
+
+ TESTS::
+
+ sage: M = Manifold(2, 'M', type='topological')
+ sage: X.<x,y> = M.chart()
+ sage: X._restrictions
+ []
+ sage: X.__setstate__([x^2+y^2<1])
+ sage: X._restrictions
+ [x^2 + y^2 < 1]
+
+ """
+ self._restrictions = coord_restrictions
+
+ def _test_pickling(self, **options):
+ r"""
+ Test pickling.
+
+ This test is weaker than
+ :meth:`sage.structure.sage_object.SageObject._test_pickling` in that
+ it does not require ``loads(dumps(self)) == self``.
+ It however checks that ``loads(dumps(self))`` proceeds without any
+ error and results in an object that is a chart with the same
+ coordinates as self.
+
+ TESTS::
+
+ sage: M = Manifold(2, 'M', type='topological')
+ sage: X.<x,y> = M.chart()
+ sage: X._test_pickling()
+ sage: X.add_restrictions(x < 0)
+ sage: X._test_pickling()
+
+ """
+ tester = self._tester(**options)
+ from sage.misc.all import loads, dumps
+ bckp = loads(dumps(self))
+ tester.assertEqual(type(bckp), type(self))
+ tester.assertEqual(bckp._xx, self._xx)
+ tester.assertEqual(bckp._restrictions, self._restrictions)
+
def __getitem__(self, i):
r"""
Access to the coordinates.
@@ -429,7 +535,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
@@ -440,7 +546,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
@@ -469,7 +576,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)
@@ -486,7 +593,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
@@ -504,7 +611,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()
@@ -536,7 +643,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)
@@ -565,7 +672,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
@@ -590,7 +697,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
@@ -606,7 +713,7 @@ class Chart(UniqueRepresentation, SageObject):
coordinates = ""
for coord in self._xx:
coordinates += repr(coord) + ' '
- res = self.__class__(subset, coordinates)
+ res = type(self)(subset, coordinates)
res._restrictions.extend(self._restrictions)
# The coordinate restrictions are added to the result chart and
# possibly transformed into coordinate bounds:
@@ -641,8 +748,7 @@ class Chart(UniqueRepresentation, SageObject):
EXAMPLE::
- sage: TopManifold._clear_cache_() # for doctests only
- 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, y!=0])
sage: X.valid_coordinates(0, i)
@@ -747,7 +853,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
@@ -777,8 +883,7 @@ 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: 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')
@@ -796,7 +901,7 @@ class Chart(UniqueRepresentation, SageObject):
[2-dimensional topological manifold R^2,
Open subset U of the 2-dimensional topological manifold R^2]
- ... but a new chart has been created: `(U, (x, y))`::
+ but a new chart has been created: `(U, (x, y))`::
sage: M.atlas()
[Chart (R^2, (x, y)), Chart (U, (r, phi)), Chart (U, (x, y))]
@@ -863,7 +968,7 @@ class Chart(UniqueRepresentation, SageObject):
A symbolic coordinate function::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(sin(x*y))
sage: f
@@ -908,7 +1013,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.zero_function()
0
@@ -924,7 +1029,7 @@ class Chart(UniqueRepresentation, SageObject):
Zero function on a p-adic manifold::
- sage: M = TopManifold(2, 'M', field=Qp(5)); M
+ sage: M = Manifold(2, 'M', type='topological', field=Qp(5)); M
2-dimensional topological manifold M over the 5-adic Field with
capped relative precision 20
sage: X.<x,y> = M.chart()
@@ -962,7 +1067,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.one_function()
1
@@ -978,7 +1083,7 @@ class Chart(UniqueRepresentation, SageObject):
One function on a p-adic manifold::
- sage: M = TopManifold(2, 'M', field=Qp(5)); M
+ sage: M = Manifold(2, 'M', type='topological', field=Qp(5)); M
2-dimensional topological manifold M over the 5-adic Field with
capped relative precision 20
sage: X.<x,y> = M.chart()
@@ -1031,7 +1136,7 @@ class Chart(UniqueRepresentation, SageObject):
Function of two coordinates with values in `\RR^3`::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x+y, sin(x*y), x^2 + 3*y); f
Coordinate functions (x + y, sin(x*y), x^2 + 3*y) on the Chart (M, (x, y))
@@ -1096,7 +1201,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)
@@ -1110,8 +1216,8 @@ 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: 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))
@@ -1131,7 +1237,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))
@@ -1146,9 +1252,8 @@ 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: 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
@@ -1220,7 +1325,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()
@@ -1282,7 +1387,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))
@@ -1311,7 +1416,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
@@ -1408,8 +1513,7 @@ 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: 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))
@@ -1457,7 +1561,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)
@@ -1549,8 +1653,7 @@ 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: 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)
@@ -1650,7 +1753,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
@@ -1675,7 +1778,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)
@@ -1706,7 +1809,7 @@ class RealChart(Chart):
coordinates = ""
for coord in self._xx:
coordinates += repr(coord) + ' '
- res = self.__class__(subset, coordinates)
+ res = type(self)(subset, coordinates)
res._bounds = self._bounds
res._restrictions.extend(self._restrictions)
# The coordinate restrictions are added to the result chart and
@@ -1746,7 +1849,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
@@ -1920,7 +2023,7 @@ class RealChart(Chart):
Grid of polar coordinates in terms of Cartesian coordinates in the
Euclidean plane::
- sage: R2 = TopManifold(2, 'R^2') # the Euclidean plane
+ sage: R2 = Manifold(2, 'R^2', type='topological') # the Euclidean plane
sage: c_cart.<x,y> = R2.chart() # Cartesian coordinates
sage: U = R2.open_subset('U', coord_def={c_cart: (y!=0, x<0)}) # the complement of the segment y=0 and x>0
sage: c_pol.<r,ph> = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi') # polar coordinates on U
@@ -1932,7 +2035,7 @@ class RealChart(Chart):
.. PLOT::
- R2 = TopManifold(2, 'R^2')
+ R2 = Manifold(2, 'R^2', type='topological')
c_cart = R2.chart('x y'); x, y = c_cart[:]
U = R2.open_subset('U', coord_def={c_cart: (y!=0, x<0)})
c_pol = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi'); r, ph = c_pol[:]
@@ -1947,7 +2050,7 @@ class RealChart(Chart):
.. PLOT::
- R2 = TopManifold(2, 'R^2')
+ R2 = Manifold(2, 'R^2', type='topological')
c_cart = R2.chart('x y'); x, y = c_cart[:]
U = R2.open_subset('U', coord_def={c_cart: (y!=0, x<0)})
c_pol = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi'); r, ph = c_pol[:]
@@ -1962,7 +2065,7 @@ class RealChart(Chart):
.. PLOT::
- R2 = TopManifold(2, 'R^2')
+ R2 = Manifold(2, 'R^2', type='topological')
c_cart = R2.chart('x y'); x, y = c_cart[:]
U = R2.open_subset('U', coord_def={c_cart: (y!=0, x<0)})
c_pol = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi'); r, ph = c_pol[:]
@@ -1976,7 +2079,7 @@ class RealChart(Chart):
.. PLOT::
- R2 = TopManifold(2, 'R^2')
+ R2 = Manifold(2, 'R^2', type='topological')
c_cart = R2.chart('x y'); x, y = c_cart[:]
U = R2.open_subset('U', coord_def={c_cart: (y!=0, x<0)})
c_pol = U.chart(r'r:(0,+oo) ph:(0,2*pi):\phi'); r, ph = c_pol[:]
@@ -1992,7 +2095,7 @@ class RealChart(Chart):
.. PLOT::
- R2 = TopManifold(2, 'R^2')
+ R2 = Manifold(2, 'R^2', type='topological')
c_cart = R2.chart('x y'); x, y = c_cart[:]
g = c_cart.plot()
sphinx_plot(g)
@@ -2001,7 +2104,7 @@ class RealChart(Chart):
some manifold map: 3D plot of the stereographic charts on the
2-sphere::
- sage: S2 = TopManifold(2, 'S^2') # the 2-sphere
+ sage: S2 = Manifold(2, 'S^2', type='topological') # the 2-sphere
sage: U = S2.open_subset('U') ; V = S2.open_subset('V') # complement of the North and South pole, respectively
sage: S2.declare_union(U,V)
sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
@@ -2010,7 +2113,7 @@ class RealChart(Chart):
....: intersection_name='W', restrictions1= x^2+y^2!=0,
....: restrictions2= u^2+v^2!=0)
sage: uv_to_xy = xy_to_uv.inverse()
- sage: R3 = TopManifold(3, 'R^3') # the Euclidean space R^3
+ sage: R3 = Manifold(3, 'R^3', type='topological') # the Euclidean space R^3
sage: c_cart.<X,Y,Z> = R3.chart() # Cartesian coordinates on R^3
sage: Phi = S2.continuous_map(R3, {(c_xy, c_cart): [2*x/(1+x^2+y^2),
....: 2*y/(1+x^2+y^2), (x^2+y^2-1)/(1+x^2+y^2)],
@@ -2044,7 +2147,7 @@ class RealChart(Chart):
.. PLOT::
- S2 = TopManifold(2, 'S^2')
+ S2 = Manifold(2, 'S^2', type='topological')
U = S2.open_subset('U'); V = S2.open_subset('V'); S2.declare_union(U,V)
c_xy = U.chart('x y'); x, y = c_xy[:]
c_uv = V.chart('u v'); u, v = c_uv[:]
@@ -2069,7 +2172,7 @@ class RealChart(Chart):
.. PLOT::
- S2 = TopManifold(2, 'S^2')
+ S2 = Manifold(2, 'S^2', type='topological')
U = S2.open_subset('U'); V = S2.open_subset('V'); S2.declare_union(U,V)
c_xy = U.chart('x y'); x, y = c_xy[:]
c_uv = V.chart('u v'); u, v = c_uv[:]
@@ -2096,7 +2199,7 @@ class RealChart(Chart):
performed for at most 3 coordinates, which must be specified via
the argument ``ambient_coords``)::
- sage: M = TopManifold(4, 'M')
+ sage: M = Manifold(4, 'M', type='topological')
sage: X.<t,x,y,z> = M.chart()
sage: g = X.plot(ambient_coords=(t,x,y)) # the coordinate z is not depicted
sage: show(g) # a 3D mesh cube
@@ -2105,7 +2208,7 @@ class RealChart(Chart):
.. PLOT::
- M = TopManifold(4, 'M')
+ M = Manifold(4, 'M', type='topological')
X = M.chart('t x y z'); t,x,y,z = X[:]
g = X.plot(ambient_coords=(t,y))
sphinx_plot(g)
@@ -2401,7 +2504,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])
@@ -2420,7 +2523,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])
@@ -2459,7 +2562,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])
@@ -2480,7 +2583,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])
@@ -2506,7 +2609,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])
@@ -2530,7 +2633,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))
@@ -2565,9 +2668,10 @@ class CoordChange(SageObject):
"charts)")
# New symbolic variables (different from x2 to allow for a
# correct solution even when chart2 = chart1):
- if self._chart1.domain().base_field() == RR:
+ base_field = self._chart1.domain().base_field_type()
+ if base_field == 'real':
coord_domain = ['real' for i in range(n2)]
- elif self._chart1.domain().base_field() == CC:
+ elif base_field == 'complex':
coord_domain = ['complex' for i in range(n2)]
else:
coord_domain = [None for i in range(n2)]
@@ -2589,7 +2693,7 @@ class CoordChange(SageObject):
for i in range(n1)]
for transf in x2_to_x1:
try:
- if self._domain.base_field() == RR:
+ if self._domain.base_field_type() == 'real':
transf = simplify_chain_real(transf)
else:
transf = simplify_chain_generic(transf)
@@ -2605,7 +2709,7 @@ class CoordChange(SageObject):
x2_to_x1 = [sol[x1[i]].subs(substitutions) for i in range(n1)]
for transf in x2_to_x1:
try:
- if self._domain.base_field() == RR:
+ if self._domain.base_field_type() == 'real':
transf = simplify_chain_real(transf)
else:
transf = simplify_chain_generic(transf)
@@ -2624,7 +2728,7 @@ class CoordChange(SageObject):
"transformation; use set_inverse() to set the inverse " +
"manually")
x2_to_x1 = list_x2_to_x1[0]
- self._inverse = self.__class__(self._chart2, self._chart1, *x2_to_x1)
+ self._inverse = type(self)(self._chart2, self._chart1, *x2_to_x1)
return self._inverse
@@ -2649,7 +2753,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')
@@ -2682,7 +2786,7 @@ class CoordChange(SageObject):
check = kwds['check']
else:
check = True
- self._inverse = self.__class__(self._chart2, self._chart1,
+ self._inverse = type(self)(self._chart2, self._chart1,
*transformations)
if check:
print "Check of the inverse coordinate transformation:"
@@ -2710,7 +2814,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))
@@ -2730,7 +2834,7 @@ class CoordChange(SageObject):
"{} is different from {}".format(other._chart2,
other._chart1))
transf = self._transf(*(other._transf.expr()))
- return self.__class__(other._chart1, self._chart2, *transf)
+ return type(self)(other._chart1, self._chart2, *transf)
def restrict(self, dom1, dom2=None):
r"""
@@ -2749,7 +2853,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])
@@ -2772,8 +2876,8 @@ class CoordChange(SageObject):
ch2 = self._chart2.restrict(dom2)
if (ch1, ch2) in dom1.coord_changes():
return dom1.coord_changes()[(ch1,ch2)]
- return self.__class__(self._chart1.restrict(dom1),
- self._chart2.restrict(dom2), *(self._transf.expr()))
+ return type(self)(self._chart1.restrict(dom1),
+ self._chart2.restrict(dom2), *(self._transf.expr()))
def display(self):
r"""
@@ -2786,7 +2890,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/continuous_map.py b/src/sage/manifolds/continuous_map.py
index 83b15e9..5d3790d 100644
--- a/src/sage/manifolds/continuous_map.py
+++ b/src/sage/manifolds/continuous_map.py
@@ -49,7 +49,7 @@ class ContinuousMap(Morphism):
homset between `M` and `N`, which is denoted by `\mathrm{Hom}(M,N)`.
The class :class:`ContinuousMap` is a Sage *element* class, whose *parent*
- class is :class:`~sage.manifolds.manifold_homset.TopManifoldHomset`.
+ class is :class:`~sage.manifolds.manifold_homset.TopologicalManifoldHomset`.
INPUT:
@@ -84,7 +84,7 @@ class ContinuousMap(Morphism):
The standard embedding of the sphere `S^2` into `\RR^3`::
- sage: M = TopManifold(2, 'S^2') # the 2-dimensional sphere S^2
+ sage: M = Manifold(2, 'S^2', type='topological') # the 2-dimensional sphere S^2
sage: U = M.open_subset('U') # complement of the North pole
sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
sage: V = M.open_subset('V') # complement of the South pole
@@ -94,7 +94,7 @@ class ContinuousMap(Morphism):
....: intersection_name='W', restrictions1= x^2+y^2!=0,
....: restrictions2= u^2+v^2!=0)
sage: uv_to_xy = xy_to_uv.inverse()
- sage: N = TopManifold(3, 'R^3', r'\RR^3') # R^3
+ sage: N = Manifold(3, 'R^3', latex_name=r'\RR^3', type='topological') # R^3
sage: c_cart.<X,Y,Z> = N.chart() # Cartesian coordinates on R^3
sage: Phi = M.continuous_map(N,
....: {(c_xy, c_cart): [2*x/(1+x^2+y^2), 2*y/(1+x^2+y^2), (x^2+y^2-1)/(1+x^2+y^2)],
@@ -110,14 +110,14 @@ class ContinuousMap(Morphism):
sage: Phi.parent() is Hom(M, N)
True
sage: type(Phi)
- <class 'sage.manifolds.continuous_map.TopManifoldHomset_with_category.element_class'>
+ <class 'sage.manifolds.continuous_map.TopologicalManifoldHomset_with_category.element_class'>
sage: Phi.display()
Phi: S^2 --> R^3
on U: (x, y) |--> (X, Y, Z) = (2*x/(x^2 + y^2 + 1), 2*y/(x^2 + y^2 + 1), (x^2 + y^2 - 1)/(x^2 + y^2 + 1))
on V: (u, v) |--> (X, Y, Z) = (2*u/(u^2 + v^2 + 1), 2*v/(u^2 + v^2 + 1), -(u^2 + v^2 - 1)/(u^2 + v^2 + 1))
It is possible to create the map via the method
- :meth:`~sage.manifolds.manifold.TopManifold.continuous_map`
+ :meth:`~sage.manifolds.manifold.TopologicalManifold.continuous_map`
only in a single pair of charts: the argument ``coord_functions`` is then
a mere list of coordinate expressions (and not a dictionary) and the
arguments ``chart1`` and ``chart2`` have to be provided if the charts
@@ -174,7 +174,7 @@ class ContinuousMap(Morphism):
the projection from the point `(X,Y,Z)=(0,0,1)` onto the equatorial plane
`Z=0`::
- sage: P = TopManifold(2, 'R^2', r'\RR^2') # R^2 (equatorial plane)
+ sage: P = Manifold(2, 'R^2', latex_name=r'\RR^2', type='topological') # R^2 (equatorial plane)
sage: cP.<xP, yP> = P.chart()
sage: Psi = N.continuous_map(P, (X/(1-Z), Y/(1-Z)), name='Psi',
....: latex_name=r'\Psi')
@@ -210,16 +210,16 @@ class ContinuousMap(Morphism):
defined by a single symbolic expression for each pair of charts, and not
by a list/tuple with a single element::
- sage: N = TopManifold(1, 'N')
+ sage: N = Manifold(1, 'N', type='topological')
sage: c_N = N.chart('X')
sage: Phi = M.continuous_map(N, {(c_xy, c_N): x^2+y^2, \
....: (c_uv, c_N): 1/(u^2+v^2)}) # not ...[1/(u^2+v^2)] or (1/(u^2+v^2),)
An example of continuous map `\RR \rightarrow \RR^2`::
- sage: R = TopManifold(1, 'R') # field R
+ sage: R = Manifold(1, 'R', type='topological') # field R
sage: T.<t> = R.chart() # canonical chart on R
- sage: R2 = TopManifold(2, 'R^2') # R^2
+ sage: R2 = Manifold(2, 'R^2', type='topological') # R^2
sage: c_xy.<x,y> = R2.chart() # Cartesian coordinates on R^2
sage: Phi = R.continuous_map(R2, [cos(t), sin(t)], name='Phi') ; Phi
Continuous map Phi from the 1-dimensional topological manifold R to
@@ -338,9 +338,9 @@ class ContinuousMap(Morphism):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
- sage: N = TopManifold(3, 'N')
+ sage: N = Manifold(3, 'N', type='topological')
sage: Y.<u,v,w> = N.chart()
sage: f = Hom(M,N)({(X,Y): (x+y, x*y, x-y)}, name='f') ; f
Continuous map f from the 2-dimensional topological manifold M to
@@ -431,9 +431,9 @@ class ContinuousMap(Morphism):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
- sage: N = TopManifold(2, 'N')
+ sage: N = Manifold(2, 'N', type='topological')
sage: Y.<u,v> = N.chart()
sage: f = Hom(M,N)({(X,Y): (x+y,x*y)})
sage: f._repr_()
@@ -480,7 +480,7 @@ class ContinuousMap(Morphism):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = Hom(M,M)({(X,X): (x+y,x*y)}, name='f')
sage: f._latex_()
@@ -510,20 +510,22 @@ class ContinuousMap(Morphism):
TESTS::
- sage: M = TopManifold(3, 'M')
+ sage: M = Manifold(3, 'M', type='topological')
sage: X.<x,y,z> = M.chart()
- sage: N = TopManifold(2, 'N')
+ sage: N = Manifold(2, 'N', type='topological')
sage: Y.<u,v> = N.chart()
sage: f = M.continuous_map(N, {(X,Y): [x+y+z, 2*x*y*z]}, name='f')
sage: g = M.continuous_map(N, {(X,Y): [x+y+z, 2*x*y*z]}, name='g')
- sage: f.__eq__(g)
+ sage: f == g
True
sage: g = M.continuous_map(N, {(X,Y): [x+y+z, 1]}, name='g')
- sage: f.__eq__(g)
+ sage: f == g
False
"""
- if not isinstance(other, self.__class__):
+ if other is self:
+ return True
+ if not isinstance(other, type(self)):
return False
if self.parent() != other.parent():
return False
@@ -554,9 +556,9 @@ class ContinuousMap(Morphism):
TESTS::
- sage: M = TopManifold(3, 'M')
+ sage: M = Manifold(3, 'M', type='topological')
sage: X.<x,y,z> = M.chart()
- sage: N = TopManifold(2, 'N')
+ sage: N = Manifold(2, 'N', type='topological')
sage: Y.<u,v> = N.chart()
sage: f = M.continuous_map(N, {(X,Y): [x+y+z, 2*x*y*z]}, name='f')
sage: g = M.continuous_map(N, {(X,Y): [x+y+z, 2*x*y*z]}, name='g')
@@ -567,7 +569,7 @@ class ContinuousMap(Morphism):
True
"""
- return not self.__eq__(other)
+ return not (self == other)
def __cmp__(self, other):
r"""
@@ -577,9 +579,9 @@ class ContinuousMap(Morphism):
TESTS::
- sage: M = TopManifold(3, 'M')
+ sage: M = Manifold(3, 'M', type='topological')
sage: X.<x,y,z> = M.chart()
- sage: N = TopManifold(2, 'N')
+ sage: N = Manifold(2, 'N', type='topological')
sage: Y.<u,v> = N.chart()
sage: f = M.continuous_map(N, {(X,Y): [x+y+z, 2*x*y*z]}, name='f')
sage: g = M.continuous_map(N, {(X,Y): [x+y+z, 2*x*y*z]}, name='g')
@@ -590,11 +592,41 @@ class ContinuousMap(Morphism):
-1
"""
- if self.__eq__(other):
+ if self == other:
return 0
else:
return -1
+ def _test_pickling(self, **options):
+ r"""
+ Test pickling.
+
+ This test is weaker than
+ :meth:`sage.structure.sage_object.SageObject._test_pickling` in that
+ it does not require ``loads(dumps(self)) == self``.
+ It however checks that ``loads(dumps(self))`` proceeds without any
+ error and results in an object that is a continuous map of the same
+ type as ``self``.
+
+ TEST::
+
+ sage: M = Manifold(3, 'M', type='topological')
+ sage: X.<x,y,z> = M.chart()
+ sage: N = Manifold(2, 'N', type='topological')
+ sage: Y.<u,v> = N.chart()
+ sage: f = M.continuous_map(N, {(X,Y): [x+y+z, 2*x*y*z]}, name='f')
+ sage: f._test_pickling()
+
+ """
+ tester = self._tester(**options)
+ from sage.misc.all import loads, dumps
+ bckp = loads(dumps(self))
+ tester.assertEqual(type(bckp), type(self))
+ tester.assertEqual(bckp._domain.dimension(), self._domain.dimension())
+ tester.assertEqual(bckp._codomain.dimension(), self._codomain.dimension())
+ tester.assertEqual(bckp._is_identity, self._is_identity)
+ tester.assertEqual(bckp._is_isomorphism, self._is_isomorphism)
+
#
# Map methods
#
@@ -606,19 +638,18 @@ class ContinuousMap(Morphism):
INPUT:
- ``point`` -- point in the domain of ``self``, as an instance of
- :class:`~sage.manifolds.point.TopManifoldPoint`
+ :class:`~sage.manifolds.point.TopologicalManifoldPoint`
OUTPUT:
- image of the point by ``self`` (instance of
- :class:`~sage.manifolds.point.TopManifoldPoint`)
+ :class:`~sage.manifolds.point.TopologicalManifoldPoint`)
EXAMPLES:
Planar rotation acting on a point::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'R^2', r'\RR^2') # Euclidean plane
+ sage: M = Manifold(2, 'R^2', latex_name=r'\RR^2', type='topological') # Euclidean plane
sage: c_cart.<x,y> = M.chart() # Cartesian coordinates
sage: # A pi/3 rotation around the origin defined in Cartesian coordinates:
sage: rot = M.continuous_map(M, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2),
@@ -703,7 +734,7 @@ class ContinuousMap(Morphism):
Tests on continuous maps of a 2-dimensional manifold::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: M.identity_map().is_identity() # obviously...
True
@@ -719,7 +750,7 @@ class ContinuousMap(Morphism):
Of course, if the codomain of the map does not coincide with its
domain, the outcome is ``False``::
- sage: N = TopManifold(2, 'N')
+ sage: N = Manifold(2, 'N', type='topological')
sage: Y.<u,v> = N.chart()
sage: a = M.continuous_map(N, {(X,Y): (x, y)})
sage: a.display()
@@ -767,11 +798,11 @@ class ContinuousMap(Morphism):
TESTS::
- sage: M = TopManifold(3, 'M')
+ sage: M = Manifold(3, 'M', type='topological')
sage: X.<x,y,z> = M.chart()
- sage: N = TopManifold(2, 'N')
+ sage: N = Manifold(2, 'N', type='topological')
sage: Y.<u,v> = N.chart()
- sage: Q = TopManifold(4, 'Q')
+ sage: Q = Manifold(4, 'Q', type='topological')
sage: Z.<a,b,c,d> = Q.chart()
sage: f = N.continuous_map(Q, [u+v, u*v, 1+u, 2-v])
sage: g = M.continuous_map(N, [x+y+z, x*y*z])
@@ -829,7 +860,7 @@ class ContinuousMap(Morphism):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = M.continuous_map(M, [x+y, x*y], name='f')
sage: g = M.continuous_map(M, [1-y, 2+x], name='g')
@@ -861,7 +892,7 @@ class ContinuousMap(Morphism):
TEST::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = M.homeomorphism(M, [x+y, x-y])
sage: f._init_derived()
@@ -883,7 +914,7 @@ class ContinuousMap(Morphism):
TEST::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = M.homeomorphism(M, [x+y, x-y])
sage: f^(-1)
@@ -924,14 +955,13 @@ class ContinuousMap(Morphism):
Standard embedding of the sphere `S^2` in `\RR^3`::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'S^2') # the 2-dimensional sphere S^2
+ sage: M = Manifold(2, 'S^2', type='topological') # the 2-dimensional sphere S^2
sage: U = M.open_subset('U') # complement of the North pole
sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
sage: V = M.open_subset('V') # complement of the South pole
sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole
sage: M.declare_union(U,V) # S^2 is the union of U and V
- sage: N = TopManifold(3, 'R^3', r'\RR^3') # R^3
+ sage: N = Manifold(3, 'R^3', latex_name=r'\RR^3', type='topological') # R^3
sage: c_cart.<X,Y,Z> = N.chart() # Cartesian coordinates on R^3
sage: Phi = M.continuous_map(N, \
....: {(c_xy, c_cart): [2*x/(1+x^2+y^2), 2*y/(1+x^2+y^2), (x^2+y^2-1)/(1+x^2+y^2)],
@@ -1097,9 +1127,8 @@ class ContinuousMap(Morphism):
Continuous map from a 2-dimensional manifold to a 3-dimensional
one::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
- sage: N = TopManifold(3, 'N')
+ sage: M = Manifold(2, 'M', type='topological')
+ sage: N = Manifold(3, 'N', type='topological')
sage: c_uv.<u,v> = M.chart()
sage: c_xyz.<x,y,z> = N.chart()
sage: Phi = M.continuous_map(N, (u*v, u/v, u+v), name='Phi',
@@ -1284,9 +1313,8 @@ class ContinuousMap(Morphism):
Continuous map from a 2-dimensional manifold to a 3-dimensional
one::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M')
- sage: N = TopManifold(3, 'N')
+ sage: M = Manifold(2, 'M', type='topological')
+ sage: N = Manifold(3, 'N', type='topological')
sage: c_uv.<u,v> = M.chart()
sage: c_xyz.<x,y,z> = N.chart()
sage: Phi = M.continuous_map(N, (u*v, u/v, u+v), name='Phi',
@@ -1325,8 +1353,7 @@ class ContinuousMap(Morphism):
A rotation in some Euclidean plane::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'M') # the plane (minus a segment to have global regular spherical coordinates)
+ sage: M = Manifold(2, 'M', type='topological') # the plane (minus a segment to have global regular spherical coordinates)
sage: c_spher.<r,ph> = M.chart(r'r:(0,+oo) ph:(0,2*pi):\phi') # spherical coordinates on the plane
sage: rot = M.continuous_map(M, (r, ph+pi/3), name='R') # pi/3 rotation around r=0
sage: rot.expr()
@@ -1371,8 +1398,7 @@ class ContinuousMap(Morphism):
Polar representation of a planar rotation initally defined in
Cartesian coordinates::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'R^2', r'\RR^2') # the Euclidean plane R^2
+ sage: M = Manifold(2, 'R^2', latex_name=r'\RR^2', type='topological') # the Euclidean plane R^2
sage: c_xy.<x,y> = M.chart() # Cartesian coordinate on R^2
sage: U = M.open_subset('U', coord_def={c_xy: (y!=0, x<0)}) # the complement of the segment y=0 and x>0
sage: c_cart = c_xy.restrict(U) # Cartesian coordinates on U
@@ -1473,8 +1499,7 @@ class ContinuousMap(Morphism):
Polar representation of a planar rotation initally defined in
Cartesian coordinates::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'R^2', r'\RR^2') # the Euclidean plane R^2
+ sage: M = Manifold(2, 'R^2', latex_name=r'\RR^2', type='topological') # the Euclidean plane R^2
sage: c_xy.<x,y> = M.chart() # Cartesian coordinate on R^2
sage: U = M.open_subset('U', coord_def={c_xy: (y!=0, x<0)}) # the complement of the segment y=0 and x>0
sage: c_cart = c_xy.restrict(U) # Cartesian coordinates on U
@@ -1586,11 +1611,12 @@ class ContinuousMap(Morphism):
INPUT:
- ``subdomain`` -- an open subset of the domain of the continuous map
- (must be an instance of :class:`~sage.manifolds.manifold.TopManifold`)
+ (must be an instance of
+ :class:`~sage.manifolds.manifold.TopologicalManifold`)
- ``subcodomain`` -- (default: ``None``) an open subset of the codomain
of the continuous map (must be an instance of
- :class:`~sage.manifolds.manifold.TopManifold`); if ``None``, the
- codomain of the continuous map is assumed.
+ :class:`~sage.manifolds.manifold.TopologicalManifold`); if ``None``,
+ the codomain of the continuous map is assumed.
OUTPUT:
@@ -1602,7 +1628,7 @@ class ContinuousMap(Morphism):
Restriction to an annulus of a homeomorphism between the open unit
disk and `\RR^2`::
- sage: M = TopManifold(2, 'R^2') # R^2
+ sage: M = Manifold(2, 'R^2', type='topological') # R^2
sage: c_xy.<x,y> = M.chart() # Cartesian coord. on R^2
sage: D = M.open_subset('D', coord_def={c_xy: x^2+y^2<1}) # the open unit disk
sage: Phi = D.continuous_map(M, [x/sqrt(1-x^2-y^2), y/sqrt(1-x^2-y^2)],
@@ -1679,8 +1705,8 @@ class ContinuousMap(Morphism):
return self._restrictions[(subdomain, subcodomain)]
# Generic case:
homset = Hom(subdomain, subcodomain)
- resu = self.__class__(homset, name=self._name,
- latex_name=self._latex_name)
+ resu = type(self)(homset, name=self._name,
+ latex_name=self._latex_name)
for charts in self._coord_expression:
for ch1 in charts[0]._subcharts:
if ch1._domain.is_subset(subdomain):
@@ -1714,8 +1740,7 @@ class ContinuousMap(Morphism):
The inverse of a rotation in the Euclidean plane::
- sage: TopManifold._clear_cache_() # for doctests only
- sage: M = TopManifold(2, 'R^2', r'\RR^2')
+ sage: M = Manifold(2, 'R^2', latex_name=r'\RR^2', type='topological')
sage: c_cart.<x,y> = M.chart()
sage: # A pi/3 rotation around the origin:
sage: rot = M.homeomorphism(M, ((x - sqrt(3)*y)/2, (sqrt(3)*x + y)/2),
@@ -1751,7 +1776,7 @@ class ContinuousMap(Morphism):
An example with multiple charts: the equatorial symmetry on the
2-sphere::
- sage: M = TopManifold(2, 'M') # the 2-dimensional sphere S^2
+ sage: M = Manifold(2, 'M', type='topological') # the 2-dimensional sphere S^2
sage: U = M.open_subset('U') # complement of the North pole
sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
sage: V = M.open_subset('V') # complement of the South pole
@@ -1820,9 +1845,9 @@ class ContinuousMap(Morphism):
else:
latex_name = self._latex_name + r'^{-1}'
homset = Hom(self._codomain, self._domain)
- self._inverse = self.__class__(homset, coord_functions=coord_functions,
- name=name, latex_name=latex_name,
- is_isomorphism=True)
+ self._inverse = type(self)(homset, coord_functions=coord_functions,
+ name=name, latex_name=latex_name,
+ is_isomorphism=True)
return self._inverse
inverse = __invert__
diff --git a/src/sage/manifolds/coord_func.py b/src/sage/manifolds/coord_func.py
index fc4def0..89551fb 100644
--- a/src/sage/manifolds/coord_func.py
+++ b/src/sage/manifolds/coord_func.py
@@ -69,7 +69,7 @@ class CoordFunction(SageObject):
TEST::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -92,7 +92,7 @@ class CoordFunction(SageObject):
EXAMPLE::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(1+x+y^2)
sage: f.chart()
@@ -126,7 +126,7 @@ class CoordFunction(SageObject):
Construction of a scalar field 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: fc = c_xy.function(x+2*y^3)
sage: f = fc.scalar_field() ; f
@@ -157,7 +157,7 @@ class CoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(x+y)
sage: g = X.function(x*y)
@@ -168,7 +168,7 @@ class CoordFunction(SageObject):
False
"""
- return not self.__eq__(other)
+ return not (self == other)
def __radd__(self, other):
r"""
@@ -185,7 +185,7 @@ class CoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(x+y)
sage: g = X.function(x*y)
@@ -214,7 +214,7 @@ class CoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(x+y)
sage: g = X.function(x*y)
@@ -243,7 +243,7 @@ class CoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(x+y)
sage: g = X.function(x*y)
@@ -272,7 +272,7 @@ class CoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(x+y)
sage: g = X.function(x*y)
@@ -301,7 +301,7 @@ class CoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(x+y)
sage: g = X.function(x*y)
@@ -332,7 +332,7 @@ class CoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(x+y)
sage: g = X.function(x*y)
@@ -361,7 +361,7 @@ class CoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(x+y)
sage: g = X.function(x*y)
@@ -390,7 +390,7 @@ class CoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(x+y)
sage: g = X.function(x*y)
@@ -417,7 +417,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -438,7 +438,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -459,7 +459,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -488,7 +488,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -521,7 +521,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -542,7 +542,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -567,7 +567,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -601,7 +601,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -630,12 +630,12 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
sage: g = CoordFunction(X)
- sage: f.__eq__(g)
+ sage: f == g
Traceback (most recent call last):
...
NotImplementedError: CoordFunction.__eq__ not implemented
@@ -656,7 +656,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -681,7 +681,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -711,7 +711,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -741,7 +741,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -771,7 +771,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -801,7 +801,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -831,7 +831,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -857,7 +857,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -889,7 +889,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -920,7 +920,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -947,7 +947,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -973,7 +973,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -999,7 +999,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -1025,7 +1025,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -1051,7 +1051,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -1077,7 +1077,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -1103,7 +1103,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -1129,7 +1129,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -1155,7 +1155,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -1181,7 +1181,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -1207,7 +1207,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -1233,7 +1233,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -1259,7 +1259,7 @@ class CoordFunction(SageObject):
This method must be implemented by derived classes; it is not
implemented here::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: from sage.manifolds.coord_func import CoordFunction
sage: f = CoordFunction(X)
@@ -1309,7 +1309,7 @@ class MultiCoordFunction(SageObject):
A function `f: V\subset \RR^2 \longrightarrow \RR^3`::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y, cos(x)*exp(y)); f
Coordinate functions (x - y, x*y, cos(x)*e^y) on the Chart (M, (x, y))
@@ -1373,7 +1373,7 @@ class MultiCoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(3, 'M')
+ sage: M = Manifold(3, 'M', type='topological')
sage: X.<x,y,z> = M.chart()
sage: f = X.multifunction(x+y+z, x*y*z); f
Coordinate functions (x + y + z, x*y*z) on the Chart (M, (x, y, z))
@@ -1397,7 +1397,7 @@ class MultiCoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y, cos(x)*exp(y))
sage: f._repr_()
@@ -1415,7 +1415,7 @@ class MultiCoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y, cos(x)*exp(y))
sage: f._latex_()
@@ -1441,7 +1441,7 @@ class MultiCoordFunction(SageObject):
EXAMPLE::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y, cos(x)*exp(y))
sage: f.expr()
@@ -1467,7 +1467,7 @@ class MultiCoordFunction(SageObject):
EXAMPLE::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y, cos(x)*exp(y))
sage: f.chart()
@@ -1494,7 +1494,7 @@ class MultiCoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y, cos(x*y))
sage: f == X.multifunction(x-y, x*y)
@@ -1508,6 +1508,8 @@ class MultiCoordFunction(SageObject):
False
"""
+ if other is self:
+ return True
if not isinstance(other, MultiCoordFunction):
return False
if other._chart != self._chart:
@@ -1534,7 +1536,7 @@ class MultiCoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y, cos(x*y))
sage: f != X.multifunction(x-y, x*y)
@@ -1545,7 +1547,35 @@ class MultiCoordFunction(SageObject):
False
"""
- return not self.__eq__(other)
+ return not (self == other)
+
+ def _test_pickling(self, **options):
+ r"""
+ Test pickling.
+
+ This test is weaker than
+ :meth:`sage.structure.sage_object.SageObject._test_pickling` in that
+ it does not require ``loads(dumps(self)) == self``.
+ It however checks that ``loads(dumps(self))`` proceeds without any
+ error and results in an object that is a multi-coordinate function
+ of the same type as ``self`` and with the same coordinate expressions.
+
+ TEST::
+
+ sage: M = Manifold(2, 'M', type='topological')
+ sage: X.<x,y> = M.chart()
+ sage: f = X.multifunction(x-y, x*y, cos(x*y))
+ sage: f._test_pickling()
+
+ """
+ tester = self._tester(**options)
+ from sage.misc.all import loads, dumps
+ bckp = loads(dumps(self))
+ tester.assertEqual(type(bckp), type(self))
+ tester.assertEqual(bckp._nf, self._nf)
+ for i in range(self._nf):
+ tester.assertEqual(bckp._functions[i]._express,
+ self._functions[i]._express)
def __getitem__(self, index):
r"""
@@ -1561,7 +1591,7 @@ class MultiCoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y, cos(x*y))
sage: f.__getitem__(0)
@@ -1594,7 +1624,7 @@ class MultiCoordFunction(SageObject):
TESTS::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y, cos(x*y))
sage: f.__call__(2,3)
@@ -1628,7 +1658,7 @@ class MultiCoordFunction(SageObject):
Jacobian of a set of 3 functions of 2 coordinates::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y, y^3*cos(x))
sage: f.jacobian()
@@ -1648,7 +1678,7 @@ class MultiCoordFunction(SageObject):
Test with ``start_index=1``::
- sage: M = TopManifold(2, 'M', start_index=1)
+ sage: M = Manifold(2, 'M', type='topological', start_index=1)
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y, y^3*cos(x))
sage: f.jacobian()
@@ -1679,8 +1709,7 @@ class MultiCoordFunction(SageObject):
Jacobian determinant of a set of 2 functions of 2 coordinates::
- sage: M = TopManifold(3, 'M')
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.multifunction(x-y, x*y)
sage: f.jacobian_det()
@@ -1710,7 +1739,7 @@ class MultiCoordFunction(SageObject):
Jacobian determinant of a set of 3 functions of 3 coordinates::
- sage: M = TopManifold(3, 'M')
+ sage: M = Manifold(3, 'M', type='topological')
sage: X.<x,y,z> = M.chart()
sage: f = X.multifunction(x*y+z^2, z^2*x+y^2*z, (x*y*z)^3)
sage: f.jacobian_det().display()
diff --git a/src/sage/manifolds/coord_func_symb.py b/src/sage/manifolds/coord_func_symb.py
index 6463771..6872152 100644
--- a/src/sage/manifolds/coord_func_symb.py
+++ b/src/sage/manifolds/coord_func_symb.py
@@ -37,7 +37,6 @@ AUTHORS:
#*****************************************************************************
from sage.symbolic.ring import SR
-from sage.rings.real_mpfr import RR
from sage.structure.element import RingElement
from sage.misc.latex import latex
from sage.manifolds.coord_func import CoordFunction, MultiCoordFunction
@@ -74,7 +73,7 @@ class CoordFunctionSymb(CoordFunction):
A symbolic coordinate function associated with a 2-dimensional chart::
- sage: M = TopManifold(2, 'M')
+ sage: M = Manifold(2, 'M', type='topological')
sage: X.<x,y> = M.chart()
sage: f = X.function(x^2+3*y+1)
sage: type(f)
@@ -109,7 +108,7 @@ class CoordFunctionSymb(CoordFunction):
An unspecified coordinate function::
- sage: g = X.function(function('G', x, y))
+ sage: g = X.function(function('G')(x, y))
sage: g
G(x, y)
sage: g.display()
@@ -186,7 +185,7 @@ class CoordFunctionSymb(CoordFunction):
Another difference regards the display of partial derivatives: for callable
symbolic functions, it relies on Pynac notation ``D[0]``, ``D[1]``, etc.::
- sage: g = function('g', x, y)
+ sage: g = function('g')(x, y)
sage: f0(x,y) = diff(g, x) + diff(g, y)
sage: f0
(x, y) |--> D[0](g)(x, y) + D[1](g)(x, y)
@@ -225,10 +224,10 @@ class CoordFunctionSymb(CoordFunction):
callable symbolic expression is the possibility to switch off the display
of the arguments of unspecif