summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-06-23 17:39:34 +0200
committerEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-06-23 17:39:34 +0200
commita4b414cb74b4cec8f96bf4a699e73d8c35b46c13 (patch)
treef25d70369696472b13e749d9aedcdd8838b3991e
parentRemove unnecessary import in chart.py (diff)
Modifications in CoordChange and TopManifold.__init__ to allow for subclasses.
Remove unnecessary imports in scalarfield_algebra.py.
-rw-r--r--src/sage/manifolds/chart.py11
-rw-r--r--src/sage/manifolds/manifold.py29
-rw-r--r--src/sage/manifolds/scalarfield_algebra.py2
3 files changed, 20 insertions, 22 deletions
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index 23255b3..15d98ef 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -34,9 +34,7 @@ REFERENCES:
from sage.structure.sage_object import SageObject
from sage.structure.unique_representation import UniqueRepresentation
-from sage.structure.element import RingElement
from sage.symbolic.ring import SR
-from sage.rings.integer import Integer
from sage.rings.infinity import Infinity
from sage.misc.latex import latex
from sage.manifolds.manifold import TopManifold
@@ -868,7 +866,6 @@ class Chart(UniqueRepresentation, SageObject):
sin(6)
"""
- from sage.manifolds.coord_func_symb import CoordFunctionSymb
if isinstance(expression, str):
raise NotImplementedError("numerical coordinate function not " +
"implemented yet")
@@ -2042,7 +2039,7 @@ class CoordChange(SageObject):
"transformation; use set_inverse() to set the inverse " +
"manually")
x2_to_x1 = list_x2_to_x1[0]
- self._inverse = CoordChange(self._chart2, self._chart1, *x2_to_x1)
+ self._inverse = self.__class__(self._chart2, self._chart1, *x2_to_x1)
return self._inverse
@@ -2100,7 +2097,7 @@ class CoordChange(SageObject):
check = kwds['check']
else:
check = True
- self._inverse = CoordChange(self._chart2, self._chart1,
+ self._inverse = self.__class__(self._chart2, self._chart1,
*transformations)
if check:
print "Check of the inverse coordinate transformation:"
@@ -2148,7 +2145,7 @@ class CoordChange(SageObject):
"{} is different from {}".format(other._chart2,
other._chart1))
transf = self._transf(*(other._transf.expr()))
- return CoordChange(other._chart1, self._chart2, *transf)
+ return self.__class__(other._chart1, self._chart2, *transf)
def restrict(self, dom1, dom2=None):
r"""
@@ -2181,7 +2178,7 @@ class CoordChange(SageObject):
"""
if dom2 is None:
dom2 = dom1
- return CoordChange(self._chart1.restrict(dom1),
+ return self.__class__(self._chart1.restrict(dom1),
self._chart2.restrict(dom2), *(self._transf.expr()))
def display(self):
diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py
index dfc3b57..8a70af5 100644
--- a/src/sage/manifolds/manifold.py
+++ b/src/sage/manifolds/manifold.py
@@ -271,7 +271,6 @@ REFERENCES:
# http://www.gnu.org/licenses/
#*****************************************************************************
-from sage.structure.unique_representation import UniqueRepresentation
from sage.categories.fields import Fields
#*# Before #18175:
from sage.categories.sets_cat import Sets
@@ -308,12 +307,12 @@ class TopManifold(TopManifoldSubset):
- 'real' for a manifold over `\RR`
- 'complex' for a manifold over `\CC`
- - any object in the category of fields (see
+ - an object in the category of fields (see
:class:`~sage.categories.fields.Fields`) for more general manifolds
- ``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.
+ in a chart
- ``category`` -- (default: ``None``) to specify the categeory; the
default being ``Sets()`` (``Manifolds()`` after :trac:`18175` is
implemented)
@@ -481,16 +480,16 @@ class TopManifold(TopManifoldSubset):
# that are not subcharts of charts on larger subsets
self._def_chart = None # default chart
self._coord_changes = {} # dictionary of transition maps
- # list of charts that individually cover self, i.e. whose
+ # List of charts that individually cover self, i.e. whose
# domains are self (if non-empty, self is a coordinate domain):
self._covering_charts = []
- # algebra of scalar fields defined on self:
- self._scalar_field_algebra = ScalarFieldAlgebra(self)
- # the zero scalar field:
- self._zero_scalar_field = self._scalar_field_algebra.zero()
- # the unit scalar field:
- self._one_scalar_field = self._scalar_field_algebra.one()
- # the identity map on self:
+ # Algebra of scalar fields defined on self:
+ self._scalar_field_algebra = None # to be set by self.scalar_field_algebra()
+ # The zero scalar field:
+ self._zero_scalar_field = self.scalar_field_algebra().zero()
+ # The unit scalar field:
+ self._one_scalar_field = self.scalar_field_algebra().one()
+ # The identity map on self:
self._identity_map = Hom(self, self).one()
def _repr_(self):
@@ -1131,7 +1130,9 @@ class TopManifold(TopManifoldSubset):
Create an open subset of the manifold.
An open subset is a set that is (i) included in the manifold and (ii)
- open with respect to the manifold's topology.
+ 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`.
INPUT:
@@ -1340,7 +1341,7 @@ class TopManifold(TopManifoldSubset):
def scalar_field_algebra(self):
r"""
- Returns the algebra of scalar fields defined the manifold
+ Return the algebra of scalar fields defined the manifold.
See :class:`~sage.manifolds.scalarfield_algebra.ScalarFieldAlgebra`
for a complete documentation.
@@ -1367,6 +1368,8 @@ class TopManifold(TopManifoldSubset):
Scalar field zero on the Open subset U of the 3-dimensional topological manifold M
"""
+ if self._scalar_field_algebra is None:
+ self._scalar_field_algebra = ScalarFieldAlgebra(self)
return self._scalar_field_algebra
def scalar_field(self, coord_expression=None, chart=None, name=None,
diff --git a/src/sage/manifolds/scalarfield_algebra.py b/src/sage/manifolds/scalarfield_algebra.py
index eb3a50a..5cf30ec 100644
--- a/src/sage/manifolds/scalarfield_algebra.py
+++ b/src/sage/manifolds/scalarfield_algebra.py
@@ -35,8 +35,6 @@ REFERENCES:
from sage.structure.parent import Parent
from sage.structure.unique_representation import UniqueRepresentation
from sage.categories.commutative_algebras import CommutativeAlgebras
-from sage.rings.integer_ring import ZZ
-from sage.rings.rational_field import QQ
from sage.symbolic.ring import SR
from sage.manifolds.scalarfield import ScalarField