summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-08-23 18:12:39 +0200
committerEric Gourgoulhon <eric.gourgoulhon@obspm.fr>2015-08-23 18:12:39 +0200
commitba5d142ab94093638d2769d9cf5cb4fc2b3d16ac (patch)
tree892b73ad888bdf0b836f6983b423a98716074c4c
parentMinor modifications in CoordFunctionSymb (diff)
Improvement in simplify_sqrt_real() and in the documentation.
-rw-r--r--src/doc/en/reference/manifolds/index.rst8
-rw-r--r--src/sage/manifolds/chart.py16
-rw-r--r--src/sage/manifolds/manifold.py46
-rw-r--r--src/sage/manifolds/scalarfield_algebra.py31
-rw-r--r--src/sage/manifolds/utilities.py12
5 files changed, 37 insertions, 76 deletions
diff --git a/src/doc/en/reference/manifolds/index.rst b/src/doc/en/reference/manifolds/index.rst
index 5d0cb0e..dc41530 100644
--- a/src/doc/en/reference/manifolds/index.rst
+++ b/src/doc/en/reference/manifolds/index.rst
@@ -1,8 +1,8 @@
-Manifolds and tensor fields
-===========================
+Manifolds
+=========
-This is the Sage implementation of manifolds and tensor fields
-resulting from the `SageManifolds project <http://sagemanifolds.obspm.fr/>`_.
+This is the Sage implementation of manifolds resulting from the
+`SageManifolds project <http://sagemanifolds.obspm.fr/>`_.
This section describes only the "manifold" part of SageManifolds;
the pure algebraic part is described in the section
:ref:`tensors-on-free-modules`.
diff --git a/src/sage/manifolds/chart.py b/src/sage/manifolds/chart.py
index 5e5eab1..bc1b8e7 100644
--- a/src/sage/manifolds/chart.py
+++ b/src/sage/manifolds/chart.py
@@ -1,5 +1,5 @@
r"""
-Coordinate charts on topological manifolds
+Coordinate charts
The class :class:`Chart` implements coordinate charts on a topological manifold
over a topological field `K`. The subclass :class:`RealChart` is devoted
@@ -50,8 +50,8 @@ class Chart(UniqueRepresentation, SageObject):
an open subset `V` of `K^n`.
The components `(x^1,\ldots,x^n)` of `\varphi`, defined by
- `\varphi(p) = (x^1(p),\ldots,x^n(p))`, are called the *coordinates* of the
- chart `(U,\varphi)`.
+ `\varphi(p) = (x^1(p),\ldots,x^n(p))\in K^n` for any point `p\in U`,
+ are called the *coordinates* of the chart `(U,\varphi)`.
INPUT:
@@ -1051,8 +1051,8 @@ class RealChart(Chart):
an open subset `V` of `\RR^n`.
The components `(x^1,\ldots,x^n)` of `\varphi`, defined by
- `\varphi(p) = (x^1(p),\ldots,x^n(p))`, are called the *coordinates* of the
- chart `(U,\varphi)`.
+ `\varphi(p) = (x^1(p),\ldots,x^n(p))\in \RR^n` for any point `p\in U`,
+ are called the *coordinates* of the chart `(U,\varphi)`.
INPUT:
@@ -1153,7 +1153,8 @@ class RealChart(Chart):
sage: c_spher
Chart (U, (r, th, ph))
- Note the prefix 'r' for the string defining the coordinates in the arguments of ``Chart``.
+ Note the prefix 'r' for the string defining the coordinates in the
+ arguments of ``chart``.
Coordinates are Sage symbolic variables (see
:mod:`sage.symbolic.expression`)::
@@ -1887,8 +1888,7 @@ class CoordChange(SageObject):
self._transf = chart1.multifunction(*transformations)
self._inverse = None
# If the two charts are on the same open subset, the coordinate change
- # is added to the subset (and supersets) dictionary and the
- # Jacobian matrix is added to the dictionary of changes of frame:
+ # is added to the subset (and supersets) dictionary:
if chart1._domain == chart2._domain:
domain = chart1._domain
for sdom in domain._supersets:
diff --git a/src/sage/manifolds/manifold.py b/src/sage/manifolds/manifold.py
index 930261f..31521f0 100644
--- a/src/sage/manifolds/manifold.py
+++ b/src/sage/manifolds/manifold.py
@@ -413,25 +413,7 @@ class TopManifold(TopManifoldSubset):
The manifold passes all the tests of the test suite relative to the
category of Sets::
- sage: TestSuite(M).run(verbose=True)
- running ._test_an_element() . . . pass
- running ._test_category() . . . pass
- running ._test_elements() . . .
- Running the test suite of self.an_element()
- running ._test_category() . . . pass
- running ._test_eq() . . . pass
- running ._test_not_implemented_methods() . . . pass
- running ._test_pickling() . . . pass
- pass
- running ._test_elements_eq_reflexive() . . . pass
- running ._test_elements_eq_symmetric() . . . pass
- running ._test_elements_eq_transitive() . . . pass
- running ._test_elements_neq() . . . pass
- running ._test_eq() . . . pass
- running ._test_not_implemented_methods() . . . pass
- running ._test_pickling() . . . pass
- running ._test_some_elements() . . . pass
-
+ sage: TestSuite(M).run()
"""
def __init__(self, n, name, latex_name=None, field='real', start_index=0,
@@ -1230,25 +1212,26 @@ class TopManifold(TopManifoldSubset):
def chart(self, coordinates='', names=None):
r"""
- Define a chart the domain of which is the manifold.
+ Define a chart, the domain of which is the manifold.
A *chart* is a pair `(U,\varphi)`, where `U` is the current manifold
and `\varphi: U \rightarrow V \subset K^n`
is a homeomorphism from `U` to an open subset `V` of `K^n`, `K` being
- the field on which the manifold containing the open set is defined.
+ the field on which the manifold is defined.
The components `(x^1,\ldots,x^n)` of `\varphi`, defined by
- `\varphi(p) = (x^1(p),\ldots,x^n(p))`, are called the *coordinates*
- of the chart `(U,\varphi)`.
+ `\varphi(p) = (x^1(p),\ldots,x^n(p))\in K^n` for any point `p\in U`,
+ are called the *coordinates* of the chart `(U,\varphi)`.
See :class:`~sage.manifolds.chart.Chart` for a complete
documentation.
INPUT:
- - ``coordinates`` -- single string defining the coordinate symbols and
- ranges: the coordinates are separated by ' ' (space) and each
- coordinate has at most three fields, separated by ':':
+ - ``coordinates`` -- (default: '' (empty string)) single string
+ defining the coordinate symbols and ranges: the coordinates are
+ separated by ' ' (space) and each coordinate has at most three fields,
+ separated by ':':
1. The coordinate symbol (a letter or a few letters)
2. (optional, only for manifolds over `\RR`) The interval `I`
@@ -1260,8 +1243,8 @@ class TopManifold(TopManifoldSubset):
(a,b] (or equivalently ]a,b]) are allowed.
Note that the interval declaration must not contain any space
character.
- 3. (optional) The LaTeX spelling of the coordinate; if not provided the
- coordinate symbol given in the first field will be used.
+ 3. (optional) The LaTeX spelling of the coordinate; if not provided
+ the coordinate symbol given in the first field will be used.
The order of the fields 2 and 3 does not matter and each of them can
be omitted.
@@ -1270,11 +1253,12 @@ class TopManifold(TopManifoldSubset):
treatment of the backslash character (see examples below).
If no interval range and no LaTeX spelling is to be provided for any
coordinate, the argument ``coordinates`` can be omitted when the
- shortcut operator <,> is used via Sage preparser (see examples below)
+ shortcut operator ``<,>`` is used via Sage preparser (see examples
+ below)
- ``names`` -- (default: ``None``) unused argument, except if
``coordinates`` is not provided; it must then be a tuple containing
- the coordinate symbols (this is guaranted if the shortcut operator <,>
- is used).
+ the coordinate symbols (this is guaranted if the shortcut operator
+ ``<,>`` is used).
OUTPUT:
diff --git a/src/sage/manifolds/scalarfield_algebra.py b/src/sage/manifolds/scalarfield_algebra.py
index 5cf30ec..a8f8e25 100644
--- a/src/sage/manifolds/scalarfield_algebra.py
+++ b/src/sage/manifolds/scalarfield_algebra.py
@@ -319,34 +319,9 @@ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
sage: 1/3*(f+2*f) == f
True
- Sage test suite for algebras is passed::
-
- sage: TestSuite(CM).run(verbose=True)
- running ._test_additive_associativity() . . . pass
- running ._test_an_element() . . . pass
- running ._test_associativity() . . . pass
- running ._test_category() . . . pass
- running ._test_characteristic() . . . pass
- running ._test_distributivity() . . . pass
- running ._test_elements() . . .
- Running the test suite of self.an_element()
- running ._test_category() . . . pass
- running ._test_eq() . . . pass
- running ._test_nonzero_equal() . . . pass
- running ._test_not_implemented_methods() . . . pass
- running ._test_pickling() . . . pass
- pass
- running ._test_elements_eq_reflexive() . . . pass
- running ._test_elements_eq_symmetric() . . . pass
- running ._test_elements_eq_transitive() . . . pass
- running ._test_elements_neq() . . . pass
- running ._test_eq() . . . pass
- running ._test_not_implemented_methods() . . . pass
- running ._test_one() . . . pass
- running ._test_pickling() . . . pass
- running ._test_prod() . . . pass
- running ._test_some_elements() . . . pass
- running ._test_zero() . . . pass
+ The Sage test suite for algebras is passed::
+
+ sage: TestSuite(CM).run()
It is passed also for `C^0(W)`::
diff --git a/src/sage/manifolds/utilities.py b/src/sage/manifolds/utilities.py
index 12fa42c..27bb85c 100644
--- a/src/sage/manifolds/utilities.py
+++ b/src/sage/manifolds/utilities.py
@@ -126,12 +126,14 @@ def simplify_sqrt_real(expr):
if num < 0 or den < 0:
x = sqrt(-num) / sqrt(-den) # new equivalent expression for x
simpl = SR(x._maxima_().radcan())
- if str(simpl)[:5] != 'sqrt(':
- # the absolute value of radcan's output is taken, the call to simplify()
- # taking into account possible assumptions regarding the sign of simpl:
- ssimpl = str(abs(simpl).simplify())
- else:
+ if str(simpl)[:5] == 'sqrt(' or str(simpl)[:7] == '1/sqrt(':
+ # no further simplification seems possible:
ssimpl = str(simpl)
+ else:
+ # the absolute value of radcan's output is taken, the call to
+ # simplify() taking into account possible assumptions regarding the
+ # sign of simpl:
+ ssimpl = str(abs(simpl).simplify())
# search for abs(1/sqrt(...)) term to simplify it into 1/sqrt(...):
pstart = ssimpl.find('abs(1/sqrt(')
if pstart != -1: