summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-13 23:49:05 +0200
committerEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-10-13 23:49:05 +0200
commit63357e44951ca82a2dccad7657c39189eaeb4d17 (patch)
treeb80dcb8fc2a699a8a812f794779709270a663f46
parentMinor improvements in the doc of top manifolds (scalar fields part) (diff)
Introduce open covers on top manifolds and improve documentation
-rw-r--r--src/sage/manifolds/chart.py2
-rw-r--r--src/sage/manifolds/coord_func.py1
-rw-r--r--src/sage/manifolds/coord_func_symb.py2
-rw-r--r--src/sage/manifolds/manifold.py5
-rw-r--r--src/sage/manifolds/scalarfield_algebra.py39
-rw-r--r--src/sage/manifolds/subset.py69
6 files changed, 106 insertions, 12 deletions
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index 15bd851..4e40187 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -2126,7 +2126,7 @@ class CoordChange(SageObject):
else:
check = True
self._inverse = self.__class__(self._chart2, self._chart1,
- *transformations)
+ *transformations)
if check:
print "Check of the inverse coordinate transformation:"
x1 = self._chart1._xx
diff --git a/src/sage/manifolds/coord_func.py b/src/sage/manifolds/coord_func.py
index 767f17a..fc4def0 100644
--- a/src/sage/manifolds/coord_func.py
+++ b/src/sage/manifolds/coord_func.py
@@ -1658,7 +1658,6 @@ class MultiCoordFunction(SageObject):
[[True, True], [True, True], [True, True]]
"""
- from sage.matrix.constructor import matrix
if self._jacob is None:
xx = self._chart[:] # coordinates x^j
self._jacob = [[ self._functions[i].diff(xx[j])
diff --git a/src/sage/manifolds/coord_func_symb.py b/src/sage/manifolds/coord_func_symb.py
index ca7c6fa..e90b977 100644
--- a/src/sage/manifolds/coord_func_symb.py
+++ b/src/sage/manifolds/coord_func_symb.py
@@ -436,7 +436,7 @@ class CoordFunctionSymb(CoordFunction):
def __call__(self, *coords, **options):
r"""
- Computes the value of the function at specified coordinates.
+ Compute the value of the function at specified coordinates.
INPUT:
diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py
index 883f415..fa4aabe 100644
--- a/src/sage/manifolds/manifold.py
+++ b/src/sage/manifolds/manifold.py
@@ -297,7 +297,6 @@ from sage.categories.fields import Fields
from sage.categories.sets_cat import Sets
#*# After #18175, this should become
# from sage.categories.manifolds import Manifolds
-from sage.misc.latex import latex
from sage.manifolds.subset import TopManifoldSubset
from sage.manifolds.scalarfield_algebra import ScalarFieldAlgebra
@@ -483,6 +482,7 @@ class TopManifold(TopManifoldSubset):
TopManifoldSubset.__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
self._atlas = [] # list of charts defined on subsets of self
self._top_charts = [] # list of charts defined on subsets of self
# that are not subcharts of charts on larger subsets
@@ -830,7 +830,6 @@ class TopManifold(TopManifoldSubset):
yield i
i += 1
-
def index_generator(self, nb_indices):
r"""
Generator of index series.
@@ -1054,7 +1053,6 @@ class TopManifold(TopManifoldSubset):
"been defined on the {}".format(self))
return self._coord_changes[(chart1, chart2)]
-
def coord_changes(self):
r"""
Return the changes of coordinates (transition maps) defined on
@@ -1105,7 +1103,6 @@ class TopManifold(TopManifoldSubset):
"""
return self._coord_changes
-
def is_manifestly_coordinate_domain(self):
r"""
Return ``True`` if the manifold is known to be the domain of some
diff --git a/src/sage/manifolds/scalarfield_algebra.py b/src/sage/manifolds/scalarfield_algebra.py
index 07132f1..ed6bf87 100644
--- a/src/sage/manifolds/scalarfield_algebra.py
+++ b/src/sage/manifolds/scalarfield_algebra.py
@@ -86,7 +86,8 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
topological manifold M
`C^0(M)` and `C^0(W)` belong to the category of commutative
- algebras over `\RR` (represented here by Sage's Symbolic Ring)::
+ algebras over `\RR` (represented here by Sage's
+ :class:`~sage.symbolic.ring.SymbolicRing`)::
sage: CM.category()
Category of commutative algebras over Symbolic Ring
@@ -233,9 +234,14 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
(x, y) |--> 2*arctan(x^2 + y^2)
(u, v) |--> pi - 2*arctan(u^2 + v^2)
- Other coercions are those from the Symbolic Ring, leading to constant
- scalar fields (if the symbolic expression does not involve any chart
- coordinate)::
+ Another coercion is that from the Symbolic Ring, the parent of all
+ symbolic expressions (cf. :class:`~sage.symbolic.ring.SymbolicRing`).
+ Since the Symbolic Ring is the base ring for the algebra ``CM``, the
+ coercion of a symbolic expression ``s`` is performed by the operation
+ ``s*CM.one()``, which invokes the reflected multiplication operator
+ :meth:`sage.manifolds.scalarfield.ScalarField._rmul_`. If the symbolic
+ expression does not involve any chart coordinate, the outcome is a
+ constant scalar field::
sage: h = CM(pi*sqrt(2)) ; h
Scalar field on the 2-dimensional topological manifold M
@@ -243,11 +249,34 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
M --> R
on U: (x, y) |--> sqrt(2)*pi
on V: (u, v) |--> sqrt(2)*pi
+ sage: a = var('a')
+ sage: h = CM(a); h.display()
+ M --> R
+ on U: (x, y) |--> a
+ on V: (u, v) |--> a
+
+ If the symbolic expression involves some coordinate of one of the
+ manifold's charts, the outcome is initialized only on the chart domain::
+
+ sage: h = CM(a+x); h.display()
+ M --> R
+ on U: (x, y) |--> a + x
+ sage: h = CM(a+u); h.display()
+ M --> R
+ on V: (u, v) |--> a + u
+
+ If the symbolic expression involves coordinates of different charts,
+ the scalar field is created as a Python object, but is not initialized,
+ in order to avoid any ambiguity::
+
+ sage: h = CM(x+u); h.display()
+ M --> R
- TESTS OF THE ALGEBRA LAWS:
+ .. RUBRIC:: TESTS OF THE ALGEBRA LAWS:
Ring laws::
+ sage: h = CM(pi*sqrt(2))
sage: s = f + h ; s
Scalar field on the 2-dimensional topological manifold M
sage: s.display()
diff --git a/src/sage/manifolds/subset.py b/src/sage/manifolds/subset.py
index b88e1e5..4fb66c8 100644
--- a/src/sage/manifolds/subset.py
+++ b/src/sage/manifolds/subset.py
@@ -201,6 +201,7 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
# (key: subset name)
self._unions = {} # dict. of unions with other subsets (key: subset
# name)
+ self._open_covers = [] # list of open covers of self
self._is_open = False # a priori (may be redifined by subclasses)
#### Methods required for any Parent in the category of sets:
@@ -374,6 +375,54 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
"""
return self._manifold
+ def open_covers(self):
+ r"""
+ Return the list of open covers of the current subset.
+
+ If the current subset, `A` say, is a subset of the manifold `M`, an
+ *open cover* of `A` is list (indexed set) `(U_i)_{i\in I}` of
+ open subsets of `M` such that
+
+ .. MATH::
+
+ A \subset \bigcup_{i \in I} U_i
+
+ If `A` is open, we ask that the above inclusion is actually an
+ identity:
+
+ .. MATH::
+
+ A = \bigcup_{i \in I} U_i
+
+ EXAMPLES::
+
+ sage: TopManifold._clear_cache_() # for doctests only
+ sage: M = TopManifold(2, 'M')
+ sage: M.open_covers()
+ [[2-dimensional topological manifold M]]
+ sage: U = M.open_subset('U')
+ sage: U.open_covers()
+ [[Open subset U of the 2-dimensional topological manifold M]]
+ sage: A = U.open_subset('A')
+ sage: B = U.open_subset('B')
+ sage: U.declare_union(A,B)
+ sage: U.open_covers()
+ [[Open subset U of the 2-dimensional topological manifold M],
+ [Open subset A of the 2-dimensional topological manifold M,
+ Open subset B of the 2-dimensional topological manifold M]]
+ sage: V = M.open_subset('V')
+ sage: M.declare_union(U,V)
+ sage: M.open_covers()
+ [[2-dimensional topological manifold M],
+ [Open subset U of the 2-dimensional topological manifold M,
+ Open subset V of the 2-dimensional topological manifold M],
+ [Open subset A of the 2-dimensional topological manifold M,
+ Open subset B of the 2-dimensional topological manifold M,
+ Open subset V of the 2-dimensional topological manifold M]]
+
+ """
+ return self._open_covers
+
def subsets(self):
r"""
Return the set of subsets that have been defined on the current subset.
@@ -768,6 +817,14 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
res._coord_changes.update(other._coord_changes)
self._unions[other._name] = res
other._unions[self._name] = res
+ # Open covers of the union:
+ for oc1 in self._open_covers:
+ for oc2 in other._open_covers:
+ oc = oc1[:]
+ for s in oc2:
+ if s not in oc:
+ oc.append(s)
+ res._open_covers.append(oc)
return res
def declare_union(self, dom1, dom2):
@@ -796,6 +853,11 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
2-dimensional topological manifold M
"""
+ if dom1 == dom2:
+ if dom1 != self:
+ raise ValueError("the union of two identical sets must be " +
+ "this set")
+ return
if not dom1.is_subset(self):
raise TypeError("the {} is not a subset of ".format(dom1) +
"the {}".format(self))
@@ -804,6 +866,13 @@ class TopManifoldSubset(UniqueRepresentation, Parent):
"the {}".format(self))
dom1._unions[dom2._name] = self
dom2._unions[dom1._name] = self
+ for oc1 in dom1._open_covers:
+ for oc2 in dom2._open_covers:
+ oc = oc1[:]
+ for s in oc2:
+ if s not in oc:
+ oc.append(s)
+ self._open_covers.append(oc)
def is_subset(self, other):
r"""