summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRelease Manager <release@sagemath.org>2016-05-16 11:10:03 +0200
committerVolker Braun <vbraun.name@gmail.com>2016-05-16 11:10:03 +0200
commita2777c9887415c0772be9288c1ce0333b54a11f5 (patch)
tree5c40ef846ad5eae68c9320320c0e61f6c0708d17
parentTrac #18265: Axioms for semigroups: L,R,J,H-trivial, aperiodic (diff)
parentPython 3 format for print in manifolds (diff)
Trac #18640: Topological manifolds: scalar fields
This ticket implements scalar fields on topological manifolds. This is a follow up of ticket #18529 within the [http://sagemanifolds.obspm.fr/ SageManifolds project]. See the metaticket #18528 for an overview. By ''scalar field'', it is meant a continuous map f: M --> K, where K is a topological field and M a topological manifold over K. This ticket implements the following Python classes: - `CoordFunction`: abstract base class for coordinate functions, i.e. functions V\subset K^n^ --> K, where V is some chart codomain and n=dim(M) - `CoordFunctionSymb`: symbolic coordinate functions - `MultiCoordFunction`: functions V\subset K^n^ --> K^m^, where V is some chart codomain and m some positive integer - `ScalarFieldAlgebra`: set C^0^(M) of scalar fields M --> K as a commutative algebra over K (Parent class) - `ScalarField`: scalar field M --> K (Element class) - `ExpressionNice`: a subclass of `sage.symbolic.expression.Expression` with enhanced display of callable symbolic expressions Internally, `ScalarField`'s are described by their coordinate representations in various charts, which are implemented as a dictionary of `CoordFunction`'s, with the charts as keys. At the moment, there is only one concrete class for coordinate functions: `CoordFunctionSymb` (functions described by symbolic expressions of the coordinates), but in the future there should be numerical coordinate functions (hence the abstract base class `CoordFunction`). '''Documentation''': The reference manual is produced by `sage -docbuild reference/manifolds html` It can also be accessed online at http://sagemanifolds.obspm.fr/doc/18640/reference/manifolds/ More documentation (e.g. example worksheets) can be found [http://sagemanifolds.obspm.fr/documentation.html here]. URL: http://trac.sagemath.org/18640 Reported by: egourgoulhon Ticket author(s): Eric Gourgoulhon, Michal Bejger, Travis Scrimshaw Reviewer(s): Travis Scrimshaw, Eric Gourgoulhon
-rw-r--r--src/doc/en/reference/manifolds/chart.rst11
-rw-r--r--src/doc/en/reference/manifolds/index.rst4
-rw-r--r--src/doc/en/reference/manifolds/manifold.rst4
-rw-r--r--src/doc/en/reference/manifolds/scalarfield.rst9
-rw-r--r--src/sage/doctest/sources.py1
-rw-r--r--src/sage/manifolds/chart.py327
-rw-r--r--src/sage/manifolds/coord_func.py1451
-rw-r--r--src/sage/manifolds/coord_func_symb.py1762
-rw-r--r--src/sage/manifolds/manifold.py398
-rw-r--r--src/sage/manifolds/point.py4
-rw-r--r--src/sage/manifolds/scalarfield.py2773
-rw-r--r--src/sage/manifolds/scalarfield_algebra.py621
-rw-r--r--src/sage/manifolds/structure.py3
-rw-r--r--src/sage/manifolds/utilities.py837
14 files changed, 8139 insertions, 66 deletions
diff --git a/src/doc/en/reference/manifolds/chart.rst b/src/doc/en/reference/manifolds/chart.rst
new file mode 100644
index 00000000..0ba9dc6
--- /dev/null
+++ b/src/doc/en/reference/manifolds/chart.rst
@@ -0,0 +1,11 @@
+Coordinate Charts
+=================
+
+.. toctree::
+ :maxdepth: 2
+
+ sage/manifolds/chart
+
+ sage/manifolds/coord_func
+
+ sage/manifolds/coord_func_symb
diff --git a/src/doc/en/reference/manifolds/index.rst b/src/doc/en/reference/manifolds/index.rst
index f0d5932..13995d6 100644
--- a/src/doc/en/reference/manifolds/index.rst
+++ b/src/doc/en/reference/manifolds/index.rst
@@ -11,8 +11,10 @@ More documentation (in particular example worksheets) can be found
`here <http://sagemanifolds.obspm.fr/documentation.html>`_.
.. toctree::
- :maxdepth: 2
+ :maxdepth: 3
manifold
+ sage/manifolds/utilities
+
.. include:: ../footer.txt
diff --git a/src/doc/en/reference/manifolds/manifold.rst b/src/doc/en/reference/manifolds/manifold.rst
index d9364a3..3ac4f04 100644
--- a/src/doc/en/reference/manifolds/manifold.rst
+++ b/src/doc/en/reference/manifolds/manifold.rst
@@ -12,4 +12,6 @@ Topological Manifolds
sage/manifolds/point
- sage/manifolds/chart
+ chart
+
+ scalarfield
diff --git a/src/doc/en/reference/manifolds/scalarfield.rst b/src/doc/en/reference/manifolds/scalarfield.rst
new file mode 100644
index 00000000..3ba7a2e
--- /dev/null
+++ b/src/doc/en/reference/manifolds/scalarfield.rst
@@ -0,0 +1,9 @@
+Scalar Fields
+=============
+
+.. toctree::
+ :maxdepth: 2
+
+ sage/manifolds/scalarfield_algebra
+
+ sage/manifolds/scalarfield
diff --git a/src/sage/doctest/sources.py b/src/sage/doctest/sources.py
index afd2562..67d2c5f 100644
--- a/src/sage/doctest/sources.py
+++ b/src/sage/doctest/sources.py
@@ -717,6 +717,7 @@ class FileDocTestSource(DocTestSource):
There are 8 tests in sage/combinat/root_system/type_G.py that are not being run
There are 3 unexpected tests being run in sage/doctest/parsing.py
There are 1 unexpected tests being run in sage/doctest/reporting.py
+ There are 15 tests in sage/manifolds/manifold.py that are not being run
There are 3 tests in sage/rings/invariant_theory.py that are not being run
sage: os.chdir(cwd)
"""
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index 6a6194b..63b583a 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -16,10 +16,10 @@ AUTHORS:
REFERENCES:
-- Chap. 2 of [Lee11]_ J.M. Lee: *Introduction to Topological Manifolds*,
+- Chap. 2 of [Lee11]_ \J.M. Lee: *Introduction to Topological Manifolds*,
2nd ed., Springer (New York) (2011)
-- Chap. 1 of [Lee13]_ J.M. Lee : *Introduction to Smooth Manifolds*,
+- Chap. 1 of [Lee13]_ \J.M. Lee : *Introduction to Smooth Manifolds*,
2nd ed., Springer (New York) (2013)
"""
@@ -40,6 +40,7 @@ from sage.structure.unique_representation import UniqueRepresentation
from sage.symbolic.ring import SR
from sage.rings.infinity import Infinity
from sage.misc.latex import latex
+from sage.manifolds.coord_func_symb import CoordFunctionSymb
class Chart(UniqueRepresentation, SageObject):
r"""
@@ -309,6 +310,17 @@ class Chart(UniqueRepresentation, SageObject):
self._dom_restrict = {} # dict. of the restrictions of self to
# subsets of self._domain, with the
# subsets as keys
+ # The null and one functions of the coordinates:
+ base_field_type = self._domain.base_field_type()
+ # Expression in self of the zero and one scalar fields of open sets
+ # containing the domain of self:
+ for dom in self._domain._supersets:
+ if hasattr(dom, '_zero_scalar_field'):
+ # dom is an open set
+ dom._zero_scalar_field._express[self] = self.function_ring().zero()
+ if hasattr(dom, '_one_scalar_field'):
+ # dom is an open set
+ dom._one_scalar_field._express[self] = self.function_ring().one()
def _init_coordinates(self, coord_list):
r"""
@@ -825,6 +837,252 @@ class Chart(UniqueRepresentation, SageObject):
transformations = [transformations]
return CoordChange(chart1, chart2, *transformations)
+ def function_ring(self):
+ """
+ Return the ring of coordinate functions on ``self``.
+
+ EXAMPLES::
+
+ sage: M = Manifold(2, 'M', structure='topological')
+ sage: X.<x,y> = M.chart()
+ sage: X.function_ring()
+ Ring of coordinate functions on Chart (M, (x, y))
+ """
+ from sage.manifolds.coord_func_symb import CoordFunctionSymbRing
+ return CoordFunctionSymbRing(self)
+
+ def function(self, expression):
+ r"""
+ Define a coordinate function to the base field.
+
+ If the current chart belongs to the atlas of a `n`-dimensional manifold
+ over a topological field `K`, a *coordinate function* is a map
+
+ .. MATH::
+
+ \begin{array}{cccc}
+ f:& V\subset K^n & \longrightarrow & K \\
+ & (x^1,\ldots, x^n) & \longmapsto & f(x^1,\ldots, x^n),
+ \end{array}
+
+ where `V` is the chart codomain and `(x^1,\ldots, x^n)` are the
+ chart coordinates.
+
+ The coordinate function can be either a symbolic one or a numerical
+ one, depending on the parameter ``expression`` (see below).
+
+ See :class:`~sage.manifolds.coord_func.CoordFunction`
+ and :class:`~sage.manifolds.coord_func_symb.CoordFunctionSymb`
+ for a complete documentation.
+
+ INPUT:
+
+ - ``expression`` -- material defining the coordinate function; it can
+ be either:
+
+ - a symbolic expression involving the chart coordinates, to represent
+ `f(x^1,\ldots, x^n)`
+ - a string representing the name of a file where the data
+ to construct a numerical coordinate function is stored
+
+ OUTPUT:
+
+ - instance of a subclass of the base class
+ :class:`~sage.manifolds.coord_func.CoordFunction`
+ representing the coordinate function `f`; this is
+ :class:`~sage.manifolds.coord_func_symb.CoordFunctionSymb` if
+ if ``expression`` is a symbolic expression.
+
+ EXAMPLES:
+
+ A symbolic coordinate function::
+
+ sage: M = Manifold(2, 'M', structure='topological')
+ sage: X.<x,y> = M.chart()
+ sage: f = X.function(sin(x*y))
+ sage: f
+ sin(x*y)
+ sage: type(f)
+ <class 'sage.manifolds.coord_func_symb.CoordFunctionSymbRing_with_category.element_class'>
+ sage: f.display()
+ (x, y) |--> sin(x*y)
+ sage: f(2,3)
+ sin(6)
+
+ """
+ if isinstance(expression, str):
+ raise NotImplementedError("numerical coordinate function not " +
+ "implemented yet")
+ else:
+ return self.function_ring()(expression)
+
+ def zero_function(self):
+ r"""
+ Return the zero function of the coordinates.
+
+ If the current chart belongs to the atlas of a `n`-dimensional manifold
+ over a topological field `K`, the zero coordinate function is the map
+
+ .. MATH::
+
+ \begin{array}{cccc}
+ f:& V\subset K^n & \longrightarrow & K \\
+ & (x^1,\ldots, x^n) & \longmapsto & 0,
+ \end{array}
+
+ where `V` is the chart codomain.
+
+ See class :class:`~sage.manifolds.coord_func_symb.CoorFunctionSymb`
+ for a complete documentation.
+ OUTPUT:
+
+ - instance of class
+ :class:`~sage.manifolds.coord_func_symb.CoorFunctionSymb`
+ representing the zero coordinate function `f`.
+
+ EXAMPLES::
+
+ sage: M = Manifold(2, 'M', structure='topological')
+ sage: X.<x,y> = M.chart()
+ sage: X.zero_function()
+ 0
+ sage: X.zero_function().display()
+ (x, y) |--> 0
+ sage: type(X.zero_function())
+ <class 'sage.manifolds.coord_func_symb.CoordFunctionSymbRing_with_category.element_class'>
+
+ The result is cached::
+
+ sage: X.zero_function() is X.zero_function()
+ True
+
+ Zero function on a p-adic manifold::
+
+ sage: M = Manifold(2, 'M', structure='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()
+ sage: X.zero_function()
+ 0
+ sage: X.zero_function().display()
+ (x, y) |--> 0
+
+ """
+ return self.function_ring().zero()
+
+ def one_function(self):
+ r"""
+ Return the constant function of the coordinates equal to one.
+
+ If the current chart belongs to the atlas of a `n`-dimensional manifold
+ over a topological field `K`, the "one" coordinate function is the map
+
+ .. MATH::
+
+ \begin{array}{cccc}
+ f:& V\subset K^n & \longrightarrow & K \\
+ & (x^1,\ldots, x^n) & \longmapsto & 1,
+ \end{array}
+
+ where `V` is the chart codomain.
+
+ See class :class:`~sage.manifolds.coord_func_symb.CoorFunctionSymb`
+ for a complete documentation.
+ OUTPUT:
+
+ - instance of class
+ :class:`~sage.manifolds.coord_func_symb.CoorFunctionSymb`
+ representing the one coordinate function `f`.
+
+ EXAMPLES::
+
+ sage: M = Manifold(2, 'M', structure='topological')
+ sage: X.<x,y> = M.chart()
+ sage: X.one_function()
+ 1
+ sage: X.one_function().display()
+ (x, y) |--> 1
+ sage: type(X.one_function())
+ <class 'sage.manifolds.coord_func_symb.CoordFunctionSymbRing_with_category.element_class'>
+
+ The result is cached::
+
+ sage: X.one_function() is X.one_function()
+ True
+
+ One function on a p-adic manifold::
+
+ sage: M = Manifold(2, 'M', structure='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()
+ sage: X.one_function()
+ 1 + O(5^20)
+ sage: X.one_function().display()
+ (x, y) |--> 1 + O(5^20)
+
+ """
+ return self.function_ring().one()
+
+
+ def multifunction(self, *expressions):
+ r"""
+ Define a coordinate function to some Cartesian power of the base field.
+
+ If `n` and `m` are two positive integers and `(U, \varphi)` is a
+ chart on a topological manifold `M` of dimension `n` over a
+ topological field `K`, a *multi-coordinate function* associated
+ to `(U,\varphi)` is a map
+
+ .. MATH::
+
+ \begin{array}{llcl}
+ f:& V \subset K^n & \longrightarrow & K^m \\
+ & (x^1, \ldots, x^n) & \longmapsto & (f_1(x^1, \ldots, x^n),
+ \ldots, f_m(x^1, \ldots, x^n)),
+ \end{array}
+
+ where `V` is the codomain of `\varphi`. In other words, `f` is a