Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Entering components of a metric while declaring the metric on a paral…
Browse files Browse the repository at this point in the history
…lelizable manifold
  • Loading branch information
Dicolevrai committed Jun 15, 2018
1 parent a406fe6 commit a6071cb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
25 changes: 13 additions & 12 deletions src/sage/manifolds/differentiable/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ def riemann(self, name=None, latex_name=None):
2-dimensional differentiable manifold S^2
sage: g.riemann()[:]
[[[[0, 0], [0, 0]], [[0, sin(th)^2], [-sin(th)^2, 0]]],
[[[0, (cos(th)^2 - 1)/sin(th)^2], [1, 0]], [[0, 0], [0, 0]]]]
[[[0, (cos(th)^2 - 1)/sin(th)^2], [1, 0]], [[0, 0], [0, 0]]]]
In dimension 2, the Riemann tensor can be expressed entirely in terms of
the Ricci scalar `r`:
Expand Down Expand Up @@ -1974,7 +1974,7 @@ class PseudoRiemannianMetricParal(PseudoRiemannianMetric, TensorFieldParal):
- ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the metric;
if ``None``, it is formed from ``name``
- ``comp`` -- (default: ``None``) either the list of the lignes of the \
corresponding matrix of the matrix in the default chart of the domain, \
corresponding matrix of the metric in the default chart of the domain, \
or a non-negative integer `q` less than or egual to the dimension of the \
ambiant manifold and representing the index of the metric. In this last \
case, the standard pseudo-Euclidean metric of index `q` will be \
Expand Down Expand Up @@ -2075,7 +2075,6 @@ def __init__(self, vector_field_module, name, latex_name=None, comp=None):
"""
TensorFieldParal.__init__(self, vector_field_module, (0,2),
name=name, latex_name=latex_name, sym=(0,1))
# signature:
ndim = self._ambient_domain.dimension()
start_index = self._ambient_domain.start_index()
chart = self._ambient_domain.default_chart()
Expand All @@ -2086,7 +2085,8 @@ def __init__(self, vector_field_module, name, latex_name=None, comp=None):
if index < 0:
index = -1*index
if index > ndim:
raise ValueError("The index must be less than the size of the metric")
raise ValueError("The index must be less than the size of the \
metric")
liste = _diag(-1, index, ndim, 0)
liste.extend(_diag(1, ndim-index, ndim, index))
else:
Expand All @@ -2105,12 +2105,13 @@ def __init__(self, vector_field_module, name, latex_name=None, comp=None):
for (j, elt) in enumerate(comp):
liste.extend(_diag(elt, 1, ndim, j))
except TypeError:
raise TypeError("The second argument must be an integer or an iterable or an iterable of iterables")
raise TypeError("The second argument must be an integer \
or an iterable or an iterable of iterables")
frame = chart.frame()
for i in range(ndim):
for j in range(ndim):
self.add_comp(frame)[i+start_index, j+start_index] = liste[i][j]
self._signature = self.signature()-self.index()
self._signature = self.signature()
# the pair (n_+, n_-):
self._signature_pm = (self.signature(), self.index())
self._indic_signat = 1 - 2*(self._signature_pm[1]%2) # (-1)^n_-
Expand Down Expand Up @@ -2154,8 +2155,7 @@ def _repr_(self):

def _new_instance(self):
r"""
Create an instance of the same class as ``self`` with the same
signature.
Create an instance of the same class as ``self`` with the same.
TESTS::
Expand All @@ -2178,7 +2178,8 @@ def _new_instance(self):

def list_of_lines(self, chart=None):
r"""
Return the list of the lists of lines of the metric in a given chart.
Return the list of lines of the metric in a given chart, each line \
being given as a list.
INPUT:
Expand Down Expand Up @@ -2218,7 +2219,7 @@ def list_of_lines(self, chart=None):

def matrix(self, chart=None):
r"""
Returns the correnponding matrix of the metric in the given chart. The \
Return the correnponding matrix of the metric in the given chart. The \
difference with ``g[:]`` is that the components of the matrix retuned \
here are instances of Symbolic Ring and not chart functions.
Expand Down Expand Up @@ -2308,7 +2309,7 @@ def sign(self):

def index(self):
r"""
Returns the index of the metric. This method works well only when the \
Return the index of the metric. This method works well only when the \
index of the metric is constant.
OUTPUT:
Expand Down Expand Up @@ -2372,7 +2373,7 @@ def signature(self):

def kernel_dimension(self):
r"""
Returns the dimension of the kernel of the metric. This method works \
Return the dimension of the kernel of the metric. This method works \
well only when the dimension of the kernel is constant.
OUTPUT:
Expand Down
21 changes: 15 additions & 6 deletions src/sage/manifolds/differentiable/pseudo_riemannian.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
sage: g = M.metric()
sage: g
Riemannian metric g on the 4-dimensional Lorentzian manifold M
Lorentzian metric g on the 4-dimensional Lorentzian manifold M
and initialize it to the Minkowskian value::
Expand Down Expand Up @@ -431,7 +431,7 @@ def __init__(self, n, name, metric_name='g', signature=None, ambient=None,
<class 'sage.manifolds.differentiable.pseudo_riemannian.PseudoRiemannianManifold_with_category'>
sage: X.<w,x,y,z> = M.chart()
sage: M.metric()
Riemannian metric g on the 4-dimensional pseudo-Riemannian manifold M
Pseudo-Riemannian metric g on the 4-dimensional pseudo-Riemannian manifold M
sage: TestSuite(M).run()
"""
Expand Down Expand Up @@ -564,7 +564,7 @@ class :class:`~sage.manifolds.differentiable.diff_map.DiffMap`
create a Lorentzian metric on ``M``::
sage: h = M.metric('h', signature=1); h
Riemannian metric h on the 3-dimensional Riemannian manifold M
Lorentzian metric h on the 3-dimensional Riemannian manifold M
"""
if name is None or name == self._metric_name:
Expand All @@ -576,16 +576,25 @@ class :class:`~sage.manifolds.differentiable.diff_map.DiffMap`
self._metric = self._manifold._metric.restrict(self)
else:
# creation from scratch:
signature = self._metric_signature
dim = self.dim()
if signature==None:
signature = dim
self._metric = DifferentiableManifold.metric(self,
self._metric_name,
signature=self._metric_signature,
latex_name=self._metric_latex_name)
signature=signature,
latex_name=self._metric_latex_name,
comp=int((dim-signature)/2))
return self._metric
# Metric distinct from the default one: it is created by the method
# metric of the superclass for generic differentiable manifolds:
dim = self.dim()
if signature==None:
signature = dim
return DifferentiableManifold.metric(self, name, signature=signature,
latex_name=latex_name,
dest_map=dest_map)
dest_map=dest_map,
comp=int((dim-signature)/2))

def volume_form(self, contra=0):
r"""
Expand Down

0 comments on commit a6071cb

Please sign in to comment.