Ticket #26355: degenerate_submanifold.py

File degenerate_submanifold.py, 97.9 KB (added by Dicolevrai, 3 years ago)

To create the class Degenerate Submanifold

Line 
1r"""
2Degenerate submanifolds
3
4An *embedded (resp. immersed) degenerate submanifold of a proper
5pseudo-Riemannian manifold* `(M,g)` is an embedded (resp. immersed)
6submanifold `H` of `M` as a differentiable manifold such that pull
7back of the metric tensor `g` via the embedding (resp. immersion)
8endows `H` with the structure of a degenerate manifold.
9
10Degenerate submanifolds are study in many fields of mathematics and physics,
11for instance in Differential Geometry (especially in geometry of
12lightlike submanifold) and in General Relativity. In geometry of lightlike
13submanifolds, according to the dimension `r` of the radical distribution
14(see below for definition of radical distribution), degenerate submanifolds
15have been classify into 4 subgroups: `r-`lightlike submanifolds, Coisotropic
16submanifolds, Isotropic submanifolds and Totally lightlike submanifolds.
17(See the book of Krishan L. Duggal and Aurel Bejancu in *REFERENCES*.)
18
19In the present module, you can definie any of the 4 types but most of the
20methods are implemented only for degenerate hypersurfaces who belong to
21`r-`lightlike submanifolds. However, their might be generalized to
22`1-`lightlike submanifolds. In the litterature there is a new approach
23(the rigging technique) for studying `1-`lightlike submanifolds but
24here we we the method of Krishan L. Duggal and Aurel Bejancu base on
25the screen distribution.
26
27Let `H` be a lightlike hypersurface of a pseudo-Riemannian manifold
28`(M,g)`. Then the normal bundle `T^\perp H` intersect the tangent
29bundle `TH`. The radical distribution is defined as
30'Rad(TH)=TH\cap T^\perp H'. In case of hypersurfaces, and more
31generally `1-`lightlike submanifolds, this is a rank 1 distribution.
32A screen distribution `S(TH)` is a complementary of `Rad(TH)` in `TH`.
33
34Giving a screen distribution `S(TH)` and a null vector field `\xi`
35locally defined and spanning `Rad(TH)`, there exists a unique
36transversal null vector field 'N' locally defined and such that
37`g(N,\xi)=1`. From a transverse vector 'v', the null rigging 'N'
38is giving by the formula
39
40.. MATH::
41
42    N = \frac{1}{g(\xi, v)}\left(v-\frac{g(v,v)}{2g(xi, v)}\xi\right)
43
44Tensors on the ambient manifold 'M' are projected on 'H' along 'N'
45to obtain induced objects. For instance, induced connection is the
46linear connexion defined on H through the Levi-Civitta connection of
47'g' along `N`.
48
49To work on a degenerate submanifold, after defining `H` as an instance
50of :class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold`,
51with the keyword *structure='degenerate_metric'*, you have to set a transvervector
52`v` and screen distribution together with the radical distribution.
53
54An example of degenerate submanifold from General Relativity is the
55horizon of the Shawrzschild black hole. Allow us to recall that
56Shawrzschild black hole is the first non-trivial solution of Einstein's
57equations. It describes the metric inside a star of radius `R = 2m`,
58being `m` the inertial mass of the star. It can be seen as an open
59ball in a Lorentzian manifold structure on `\RR^4`::
60
61    sage: M = Manifold(4, 'M', structure="Lorentzian")
62    sage: X_M.<t, r, th, ph> = \
63    ....: M.chart(r"t r:(0,oo) th:(0,pi):\theta ph:(0,2*pi):\phi")
64    sage: var('m'); assume(m>0)
65    m
66    sage: g = M.metric()
67    sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = \
68    ....: -1+2*m/r, 2*m/r, 1+2*m/r, r^2, r^2*sin(th)^2
69
70Let us define the horizon as a degenerate hypersurface::
71
72    sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
73    sage: H
74    degenerate hypersurface H embedded in 4-dimensional differentiable
75    manifold M
76    sage: X_H.<ht,hth,hph> = \
77    ....: H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta hph:(0,2*pi):\phi")
78    sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]}, \
79    ....: name='Phi', latex_name=r'\Phi')
80    sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]}, \
81    ....: name='Phi_inv', latex_name=r'\Phi^{-1}')
82    sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
83
84The induced metric is the pullback of `g` on `H`::
85
86    sage: h = H.induced_metric()
87    sage: h
88    degenerate metric gamma on the degenerate hypersurface H embedded
89    in 4-dimensional differentiable manifold M
90    sage: h.disp()
91    gamma = 4*m^2 dhth*dhth + 4*m^2*sin(hth)^2 dhph*dhph
92
93Let us now set a transversal direction and a screen ::
94
95    sage: xi = M.vector_field(); v = M.vector_field(); \
96    ....: e1 = M.vector_field(); e2 = M.vector_field();
97    sage: xi[0] =-1; v[0] = r; v[1] = -r; e1[2] = 1; e2[3] = 1
98    sage: H.set_transverse(rigging=v)
99    sage: S = H.screen('S', [e1, e2], (xi)); S
100    screen distribution S along the degenerate hypersurface H embedded
101    in 4-dimensional differentiable manifold M mapped into the
102    4-dimensional Lorentzian manifold M
103
104In the field of geometry of degenerate submanifolds, it is common to
105work in a field `(v_0, v_1, v_2, v_3)` where `span(v_0, v_1)=S(TM)`,
106`v_2=\xi` is a null vector field spanning the radical distribution and
107`v_3=N` is the corresponding null transverse vector field::
108
109    sage: T = H.adapted_frame(); T
110    Vector frame (H, (v_0,v_1,v_2,v_3)) with values on the 4-dimensional
111    Lorentzian manifold M
112    sage: T[3].disp()
113    N = d/dt - d/dr
114
115The Weingarten map::
116
117    sage: W = H.weingarten_map(); W
118    Tensor field nabla_g(xi)|X(H) of type (1,1) along the degenerate
119    hypersurface H embedded in 4-dimensional differentiable manifold M
120    with values on the 4-dimensional Lorentzian manifold M
121    sage: W.display()
122    nabla_g(xi)|X(H) = -1/4/m d/dt*dt - 1/4/m d/dt*dr
123    sage: W.display(T)
124    nabla_g(xi)|X(H) = -1/4/m xi*xi^b
125    sage: W(xi.along(Phi))
126    Vector field along the degenerate hypersurface H embedded in
127    4-dimensional differentiable manifold M with values on the
128    4-dimensional Lorentzian manifold M
129
130The shape operator::
131
132    sage: SO = H.shape_operator(); SO
133    Tensor field A^* of type (1,1) along the degenerate hypersurface
134    H embedded in 4-dimensional differentiable manifold M with values
135    on the 4-dimensional Lorentzian manifold M
136    sage: SO.disp()
137    A^* = 0
138
139The rotation one form::
140
141    sage: tau = H.rotation_one_form(); tau
142    Tensor field tau of type (0,1) along the degenerate hypersurface
143    H embedded in 4-dimensional differentiable manifold M with values on
144    the 4-dimensional Lorentzian manifold M
145    sage: tau.disp()
146    tau = -1/4/m dt - 1/4/m dr
147    sage: tau.display(T)
148    tau = 1/4/m xi^b
149
150Total umbilicity::
151
152    sage: H.is_maximal()
153    True
154    sage: H.is_totally_umbilical()
155    True
156    sage: H.is_totally_geodesic()
157    True
158
159REFERENCES:
160
161- [DB1996]_
162
163"""
164
165from sage.manifolds.differentiable.pseudo_riemannian import \
166    PseudoRiemannianManifold
167from sage.manifolds.differentiable.degenerate import DegenerateManifold
168from sage.manifolds.differentiable.differentiable_submanifold import \
169    DifferentiableSubmanifold
170from sage.rings.infinity import infinity
171from sage.matrix.constructor import matrix
172from sage.functions.other import factorial
173from sage.symbolic.ring import SR
174from sage.misc.cachefunc import cached_method
175from sage.rings.integer import Integer
176from queue import Queue
177from sage.symbolic.expression import Expression
178
179
180class DegenerateSubmanifold(DegenerateManifold, DifferentiableSubmanifold):
181    r"""
182    Degenerate submanifolds
183
184    An *embedded (resp. immersed) degenerate submanifold of a proper
185    pseudo-Riemannian manifold* `(M,g)` is an embedded (resp. immersed)
186    submanifold `H` of `M` as a differentiable manifold such that pull
187    back of the metric tensor `g` via the embedding (resp. immersion)
188    endows `H` with the structure of a degenerate manifold.
189   
190    INPUT:
191
192    - ``n`` -- positive integer; dimension of the manifold
193    - ``name`` -- string; name (symbol) given to the manifold
194    - ``field`` -- field `K` on which the manifold is
195      defined; allowed values are
196
197        - ``'real'`` or an object of type ``RealField`` (e.g., ``RR``) for
198           a manifold over `\RR`
199        - ``'complex'`` or an object of type ``ComplexField`` (e.g., ``CC``)
200           for a manifold over `\CC`
201        - an object in the category of topological fields (see
202          :class:`~sage.categories.fields.Fields` and
203          :class:`~sage.categories.topological_spaces.TopologicalSpaces`)
204          for other types of manifolds
205
206    - ``signature`` -- (default: ``None``) signature `S` of the metric as a
207      tuple: `S = (n_+, n_-, n_0)`, where `n_+` (resp. `n_-`, resp. `n_0`) is the
208      number of positive terms (resp. negative terms, resp. zero tems) in any
209      diagonal writing of the metric components; if ``signature`` is not
210      provided, `S` is set to `(ndim-1, 0, 1)`, being `ndim` the manifold's dimension
211    - ``ambient`` -- (default: ``None``) manifold of destination
212      of the immersion. If ``None``, set to ``self``
213    - ``base_manifold`` -- (default: ``None``) if not ``None``, must be a
214      topological manifold; the created object is then an open subset of
215      ``base_manifold``
216    - ``latex_name`` -- (default: ``None``) string; LaTeX symbol to
217      denote the manifold; if none are provided, it is set to ``name``
218    - ``start_index`` -- (default: 0) integer; lower value of the range of
219      indices used for "indexed objects" on the manifold, e.g., coordinates
220      in a chart
221      - ``category`` -- (default: ``None``) to specify the category; if
222      ``None``, ``Manifolds(field)`` is assumed (see the category
223      :class:`~sage.categories.manifolds.Manifolds`)
224    - ``unique_tag`` -- (default: ``None``) tag used to force the construction
225      of a new object when all the other arguments have been used previously
226      (without ``unique_tag``, the
227      :class:`~sage.structure.unique_representation.UniqueRepresentation`
228      behavior inherited from
229      :class:`~sage.manifolds.subset.ManifoldSubset`
230      would return the previously constructed object corresponding to these
231      arguments)
232
233    EXAMPLES:
234
235    A `2-`dimensional degenerate submanifold of a Lorentzian manifold::
236
237        sage: M = Manifold(4, 'M', structure="Lorentzian")
238        sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
239        sage: S
240        2-dimensional degenerate submanifold S embedded in 4-dimensional
241        differentiable manifold M
242
243    .. SEEALSO::
244
245        :mod:`~sage.manifolds.manifold` and
246        :mod:`~sage.manifolds.differentiable.differentiable_submanifold`
247
248   """
249    def __init__(self, n, name, ambient=None, metric_name='g', signature=None,
250                 base_manifold=None, diff_degree=infinity, latex_name=None,
251                 metric_latex_name=None, start_index=0, category=None,
252                 unique_tag=None):
253        r"""
254        Construct a pseudo-Riemannian submanifold.
255
256        EXAMPLES::
257
258        A `2-`dimensional degenerate submanifold of a Lorentzian manifold::
259
260            sage: M = Manifold(4, 'M', structure="Lorentzian")
261            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
262            sage: S
263            2-dimensional degenerate submanifold S embedded in 4-dimensional
264            differentiable manifold M
265
266        """
267
268        DegenerateManifold.__init__(self, n, name=name,
269                                          metric_name=metric_name,
270                                          signature=signature,
271                                          base_manifold=base_manifold,
272                                          diff_degree=diff_degree,
273                                          latex_name=latex_name,
274                                          metric_latex_name=metric_latex_name,
275                                          start_index=start_index,
276                                          category=category)
277        DifferentiableSubmanifold.__init__(self, n, name, self._field,
278                                           self._structure, ambient=ambient,
279                                           base_manifold=base_manifold,
280                                           latex_name=latex_name,
281                                           start_index=start_index,
282                                           category=category)
283        self._normal = None
284        self._first_fundamental_form = None
285        self._induced_metric = None
286        self._second_fundamental_form = {}
287        self._ambient_metric = None
288        self._gauss_curvature = {}
289        self._principal_directions = {}
290        self._principal_curvatures = {}
291        self._mean_curvature = {}
292        self._screens = {}
293        self._default_screen = None
294        self._adapted_frame = {}
295        self._shape_operator = {}
296        self._rotation_one_form = {}
297        signature = self._ambient.metric().signature()
298        ndim = self._ambient._dim
299        try:
300           if signature[0]==ndim or signature[1]==ndim:
301            raise ValueError("ambient must be a proper pseudo-Riemannian"+
302                              " or a degenerate manifold")
303        except TypeError:
304          if signature==ndim or signature==-ndim:
305            raise ValueError("ambient must be a proper pseudo-Riemannian"+
306                              " or a degenerate manifold")
307        self._transverse = {}
308       
309    def _repr_(self):
310        r"""
311        Return a string representation of the submanifold.
312
313        If no ambient manifold is specified, the submanifold is considered
314        as a manifold.
315
316        TESTS::
317
318        A `2-`dimensional degenerate submanifold of a Lorentzian manifold::
319
320            sage: M = Manifold(4, 'M', structure="Lorentzian")
321            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
322            sage: S.__repr__()
323            '2-dimensional degenerate submanifold S embedded in 4-dimensional
324            differentiable manifold M'
325
326        """
327        if self._ambient is None:
328            return super(DegenerateManifold, self).__repr__()
329        if self._ambient._dim-self._dim==1:
330          return "degenerate hypersurface {} embedded " \
331               "in {}-dimensional differentiable " \
332               "manifold {}".format(self._name, self._ambient._dim,
333                                    self._ambient._name) 
334        return "{}-dimensional degenerate submanifold {} embedded " \
335               "in {}-dimensional differentiable " \
336               "manifold {}".format(self._dim, self._name, self._ambient._dim,
337                                    self._ambient._name)
338 
339    def ambient_metric(self):
340        r"""
341        Return the metric of the ambient manifold. The submanifold has to be
342        embedded
343
344        OUTPUT:
345
346        - the metric of the ambient manifold
347
348        EXAMPLES:
349
350        Section of the lightcone of the Minkowski space with a hyperplane
351        passing through the origin::
352
353            sage: M = Manifold(4, 'M', structure="Lorentzian")
354            sage: X.<t,x,y,z> = M.chart()
355            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
356            sage: X_S.<u,v> = S.chart()
357            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), 0, u, v]},
358            ....:           name='Phi', latex_name=r'\Phi');
359            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
360            ....:               latex_name=r'\Phi^{-1}');
361            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
362            sage: S.ambient_metric()
363            Lorentzian metric g on the 4-dimensional Lorentzian manifold M
364
365        """
366        if self._ambient_metric is None:
367            if not self._embedded or not isinstance(self._ambient,
368                            (PseudoRiemannianManifold, DegenerateManifold)):
369                raise ValueError("degenerate submanifold must be embedded in a "
370                                 "pseudo-Riemannian or degenerate manifold")
371            self._ambient_metric = self._ambient.metric()
372        return self._ambient_metric
373   
374    def default_screen(self):
375        r"""
376        Return the default screen distribution
377
378        OUTPUT:
379
380        - an instance of
381          :class:`~sage.manifolds.differentiable.degenerate_submanifold.Screen`
382
383        EXAMPLES:
384
385        The lightcone of the 4-dimensional Minkowski space `\RR^4_1`::
386            sage: M = Manifold(4, 'M', structure="Lorentzian")
387            sage: X.<t,x,y,z> = M.chart()
388            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
389            sage: X_S.<u,v> = S.chart()
390            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
391            ....:                   name='Phi', latex_name=r'\Phi')
392            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
393            ....:                           latex_name=r'\Phi^{-1}')
394            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
395            sage: g = M.metric()
396            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
397            sage: V = M.vector_field(); V[3] = 1
398            sage: S.set_transverse(rigging=t, normal=V)
399            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
400            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
401            sage: Sc = S.screen('Sc', U, xi)
402            sage: S.default_screen()
403            screen distribution Sc along the 2-dimensional degenerate submanifold S
404            embedded in 4-dimensional differentiable manifold M mapped into the
405            4-dimensional Lorentzian manifold M
406            sage: S.default_screen()[0].disp()
407            u d/dt + sqrt(u^2 + v^2) d/dx
408
409        """
410        return self._default_screen
411
412    def set_transverse(self, rigging=None, normal=None):
413        r"""
414        For setting a transversal disttribution of the degenerate submanifold.
415        according to the type of the submanifold amoung the 4 possible types,
416        one must enter a list of normal transversal vector fields and/or a
417        list of transversal and not normal vector fields spanning a transverse
418        distribution.
419
420        INPUT:
421
422        - ``rigging`` -- list or tuple (default: ``None``); list of vector fields
423          of the ambient manifold or chart function; of the ambient manifold in
424          the latter case, the corresponding gradient vector field with respect to
425          the ambient metric is calculated; the vectors must be linearly independent,
426          transversal to the submanifold but not normal
427        - ``normal`` -- list or tuple (default: ``None``); list of vector fields
428          of the ambient manifold or chart function; of the ambient manifold in
429          the latter case, the corresponding gradient vector field with respect to
430          the ambient metric is calculated; the vectors must be linearly independent,
431          transversal and normal to the submanifold
432
433        EXAMPLES:
434
435        The lightcone of the 4-dimensional Minkowski space `\RR^4_1`::
436            sage: M = Manifold(4, 'M', structure="Lorentzian")
437            sage: X.<t,x,y,z> = M.chart()
438            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
439            sage: X_S.<u,v> = S.chart()
440            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
441            ....:                     name='Phi', latex_name=r'\Phi')
442            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
443            ....:                             latex_name=r'\Phi^{-1}')
444            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
445            sage: g = M.metric()
446            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
447            sage: V = M.vector_field(); V[3] = 1
448            sage: S.set_transverse(rigging=t, normal=V)
449            sage: S._transverse
450            {'normal': (Vector field on the 4-dimensional Lorentzian manifold M,),
451            'rigging': (Vector field on the 4-dimensional Lorentzian manifold M,)}
452
453        """
454        if isinstance(rigging, (list, tuple)):
455            rigging = [elt for elt in rigging]
456        else:
457            if rigging is not None:
458                rigging = [rigging]
459        if isinstance(normal, (list, tuple)):
460            normal = [elt for elt in normal]
461        else:
462            if normal is not None:
463                normal = [normal]
464        frame = self.default_frame()
465        im = self.immersion()
466        g = self.ambient_metric().along(im)
467        nor = []
468        rig = []
469        l1, l2 = 0, 0
470        if normal is not None:
471            for u in normal:
472                if isinstance(u, Expression):
473                    u = self._ambient.scalar_field(u).gradient()
474                for v in frame:
475                    v = im.pushforward(v)
476                    if not g(u.along(im), v).is_zero():
477                        raise ValueError("{} is not tangent to {}".format(u.disp(), self._name))
478                nor.append(u)
479                l1 += 1
480        if rigging is not None:
481            for u in rigging:
482                if isinstance(u, Expression):
483                    u = self._ambient.scalar_field(u).gradient()
484                rigg = False
485                for v in frame:
486                    v = im.pushforward(v)
487                    if not g(u.along(im), v).is_zero():
488                        rigg = True
489                if not rigg:
490                    raise ValueError("{} is normal to {}".format(u._name, self._name))
491                rig.append(u)
492                l2 += 1
493        if l1+l2!=self._codim:
494            raise ValueError("lenght of the transverse must be {}".format(self._codim))
495        self._transverse['normal'] = tuple(nor)
496        self._transverse['rigging'] = tuple(rig)
497
498    def screen(self, name, screen, rad, latex_name=None):
499        r"""
500        For setting a screen distribution and vector fields of the radical distribution
501        that will be used for computations
502
503        INPUT:
504
505        - ``name`` -- string (default: ``None``); name given to the screen
506        - ``latex_name`` -- string (default: ``None``); LaTeX symbol to denote
507          the screen; if ``None``, the LaTeX symbol is set to ``name``
508        - ``screen`` -- list or tuple  of vector fields
509          of the ambient manifold or chart function; of the ambient manifold in
510          the latter case, the corresponding gradient vector field with respect to
511          the ambient metric is calculated; the vectors must be linearly independent,
512          tangent to the submanifold but not normal
513        - ``rad`` -- -- list or tuple  of vector fields
514          of the ambient manifold or chart function; of the ambient manifold in
515          the latter case, the corresponding gradient vector field with respect to
516          the ambient metric is calculated; the vectors must be linearly independent,
517          tangent and normal to the submanifold
518
519        EXAMPLES:
520
521        The lightcone of the 4-dimensional Minkowski space `\RR^4_1`::
522            sage: M = Manifold(4, 'M', structure="Lorentzian")
523            sage: X.<t,x,y,z> = M.chart()
524            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
525            sage: X_S.<u,v> = S.chart()
526            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
527            ....:               name='Phi', latex_name=r'\Phi')
528            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
529            ....:                       latex_name=r'\Phi^{-1}')
530            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
531            sage: g = M.metric()
532            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
533            sage: V = M.vector_field(); V[3] = 1
534            sage: S.set_transverse(rigging=t, normal=V)
535            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
536            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
537            sage: Sc = S.screen('Sc', U, xi); Sc
538            screen distribution Sc along the 2-dimensional degenerate submanifold S
539            embedded in 4-dimensional differentiable manifold M mapped into the
540            4-dimensional Lorentzian manifold M
541
542        """
543        if isinstance(screen, (list, tuple)):
544            screen = [elt for elt in screen]
545        else:
546            screen = [screen]
547        if isinstance(rad, (list, tuple)):
548            rad = [elt for elt in rad]
549        else:
550            rad = [rad]
551        if name in self._screens:
552            if list(screen)==self._screens[name]._screen and list(rad)==self._screens[name]._rad:
553                return self._screens[name]
554            else:
555                raise ValueError("a different screen distribution with the same name \
556                  had already been set")
557        if len(screen)+len(rad)!=self._dim:
558            raise ValueError("total lenght screen+rad must be {}".format(self._dim))
559        frame = self.default_frame()
560        im = self.immersion()
561        g = self.ambient_metric().along(im)
562        for (i, u) in enumerate(screen):
563            if isinstance(u, Expression):
564                u = self._ambient.scalar_field(u).gradient()
565            screen[i] = u
566            sc = False
567            for v in frame:
568                v = im.pushforward(v)
569                if not g(u.along(im), v).is_zero():
570                    sc = True
571            if not sc:
572                raise ValueError("{} cannot belong to a screen distribution".format(u))
573        for (i, u) in enumerate(rad):
574            if isinstance(u, Expression):
575                u = self._ambient.scalar_field(u).gradient()
576            rad[i] = u
577            normal = False
578            for v in frame:
579                v = im.pushforward(v)
580                if not g(u.along(im), v).is_zero():
581                    raise ValueError("{} is not normal to {}".format(u, self._name))
582        self._screens[name] = Screen(self, name, tuple(screen), tuple(rad), latex_name=latex_name)
583        self._default_screen = self._screens[name] 
584        return self._screens[name]
585
586    def induced_metric(self):
587        r"""
588        Return the pullback of the ambient metric.
589
590        OUTPUT:
591
592        - induced mettric, as an instance of
593          :class:`~sage.manifolds.differentiable.metric.DegenerateMetric`
594
595        EXAMPLES:
596
597        Section of the lightcone of the Minkowski space with a hyperplane
598        passing through the origin::
599
600            sage: M = Manifold(4, 'M', structure="Lorentzian")
601            sage: X.<t,x,y,z> = M.chart()
602            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
603            sage: X_S.<u,v> = S.chart()
604            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
605            ....:             name='Phi', latex_name=r'\Phi');
606            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
607            ....:           latex_name=r'\Phi^{-1}');
608            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
609            sage: g = M.metric()
610            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
611            sage: h = S.induced_metric(); h
612            degenerate metric gamma on the 2-dimensional degenerate
613            submanifold S embedded in 4-dimensional differentiable manifold M
614            sage: h[:]
615            [ v^2/(u^2 + v^2) -u*v/(u^2 + v^2)]
616            [-u*v/(u^2 + v^2)  u^2/(u^2 + v^2)]
617
618        """
619        if self._induced_metric is None or self._induced_metric._components=={}:
620            self._induced_metric = self.metric()
621            self._induced_metric.set(
622                               self.immersion().pullback(self.ambient_metric()))
623            self._induced_metric.set_name("gamma", r"\gamma")
624        return self._induced_metric
625
626    def first_fundamental_form(self):
627        r"""
628        Return the restriction of the ambient metric on vector field
629        along the submanifold and tangent to it. It is difference from
630        induced metric who gives the pullback of the ambient metric
631        on the submanifold.
632
633        OUTPUT:
634
635        - the first fundamental form, as an instance of
636          :class:`~sage.manifolds.differentiable.degenerate_submanifold.TangentTensor`
637
638        EXAMPLES:
639
640        Section of the lightcone of the Minkowski space with a hyperplane
641        passing through the origin::
642
643            sage: M = Manifold(4, 'M', structure="Lorentzian")
644            sage: X.<t,x,y,z> = M.chart()
645            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
646            sage: X_S.<u,v> = S.chart()
647            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
648            ....:         name='Phi', latex_name=r'\Phi');
649            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
650            ....:           latex_name=r'\Phi^{-1}');
651            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
652            sage: g = M.metric()
653            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
654            sage: h = S.first_fundamental_form()
655
656        """
657        if self._first_fundamental_form is None:
658            g = self.ambient_metric()
659            h = g.copy()
660            h.set_name(g._name+"|"+self._name, g._latex_name+r"|_"+self._latex_name)
661            h = TangentTensor(h, self.immersion())
662            self._first_fundamental_form = h
663        return self._first_fundamental_form
664       
665    def _ambient_decomposition(self, screen=None):
666        r"""
667        Return a list ``[screen, rad, normal, rig]`` where `screen`
668        is a list a vector fields on the ambient manifoldspanning
669        the giving screen distribution, `rad` a list of vector fields
670        spanning radical distribution, `normal` list of normal transversal
671        vector fields, and `rig` list of rigging vector fields
672        corresponding to the giving screen.
673
674        INPUT:
675
676        - ``screen`` -- (default: ``None``); an instance of
677          :class:`~sage.manifolds.differentiable.degenerate_submanifold.Screen`
678          if ``None`` default screen is used.
679        OUTPUT:
680
681        - a list
682
683        EXAMPLES:
684
685        The lightcone of the 4-dimensional Minkowski space `\RR^4_1`::
686            sage: M = Manifold(4, 'M', structure="Lorentzian")
687            sage: X.<t,x,y,z> = M.chart()
688            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
689            sage: X_S.<u,v> = S.chart()
690            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
691            ....:             name='Phi', latex_name=r'\Phi')
692            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
693            ....:                     latex_name=r'\Phi^{-1}')
694            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
695            sage: g = M.metric()
696            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
697            sage: V = M.vector_field(); V[3] = 1
698            sage: S.set_transverse(rigging=t, normal=V)
699            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
700            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
701            sage: Sc = S.screen('Sc', U, xi)
702            sage: S._ambient_decomposition()
703            [[Vector field on the 4-dimensional Lorentzian manifold M],
704             [Vector field on the 4-dimensional Lorentzian manifold M],
705             (Vector field on the 4-dimensional Lorentzian manifold M,),
706             (Vector field on the 4-dimensional Lorentzian manifold M,)]
707
708        """
709        try:
710            normal = self._transverse['normal']
711        except KeyError:
712            raise ValueError("Set first transverse by using set_transverse")
713        if screen is None:
714            screen = self.default_screen()
715        if isinstance(screen, Screen):
716            rad = screen._rad
717            screen = screen._screen
718            rig = self._transverse['rigging']
719        else:
720            raise ValueError("set first a screen")
721        if self._codim==1:
722            xi = rad[0]
723            v = rig[0]
724            g = self.ambient_metric()
725            N = (1/g(xi, v))*(v-(g(v,v)/(2*g(xi, v)))*xi)
726            N.set_name(name='N')
727            rig = [N]
728        return [screen, rad, normal, rig]
729   
730    def _adapted_frame_(self, screen=None):
731        r"""
732        Return a frame `(e_1,\ldots,e_p, xi_1,\ldots, xi_r, v_1,\ldots, v_q, N_1, \ldots, N_n)`
733        of the ambient manifold, being `e_i` vector fields
734        spanning the giving screen distribution, `xi_i` vector fields spanning
735        radical distribution, `v_i` normal transversal vector fields, `N_i`
736        rigging vector fields corresponding to the giving screen.
737
738        INPUT:
739
740        - ``screen`` -- (default: ``None``); an instance of
741          :class:`~sage.manifolds.differentiable.degenerate_submanifold.Screen`
742          if ``None`` default screen is used.
743        OUTPUT:
744
745        - a frame on the ambient manifold
746
747        EXAMPLES:
748
749        The lightcone of the 4-dimensional Minkowski space `\RR^4_1`::
750            sage: M = Manifold(4, 'M', structure="Lorentzian")
751            sage: X.<t,x,y,z> = M.chart()
752            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
753            sage: X_S.<u,v> = S.chart()
754            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
755            ....:             name='Phi', latex_name=r'\Phi')
756            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
757            ....:                     latex_name=r'\Phi^{-1}')
758            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
759            sage: g = M.metric()
760            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
761            sage: V = M.vector_field(); V[3] = 1
762            sage: S.set_transverse(rigging=t, normal=V)
763            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
764            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
765            sage: Sc = S.screen('Sc', U, xi)
766            sage: T = S._adapted_frame_(); T
767            Vector frame (M, (v_0,v_1,v_2,v_3))
768
769        """
770
771        if screen is None:
772            screen = self.default_screen()
773        if screen is None:
774            raise ValueError("set first a screen distribution")
775        if screen._name in self._adapted_frame:
776            return self._adapted_frame[screen._name]
777        decomposition = self._ambient_decomposition(screen)
778        sc, rad = decomposition[0], decomposition[1]
779        normal, rigging = decomposition[2], decomposition[3]
780        A = self._ambient.automorphism_field()
781        i = self._ambient._sindex
782        for u in sc:
783            for j in self._ambient.irange():
784                A[j,i] = u[j]
785            i += 1
786        for u in rad:
787            for j in self._ambient.irange():
788                A[j,i] = u[j]
789            i += 1
790        for u in normal:
791            for j in self._ambient.irange():
792                A[j,i] = u[j]
793            i += 1
794        for u in rigging:
795            for j in self._ambient.irange():
796                A[j,i] = u[j]
797            i += 1
798        f = self._ambient.default_frame()
799        GLHPhi = f.along(self.immersion())[0].parent().general_linear_group()
800        e = f.new_frame(A, 'v')
801        self.set_change_of_frame(f.along(self.immersion()), e.along(
802                  self.immersion()), GLHPhi(A.along(self.immersion())))
803        b = e.dual_basis()
804        if self._codim==1:
805            e[self._dim-self._sindex].set_name('N')
806            e[self._dim-self._sindex-1].set_name('xi', latex_name=r'\xi')
807            b[self._dim-self._sindex].set_name('N^b', latex_name=r'N^\flat')
808            b[self._dim-self._sindex-1].set_name('xi^b', latex_name=r'\xi^\flat')
809        self._adapted_frame[screen._name] = e
810        return e
811
812    def adapted_frame(self, screen=None):
813        r"""
814        Return a frame `(e_1,\ldots,e_p, xi_1,\ldots, xi_r, v_1,\ldots, v_q, N_1, \ldots, N_n)`
815        of the ambient manifold along the submanifold, being `e_i` vector fields
816        spanning the giving screen distribution, `xi_i` vector fields spanning
817        radical distribution, `v_i` normal transversal vector fields, `N_i`
818        rigging vector fields corresponding to the giving screen.
819
820        INPUT:
821
822        - ``screen`` -- (default: ``None``); an instance of
823          :class:`~sage.manifolds.differentiable.degenerate_submanifold.Screen`
824          if ``None`` default screen is used.
825        OUTPUT:
826
827        - a frame on the ambient manifold along the submanifold
828
829        EXAMPLES:
830
831        The lightcone of the 4-dimensional Minkowski space `\RR^4_1`::
832            sage: M = Manifold(4, 'M', structure="Lorentzian")
833            sage: X.<t,x,y,z> = M.chart()
834            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
835            sage: X_S.<u,v> = S.chart()
836            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
837            ....:             name='Phi', latex_name=r'\Phi')
838            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
839            ....:                     latex_name=r'\Phi^{-1}')
840            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
841            sage: g = M.metric()
842            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
843            sage: V = M.vector_field(); V[3] = 1
844            sage: S.set_transverse(rigging=t, normal=V)
845            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
846            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
847            sage: Sc = S.screen('Sc', U, xi)
848            sage: T = S.adapted_frame(); T
849            Vector frame (S, (v_0,v_1,v_2,v_3)) with values on the 4-dimensional
850            Lorentzian manifold M
851            sage: T[0].disp()
852            v_0 = u d/dt + sqrt(u^2 + v^2) d/dx
853            sage: T[0].disp(T)
854            v_0 = v_0
855            sage: T[3].disp()
856            v_3 = -d/dt
857
858        """
859
860        f = self._adapted_frame_(screen).along(self.immersion())
861        b = f.dual_basis()
862        if self._codim==1:
863            f[self._dim-self._sindex].set_name('N')
864            f[self._dim-self._sindex-1].set_name('xi', latex_name=r'\xi')
865            b[self._dim-self._sindex].set_name('N^b', latex_name=r'N^\flat')
866            b[self._dim-self._sindex-1].set_name('xi^b', latex_name=r'\xi^\flat')
867        return self._adapted_frame_(screen).along(self.immersion())
868
869    def second_fundamental_form(self, screen=None):
870        r"""
871
872        This method is implemented only for null hypersurfaces. The method
873        returns a tensor `B` of type `(o,2)` instance of
874        :class:`~sage.manifolds.differentiable.degenerate_submanifold.TangentTensor`
875        such that for two vector fields `U, V` on the ambient manifold along
876        the null hypersurface, one has:
877
878        .. MATH::
879
880        \nabla_UV=D(U,V)+B(U,V)N
881
882        being `\nabla` the ambient connection, `D` the induced connection
883        and `N` the choosen rigging.
884       
885        INPUT:
886
887        - ``screen`` -- (default: ``None``); an instance of
888          :class:`Screen`
889          if ``None`` default screen is used.
890        OUTPUT:
891
892        - an instance of
893        :class:`TangentTensor`
894
895        EXAMPLES:
896
897        The horizon of the Shawrzschild black hole::
898
899            sage: M = Manifold(4, 'M', structure="Lorentzian")
900            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
901            ....:                     ph:(0,2*pi):\phi")
902            sage: var('m'); assume(m>0)
903            m
904            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
905            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
906            ....:                     hph:(0,2*pi):\phi")
907            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
908            ....:                     name='Phi', latex_name=r'\Phi')
909            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
910            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
911            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
912            sage: g = M.metric()
913            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
914            ....:                           1+2*m/r, r^2, r^2*sin(th)^2
915            sage: xi = M.vector_field(); v = M.vector_field();
916            sage: e1 = M.vector_field(); e2 = M.vector_field()
917            sage: xi[0] =-1; v[0] = r; v[1] = -r; e1[2] = 1; e2[3] = 1
918            sage: H.set_transverse(rigging=[v])
919            sage: S = H.screen('S', [e1, e2], (xi))
920            sage: B = H.second_fundamental_form(); B
921            Field of symmetric bilinear forms B along the degenerate hypersurface
922            H embedded in 4-dimensional differentiable manifold M with values on
923            the 4-dimensional Lorentzian manifold M
924            sage: B.disp()
925            B = 0
926
927        """
928        if self._ambient._dim-self._dim != 1:
929            raise ValueError("'second_fundamental_form' is defined"+
930                                      " only for hypersurfaces.")
931        if screen is None:
932            screen = self.default_screen()
933        if screen._name not in self._second_fundamental_form:
934            resu = self._ambient.vector_field_module() \
935                .tensor((0, 2), name='B', latex_name='B', sym=[(0, 1)], antisym=[]) \
936                .along(self.immersion())
937            f = self.adapted_frame(screen)
938            A = self.screen_projection(self._weingarten_map())
939            resu[f, :] = A[f, :]
940            im = self.immersion()
941            self._second_fundamental_form[screen._name] = TangentTensor(resu, im)
942        return self._second_fundamental_form[screen._name]
943
944    extrinsic_curvature = second_fundamental_form
945
946    def projection(self, tensor, screen=None):
947        r"""
948
949        For a giving tensor `T` of type `(r, 1)` on the ambient manifold, this
950        method returns the tensor `T'` of type `(r,1)` such that for `r`
951        vector fields `v_1,\ldots,v_r`, `T'(v_1,\ldots,v_r)` is the projection
952        of  `T(v_1,\ldots,v_r)` on ``self`` along the bundle spans by the
953        transversal vector fields provided by the
954        :method:`~sage.manifolds.differentiable.degenerate_submanifold.set_transverse`
955
956        INPUT:
957
958        - ``tensor`` -- a tensor of type `(r,1)` on the ambient manifold;
959
960        OUTPUT:
961
962        - a tensor of type `(r,1)` on the ambient manifold along ``self``;
963
964        EXAMPLES:
965
966        The lightcone of the 4-dimensional Minkowski space `\RR^4_1`::
967            sage: M = Manifold(4, 'M', structure="Lorentzian")
968            sage: X.<t,x,y,z> = M.chart()
969            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
970            sage: X_S.<u,v> = S.chart()
971            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]}, name='Phi', latex_name=r'\Phi')
972            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv', latex_name=r'\Phi^{-1}')
973            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
974            sage: g = M.metric()
975            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
976            sage: V = M.vector_field(); V[3] = 1
977            sage: S.set_transverse(rigging=t, normal=V)
978            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
979            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
980            sage: Sc = S.screen('Sc', U, xi)
981            sage: U1 = S.projection(U); U1
982            Vector field along the 2-dimensional degenerate submanifold S embedded in
983            4-dimensional differentiable manifold M with values on the 4-dimensional
984            Lorentzian manifold M
985            sage: U1.disp()
986            u d/dt + sqrt(u^2 + v^2) d/dx
987
988        """
989        if tensor.tensor_type()[0]!=1:
990            raise NotImplementedError("``projection`` is implemented only for "+
991                                      "tensors with 1 as contravariant order")
992        #TensorField.display(T, basis=self._ambient.default_frame())
993        frame = self.adapted_frame(screen)
994        T = tensor.copy()
995        try:
996            T = T.along(self.immersion())
997        except ValueError:
998            pass
999        T.disp(frame)       
1000        for i in self._ambient.index_generator(T.tensor_rank()):
1001            if i[0] in range(self._dim-self._sindex,self._ambient._dim-self._sindex):
1002                T[frame, i] = 0
1003        if tensor._latex_name is None:
1004            T.set_name(tensor._name)
1005        else:
1006            T.set_name(tensor._name, latex_name=tensor._latex_name)
1007        return T
1008
1009    def screen_projection(self, tensor, screen=None):
1010        r"""
1011
1012        For a giving tensor `T` of type `(r, 1)` on the ambient manifold, this
1013        method returns the tensor `T'` of type `(r,1)` such that for `r`
1014        vector fields `v_1,\ldots,v_r`, `T'(v_1,\ldots,v_r)` is the projection
1015        of  `T(v_1,\ldots,v_r)` on the bundle spans by``screen`` along the
1016        bundle spans by the transversal plus the radical vector fields provided.
1017
1018        INPUT:
1019
1020        - ``tensor`` -- a tensor of type `(r,1)` on the ambient manifold;
1021
1022        OUTPUT:
1023
1024        - a tensor of type `(r,1)` on the ambient manifold;
1025
1026        EXAMPLES:
1027
1028        The lightcone of the 4-dimensional Minkowski space `\RR^4_1`::
1029            sage: M = Manifold(4, 'M', structure="Lorentzian")
1030            sage: X.<t,x,y,z> = M.chart()
1031            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
1032            sage: X_S.<u,v> = S.chart()
1033            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
1034            ....:     name='Phi', latex_name=r'\Phi')
1035            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
1036            ....:     latex_name=r'\Phi^{-1}')
1037            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
1038            sage: g = M.metric()
1039            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
1040            sage: V = M.vector_field(); V[3] = 1
1041            sage: S.set_transverse(rigging=t, normal=V)
1042            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
1043            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
1044            sage: Sc = S.screen('Sc', U, xi)
1045            sage: U1 = S.screen_projection(U); U1
1046            Vector field along the 2-dimensional degenerate submanifold S embedded
1047            in 4-dimensional differentiable manifold M with values on the 4-dimensional
1048            Lorentzian manifold M
1049            sage: U1.disp()
1050            u d/dt + sqrt(u^2 + v^2) d/dx
1051
1052        """
1053        if tensor.tensor_type()[0]!=1:
1054            raise NotImplementedError("``projection`` is implemented only for "+
1055                                      "tensors with 1 as contravariant order")
1056        frame = self.adapted_frame(screen)
1057        T = tensor.copy()
1058        try:
1059            T = T.along(self.immersion())
1060        except ValueError:
1061            pass
1062        T.disp(frame)
1063        for i in self._ambient.index_generator(T.tensor_rank()):
1064            if i[0] in range(self._dim-self._sindex-1,self._ambient._dim-self._sindex):
1065                T[frame, i] = 0
1066        if tensor._latex_name is None:
1067            T.set_name(tensor._name)
1068        else:
1069            T.set_name("P"+tensor._name, latex_name=r'P'+tensor._latex_name)
1070        return T
1071     
1072    def gauss_curvature(self, screen=None):
1073        r"""
1074        Gauss curvature is the product of all  eigenfunctions of the shape operator.
1075       
1076        INPUT:
1077
1078        - ``screen`` -- (default: ``None``); an instance of
1079          :class:`~sage.manifolds.differentiable.degenerate_submanifold.Screen`
1080          if ``None`` default screen is used.
1081        OUTPUT:
1082
1083        - a scalar function on ``self``
1084
1085        EXAMPLES:
1086
1087        The horizon of the Shawrzschild black hole::
1088
1089            sage: M = Manifold(4, 'M', structure="Lorentzian")
1090            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1091            ....: ph:(0,2*pi):\phi")
1092            sage: var('m'); assume(m>0)
1093            m
1094            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1095            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1096            ....: hph:(0,2*pi):\phi")
1097            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1098            ....:       name='Phi', latex_name=r'\Phi')
1099            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
1100            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1101            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1102            sage: g = M.metric()
1103            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
1104            ....:       1+2*m/r, r^2, r^2*sin(th)^2
1105            sage: xi = M.vector_field(); v = M.vector_field(); e1 = M.vector_field()
1106            sage: e2 = M.vector_field(); xi[0]=-1; v[0]=r; v[1]=-r; e1[2]=1; e2[3]=1
1107            sage: H.set_transverse(rigging=[v])
1108            sage: S = H.screen('S', [e1, e2], (xi)); T = H.adapted_frame()
1109            sage: K = H.gauss_curvature(); K
1110            Scalar field on the degenerate hypersurface H embedded in 4-dimensional differentiable manifold M
1111            sage: K.disp(T)
1112            H --> R
1113            (ht, hth, hph) |--> 0
1114
1115        """
1116        if self._ambient._dim-self._dim != 1:
1117            raise ValueError("'gauss_curvature' is defined"+
1118                                      " only for hypersurfaces.")
1119        if screen is None:
1120            screen = self.default_screen()
1121        if screen._name not in self._gauss_curvature:
1122            f = self.adapted_frame()
1123            A = self.shape_operator()
1124            self._gauss_curvature[screen._name] = self.scalar_field(
1125              {chart: A[f,:,chart].determinant()
1126                for chart in self.top_charts()})
1127        return self._gauss_curvature[screen._name]
1128
1129    def principal_directions(self, screen=None):
1130        r"""
1131
1132        Principal directions are eigenvectors of the shape operator. This
1133        method is implemented only for hypersurfaces.
1134       
1135        INPUT:
1136
1137        - ``screen`` -- (default: ``None``); an instance of
1138          :class:`~sage.manifolds.differentiable.degenerate_submanifold.Screen`
1139          if ``None`` default screen is used.
1140        OUTPUT:
1141
1142        - a dictionnary
1143
1144        EXAMPLES:
1145
1146        The horizon of the Shawrzschild black hole::
1147
1148            sage: M = Manifold(4, 'M', structure="Lorentzian")
1149            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1150            ....: ph:(0,2*pi):\phi")
1151            sage: var('m'); assume(m>0)
1152            m
1153            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1154            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1155            ....: hph:(0,2*pi):\phi")
1156            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1157            ....:       name='Phi', latex_name=r'\Phi')
1158            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
1159            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1160            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1161            sage: g = M.metric()
1162            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
1163            ....:       1+2*m/r, r^2, r^2*sin(th)^2
1164            sage: xi = M.vector_field(); v = M.vector_field(); e1 = M.vector_field()
1165            sage: e2 = M.vector_field(); xi[0]=-1; v[0]=r; v[1]=-r; e1[2]=1; e2[3]=1
1166            sage: H.set_transverse(rigging=[v])
1167            sage: S = H.screen('S', [e1, e2], (xi)); T = H.adapted_frame()
1168            sage: V = H.principal_directions()
1169            sage: V[2][0].disp(T)
1170            e_2 = xi
1171
1172        """
1173        if self._codim != 1:
1174            raise ValueError("'principal directions' is defined"+
1175                                      " only for hypersurfaces.")
1176        if screen is None:
1177            screen = self.default_screen()
1178        if screen._name in self._principal_directions:
1179            return self._principal_directions[screen._name]
1180        a = self.shape_operator(screen)
1181        frame = self.adapted_frame(screen)
1182        pr_d = matrix(
1183            [[a[frame, :][i, j].expr() for i in self.irange()]
1184             for j in self.irange()]).eigenvectors_right()
1185        res = []
1186        counter = self.irange()
1187        for eigen_space in pr_d:
1188            for eigen_vector in eigen_space[1]:
1189                v = self._ambient.vector_field(name="e_{}".format(next(counter))).along(self.immersion())
1190                v[frame, :] = [elt for elt in eigen_vector]+ [0]
1191                res.append((TangentTensor(v, self.immersion()), eigen_space[0]))
1192                #res[-1][0].set_name("e_{}".format(next(counter)))
1193        self._principal_directions[screen._name] = res
1194        return res
1195
1196    def principal_curvatures(self, screen=None):
1197        r"""
1198
1199        Principal curvatures are eigenfunctions of the shape operator. This
1200        method is implemented only for hypersurfaces.
1201       
1202        INPUT:
1203
1204        - ``screen`` -- (default: ``None``); an instance of
1205          :class:`~sage.manifolds.differentiable.degenerate_submanifold.Screen`
1206          if ``None`` default screen is used.
1207        OUTPUT:
1208
1209        - a dictionnary
1210
1211        EXAMPLES:
1212
1213        The horizon of the Shawrzschild black hole::
1214
1215            sage: M = Manifold(4, 'M', structure="Lorentzian")
1216            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1217            ....: ph:(0,2*pi):\phi")
1218            sage: var('m'); assume(m>0)
1219            m
1220            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1221            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1222            ....: hph:(0,2*pi):\phi")
1223            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1224            ....:       name='Phi', latex_name=r'\Phi')
1225            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
1226            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1227            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1228            sage: g = M.metric()
1229            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
1230            ....: 1+2*m/r, r^2, r^2*sin(th)^2
1231            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field();
1232            sage: e2=M.vector_field();xi[0]=-1;v[0] =r; v[1]=-r;e1[2]=1;e2[3]=1
1233            sage: H.set_transverse(rigging=[v])
1234            sage: S = H.screen('S', [e1, e2], (xi));
1235            sage: rho = H.principal_curvatures()
1236            sage: rho[2].disp()
1237            k_2: H --> R
1238                (ht, hth, hph) |--> 0
1239
1240        """
1241        if self._codim != 1:
1242            raise ValueError("'principal_curvatures' is defined"+
1243                                      " only for hypersurfaces.")
1244        if screen is None:
1245            screen = self.default_screen()
1246        if screen._name in self._principal_curvatures:
1247            return self._principal_curvatures[screen._name]
1248        a = self.shape_operator(screen)
1249        frame = self.adapted_frame()
1250        res = matrix([[a[frame, :][i, j].expr() for i in self.irange()] 
1251                      for j in self.irange()]).eigenvalues()
1252        counter = self.irange()
1253        for i in range(self._dim):
1254            res[i] = self.scalar_field(res[i], name="k_{}".format(next(counter)))
1255        self._principal_curvatures[screen._name] = res
1256        return res
1257
1258    def mean_curvature(self, screen=None):
1259        r"""
1260
1261        Mean curvature is the sum of principal curvatures. This
1262        method is implemented only for hypersurfaces.
1263       
1264        INPUT:
1265
1266        - ``screen`` -- (default: ``None``); an instance of
1267          :class:`~sage.manifolds.differentiable.degenerate_submanifold.Screen`
1268          if ``None`` default screen is used.
1269        OUTPUT:
1270
1271        - a dictionnary
1272
1273        EXAMPLES:
1274
1275        The horizon of the Shawrzschild black hole::
1276
1277            sage: M = Manifold(4, 'M', structure="Lorentzian")
1278            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1279            ....: ph:(0,2*pi):\phi")
1280            sage: var('m'); assume(m>0)
1281            m
1282            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1283            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1284            ....: hph:(0,2*pi):\phi")
1285            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1286            ....:       name='Phi', latex_name=r'\Phi')
1287            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
1288            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1289            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1290            sage: g = M.metric()
1291            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
1292            ....: 1+2*m/r, r^2, r^2*sin(th)^2
1293            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
1294            sage: e2=M.vector_field();xi[0]=-1; v[0] =r; v[1]=-r; e1[2]=1; e2[3]=1
1295            sage: H.set_transverse(rigging=[v])
1296            sage: S = H.screen('S', [e1, e2], (xi));
1297            sage: m = H.mean_curvature(); m
1298            Scalar field on the degenerate hypersurface H embedded in 4-dimensional
1299            differentiable manifold M
1300            sage: m.disp()
1301            H --> R
1302              (ht, hth, hph) |--> 0
1303
1304        """
1305        if self._codim != 1:
1306            raise ValueError("'mean_curvature' is defined"+
1307                    " only for hypersurfaces.")
1308        if screen is None:
1309            screen = self.default_screen()
1310        if screen._name in self._mean_curvature:
1311            return self._mean_curvature[screen._name]
1312        self._mean_curvature[screen._name] = self.scalar_field({chart: sum(
1313            self.principal_curvatures(screen)).expr(chart) / self._dim
1314                                                  for chart in
1315                                                  self.top_charts()})
1316        return self._mean_curvature[screen._name]
1317
1318    def is_tangent(self, v):
1319        r"""
1320        This method determine whether a vector field on the ambient
1321        manifold along ``self`` is tangent to ``self`` or not
1322       
1323        INPUT:
1324
1325        - ``v`` -- field on the ambient manifold along ``self``
1326
1327        OUTPUT:
1328
1329        - True if ``v`` is everywhere tangent to ``self`` or False if not
1330
1331        EXAMPLES:
1332
1333        The horizon of the Shawrzschild black hole::
1334
1335            sage: M = Manifold(4, 'M', structure="Lorentzian")
1336            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1337            ....: ph:(0,2*pi):\phi")
1338            sage: var('m'); assume(m>0)
1339            m
1340            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1341            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1342            ....: hph:(0,2*pi):\phi")
1343            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1344            ....:       name='Phi', latex_name=r'\Phi')
1345            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
1346            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1347            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1348            sage: g = M.metric()
1349            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
1350            ....: 1+2*m/r, r^2, r^2*sin(th)^2
1351            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
1352            sage: e2=M.vector_field();xi[0]=-1; v[0] =r; v[1]=-r; e1[2]=1; e2[3]=1
1353            sage: H.set_transverse(rigging=[v])
1354            sage: S = H.screen('S', [e1, e2], (xi));
1355            sage: H.is_tangent(xi.along(Phi))
1356            True
1357            sage: H.is_tangent(v.along(Phi))
1358            False
1359
1360        """
1361        g = self.ambient_metric()
1362        im = self.immersion()
1363        decomposition = self._ambient_decomposition()
1364        rad, normal = decomposition[1], decomposition[2]
1365        for u in rad:
1366            if not g.along(im)(u.along(im),v).is_zero():
1367                return False
1368        for u in normal:
1369            if not g.along(im)(u.along(im),v).is_zero():
1370                return False
1371        return True 
1372
1373    def _weingarten_map(self, screen=None):
1374        r"""
1375
1376        This method is implemented only for hypersurfaces.
1377        *Weigarten map* is the `1-`form `W` defined for a vector field
1378        `U` tangent to ``self`` by
1379
1380        .. MATH::
1381
1382        W(U)=\nabla_U\xi
1383
1384        being `\nabla` the Levi-Civita connection of the ambient manifold
1385        and `\xi` the choosen vector field spanning the radical distribution.
1386       
1387        INPUT:
1388
1389        - ``screen`` -- (default: ``None``); an instance of
1390          :class:`~sage.manifolds.differentiable.degenerate_submanifold.Screen`
1391          if ``None`` default screen is used.
1392        OUTPUT:
1393
1394        - a dictionnary
1395
1396        EXAMPLES:
1397
1398        The horizon of the Shawrzschild black hole::
1399
1400            sage: M = Manifold(4, 'M', structure="Lorentzian")
1401            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1402            ....: ph:(0,2*pi):\phi")
1403            sage: var('m'); assume(m>0)
1404            m
1405            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1406            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1407            ....: hph:(0,2*pi):\phi")
1408            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1409            ....:       name='Phi', latex_name=r'\Phi')
1410            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
1411            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1412            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1413            sage: g = M.metric()
1414            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
1415            ....: 1+2*m/r, r^2, r^2*sin(th)^2
1416            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
1417            sage: e2=M.vector_field();xi[0]=-1;v[0]=r; v[1]=-r;e1[2]=1;e2[3]=1
1418            sage: H.set_transverse(rigging=[v])
1419            sage: S = H.screen('S', [e1, e2], (xi));
1420            sage: H._weingarten_map()
1421            Tensor field of type (1,1) on the 4-dimensional Lorentzian manifold M
1422
1423        """
1424        if self._ambient._dim-self._dim != 1:
1425            raise NotImplementedError("'shape_operator' is implemented"+
1426                                      " only for hypersurfaces.")
1427        rad = self._ambient_decomposition(screen)[1]
1428        nab = self.ambient_metric().connection()
1429        xi = rad[0]
1430        return nab(xi)
1431
1432    def weingarten_map(self, screen=None):
1433        r"""
1434
1435        This method is implemented only for hypersurfaces.
1436        *Weigarten map* is the `1-`form `W` defined for a vector field
1437        `U` tangent to ``self`` by
1438
1439        .. MATH::
1440
1441        W(U)=\nabla_U\xi
1442
1443        being `\nabla` the Levi-Civita connection of the ambient manifold
1444        and `\xi` the choosen vector field spanning the radical distribution.
1445       
1446        INPUT:
1447
1448        - ``screen`` -- (default: ``None``); an instance of
1449          :class:`~sage.manifolds.differentiable.degenerate_submanifold.Screen`
1450          if ``None`` default screen is used.
1451        OUTPUT:
1452
1453        - tensor of type `(1,1)` instance of
1454          :class:`~sage.manifolds.differentiable.degenerate_submanifold.TangentTensor`
1455
1456        EXAMPLES:
1457
1458        The horizon of the Shawrzschild black hole::
1459
1460            sage: M = Manifold(4, 'M', structure="Lorentzian")
1461            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1462            ....: ph:(0,2*pi):\phi")
1463            sage: var('m'); assume(m>0)
1464            m
1465            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1466            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1467            ....: hph:(0,2*pi):\phi")
1468            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1469            ....:       name='Phi', latex_name=r'\Phi')
1470            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]}, \
1471            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1472            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1473            sage: g = M.metric()
1474            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
1475            ....: 1+2*m/r, r^2, r^2*sin(th)^2
1476            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
1477            sage: e2=M.vector_field();xi[0]=-1; v[0]=r;v[1]=-r;e1[2]=1;e2[3]=1
1478            sage: H.set_transverse(rigging=[v])
1479            sage: S = H.screen('S', [e1, e2], (xi));  T = H.adapted_frame()
1480            sage: W = H.weingarten_map(); W
1481            Tensor field nabla_g(xi)|X(H) of type (1,1) along the degenerate
1482            hypersurface H embedded in 4-dimensional differentiable manifold
1483            M with values on the 4-dimensional Lorentzian manifold M
1484            sage: W.display()
1485            nabla_g(xi)|X(H) = -1/4/m d/dt*dt - 1/4/m d/dt*dr
1486            sage: W.display(T)
1487            nabla_g(xi)|X(H) = -1/4/m xi*xi^b
1488            sage: W(xi.along(Phi)).disp(T)
1489            -1/4/m xi
1490
1491        """
1492
1493        im = self.immersion()
1494        T = self.projection(self._weingarten_map(screen=screen))
1495        T.set_name("nabla_g(xi)|X("+self._name+")", 
1496          latex_name=r'\nabla_g(\xi)|_{\mathfrak{X}('+self._latex_name+r')}')
1497        return TangentTensor(T, im)
1498
1499    def shape_operator(self, screen=None):
1500        r"""
1501
1502        This method is implemented only for hypersurfaces.
1503        *shape operator* is the projection of the Weingarten map
1504        on the screen distribution along the radical distribution.
1505       
1506        INPUT:
1507
1508        - ``screen`` -- (default: ``None``); an instance of
1509          :class:`~sage.manifolds.differentiable.degenerate_submanifold.Screen`
1510          if ``None`` default screen is used.
1511        OUTPUT:
1512
1513        - tensor of type `(1,1)` instance of
1514          :class:`~sage.manifolds.differentiable.degenerate_submanifold.TangentTensor`
1515
1516        EXAMPLES:
1517
1518        The horizon of the Shawrzschild black hole::
1519
1520            sage: M = Manifold(4, 'M', structure="Lorentzian")
1521            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1522            ....: ph:(0,2*pi):\phi")
1523            sage: var('m'); assume(m>0)
1524            m
1525            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1526            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1527            ....: hph:(0,2*pi):\phi")
1528            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1529            ....:       name='Phi', latex_name=r'\Phi')
1530            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
1531            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1532            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1533            sage: g = M.metric()
1534            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, \
1535            ....: 2*m/r, 1+2*m/r, r^2, r^2*sin(th)^2
1536            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
1537            sage: e2=M.vector_field();xi[0]=-1;v[0]=r;v[1]=-r;e1[2]=1;e2[3]=1
1538            sage: H.set_transverse(rigging=[v])
1539            sage: S = H.screen('S', [e1, e2], (xi));
1540            sage: SO = H.shape_operator(); SO
1541            Tensor field A^* of type (1,1) along the degenerate hypersurface
1542            H embedded in 4-dimensional differentiable manifold M with values
1543            on the 4-dimensional Lorentzian manifold M
1544            sage: SO.disp()
1545            A^* = 0
1546
1547        """
1548        if screen is None:
1549            screen = self.default_screen()
1550        if screen._name in self._shape_operator:
1551            return self._shape_operator[screen._name]
1552        im = self.immersion()
1553        T = -self.screen_projection(self. \
1554                  _weingarten_map(screen=screen), screen=screen)
1555        T.set_name("A^*", latex_name =  r'A^\star')
1556        A = TangentTensor(T, im)
1557        self._shape_operator[screen._name] = A
1558        return A
1559
1560    def rotation_one_form(self, screen=None):
1561        r"""
1562
1563        This method is implemented only for hypersurfaces.
1564        *rotation one form* is the `1-`form `\tau` such that for any
1565        vector field `U` tangent to ``self``, the Weingarten map `W`
1566        and the shape operator `A^*` are related by
1567
1568        .. MATH::
1569
1570        W(U) = -A^*(U)-\tau(U)\xi
1571
1572        being `\xi` the choosen vector field spanning the radical distribution. 
1573       
1574        INPUT:
1575
1576        - ``screen`` -- (default: ``None``); an instance of
1577          :class:`Screen`
1578          if ``None`` default screen is used.
1579        OUTPUT:
1580
1581        - tensor of type `(0,1)` instance of
1582          :class:`TangentTensor`
1583
1584        EXAMPLES:
1585
1586        The horizon of the Shawrzschild black hole::
1587
1588            sage: M = Manifold(4, 'M', structure="Lorentzian")
1589            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1590            ....: ph:(0,2*pi):\phi")
1591            sage: var('m'); assume(m>0)
1592            m
1593            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1594            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1595            ....: hph:(0,2*pi):\phi")
1596            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1597            ....:       name='Phi', latex_name=r'\Phi')
1598            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
1599            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1600            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1601            sage: g = M.metric()
1602            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
1603            ....: 1+2*m/r, r^2, r^2*sin(th)^2
1604            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
1605            sage: e2=M.vector_field();xi[0]=-1;v[0]=r;v[1]=-r;e1[2]=1;e2[3]=1
1606            sage: H.set_transverse(rigging=[v])
1607            sage: S = H.screen('S', [e1, e2], (xi));  T = H.adapted_frame()
1608            sage: tau = H.rotation_one_form(); tau
1609            Tensor field tau of type (0,1) along the degenerate hypersurface H
1610            embedded in 4-dimensional differentiable manifold M with values on
1611            the 4-dimensional Lorentzian manifold M
1612            sage: tau.disp()
1613            tau = -1/4/m dt - 1/4/m dr
1614            sage: tau.display(T)
1615            tau = 1/4/m xi^b
1616
1617        """
1618        if screen is None:
1619            screen = self.default_screen()
1620        if screen._name in self._rotation_one_form:
1621            return self._rotation_one_form[screen._name]
1622        im = self.immersion()
1623        tau = self._ambient.diff_form(1, name='tau', latex_name=r'\tau').along(self.immersion())
1624        frame = self.adapted_frame(screen)
1625        W = -self._weingarten_map(screen).along(self.immersion())
1626        i = self._dim-self._sindex-1
1627        tau[frame, i] = W[frame, i, i]
1628        tau.set_name("tau", latex_name = r'\tau')
1629        tau = TangentTensor(tau, im)
1630        self._rotation_one_form[screen._name] = tau
1631        return tau
1632
1633    def is_totally_geodesic(self):
1634        r"""
1635
1636        This method is implemented only for hypersurfaces.
1637        An hypersurface is said to be *totally geodesic* when all
1638        principal curvatures are `0`.
1639
1640        EXAMPLES:
1641
1642        The horizon of the Shawrzschild black hole::
1643
1644            sage: M = Manifold(4, 'M', structure="Lorentzian")
1645            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1646            ....: ph:(0,2*pi):\phi")
1647            sage: var('m'); assume(m>0)
1648            m
1649            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1650            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1651            ....: hph:(0,2*pi):\phi")
1652            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1653            ....:       name='Phi', latex_name=r'\Phi')
1654            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
1655            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1656            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1657            sage: g = M.metric()
1658            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
1659            ....: 1+2*m/r, r^2, r^2*sin(th)^2
1660            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
1661            sage: e2=M.vector_field();xi[0]=-1;v[0]=r;v[1]=-r;e1[2]=1;e2[3]=1
1662            sage: H.set_transverse(rigging=[v])
1663            sage: S = H.screen('S', [e1, e2], (xi));
1664            sage: H.is_totally_geodesic()
1665            True
1666
1667        """
1668        cur = self.principal_curvatures()
1669        for elt in cur:
1670            if not elt.is_zero():
1671                return False
1672        return True
1673
1674    def is_totally_umbilical(self):
1675        r"""
1676
1677        This method is implemented only for hypersurfaces.
1678        An hypersurface is said to be *totally umbilical* when apart from
1679        eigenfunctions associated to vector of the radical distribution,
1680        all the others are equal.
1681
1682        EXAMPLES:
1683
1684        The horizon of the Shawrzschild black hole::
1685
1686            sage: M = Manifold(4, 'M', structure="Lorentzian")
1687            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1688            ....: ph:(0,2*pi):\phi")
1689            sage: var('m'); assume(m>0)
1690            m
1691            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1692            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1693            ....: hph:(0,2*pi):\phi")
1694            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1695            ....:       name='Phi', latex_name=r'\Phi')
1696            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
1697            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1698            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1699            sage: g = M.metric()
1700            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
1701            ....: 1+2*m/r, r^2, r^2*sin(th)^2
1702            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
1703            sage: e2=M.vector_field();xi[0]=-1;v[0]=r;v[1]=-r;e1[2]=1;e2[3]=1
1704            sage: H.set_transverse(rigging=[v])
1705            sage: S = H.screen('S', [e1, e2], (xi));
1706            sage: H.is_totally_umbilical()
1707            True
1708
1709        """
1710        screen = self.default_screen()
1711        B = self.second_fundamental_form(screen)
1712        g = self.first_fundamental_form()
1713        #elt = screen[0]
1714        #rho = B(elt, elt)/g(elt, elt)
1715        for elt in screen:
1716            try:
1717                elt = elt.along(self.immersion())
1718            except ValueError:
1719                pass
1720            if not g(elt, elt)==0:
1721                rho = B(elt, elt)/g(elt, elt)
1722                break
1723        for elt in screen:
1724            try:
1725                elt = elt.along(self.immersion())
1726            except ValueError:
1727                pass
1728            if not B(elt, elt)==rho*g(elt, elt):
1729                return False
1730        return True
1731
1732    def is_maximal(self):
1733        r"""
1734
1735        This method is implemented only for hypersurfaces.
1736        An hypersurface is said to be *totally umbilical* when the
1737        sum of all eigenfunctions is `0`.
1738
1739        EXAMPLES:
1740
1741        The horizon of the Shawrzschild black hole::
1742
1743            sage: M = Manifold(4, 'M', structure="Lorentzian")
1744            sage: X_M.<t, r, th, ph> = M.chart(r"t r:(0,oo) th:(0,pi):\theta \
1745            ....: ph:(0,2*pi):\phi")
1746            sage: var('m'); assume(m>0)
1747            m
1748            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1749            sage: X_H.<ht,hth,hph> = H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta \
1750            ....: hph:(0,2*pi):\phi")
1751            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]},
1752            ....:       name='Phi', latex_name=r'\Phi')
1753            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]},
1754            ....:       name='Phi_inv', latex_name=r'\Phi^{-1}')
1755            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1756            sage: g = M.metric()
1757            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = -1+2*m/r, 2*m/r, \
1758            ....: 1+2*m/r, r^2, r^2*sin(th)^2
1759            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
1760            sage: e2=M.vector_field();xi[0]=-1;v[0]=r;v[1]=-r;e1[2]=1;e2[3]=1
1761            sage: H.set_transverse(rigging=[v])
1762            sage: S = H.screen('S', [e1, e2], (xi));
1763            sage: H.is_maximal()
1764            True
1765
1766        """
1767        m = self.mean_curvature()
1768        if m.is_zero():
1769            return True
1770        return False
1771#**************************************************************************************
1772
1773from sage.manifolds.differentiable.vectorfield_module import VectorFieldModule
1774
1775class Screen(VectorFieldModule):
1776    r"""
1777    Let `H` be a lightlike submanifold embedded in a pseudo-Riemannian
1778    manifold `(M,g)` with `Phi` the embedding map. A screen distribution
1779    is a complementary `S` of the radical distribution `Rad(TM)=TH\cap
1780    T^\perp H` in `TH`. One then has
1781
1782    .. MATH::
1783
1784        TH=S\oplus_{orth}Rad(TH)
1785
1786    INPUT:
1787
1788    - ``submanifold`` -- a lightlike submanifold instance of
1789      :class:`DegenerateSubmanifold`
1790    - ``name`` -- name given to the screen distribution
1791    - ``screen`` -- vector fields of the ambient manifold which
1792      span the screen distribution
1793    - ``rad`` -- vector fields of the ambient manifold which
1794      span the radical distribution
1795    - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
1796      screen distribution; if ``None``, it is formed from ``name``
1797
1798    OUTPUT:
1799
1800    - an instance of
1801      :class:`sage.manifolds.differentiable.vectorfield_module.VectorFieldModule`
1802
1803    EXAMPLES:
1804
1805    The horizon of the Shawrzschild black hole::
1806
1807        sage: M = Manifold(4, 'M', structure="Lorentzian")
1808        sage: X_M.<t, r, th, ph> = \
1809        ....: M.chart(r"t r:(0,oo) th:(0,pi):\theta ph:(0,2*pi):\phi")
1810        sage: var('m'); assume(m>0)
1811        m
1812        sage: g = M.metric()
1813        sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = \
1814        ....: -1+2*m/r, 2*m/r, 1+2*m/r, r^2, r^2*sin(th)^2
1815        sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
1816        sage: X_H.<ht,hth,hph> = \
1817        ....: H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta hph:(0,2*pi):\phi")
1818        sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]}, \
1819        ....: name='Phi', latex_name=r'\Phi')
1820        sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]}, \
1821        ....: name='Phi_inv', latex_name=r'\Phi^{-1}')
1822        sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
1823        sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
1824        sage: e2=M.vector_field();xi[0]=-1;v[0]=r;v[1]=-r;e1[2]=1;e2[3]=1
1825
1826    A screen distribution for the Shawrzschild black hole horizon::
1827
1828        sage: H.set_transverse(rigging=v)
1829        sage: S = H.screen('S', [e1, e2], (xi)); S
1830        screen distribution S along the degenerate hypersurface H embedded
1831        in 4-dimensional differentiable manifold M mapped into the
1832        4-dimensional Lorentzian manifold M
1833
1834    The corresponding normal tangent null vector field and null
1835    transversal vector field::
1836
1837        sage: xi = S.normal_tangent_vector(); xi.disp()
1838        xi = -d/dt
1839        sage: N = S.rigging(); N.disp()
1840        N = d/dt - d/dr
1841
1842    Those vector fields are normalized by `g(xi,N)=1`::
1843
1844        sage: g.along(Phi)(xi, N).disp()
1845        g(xi,N): H --> R
1846        (ht, hth, hph) |--> 1
1847
1848    Section of the lightcone of the Minkowski space with a hyperplane
1849    passing through the origin::
1850
1851        sage: M = Manifold(4, 'M', structure="Lorentzian")
1852        sage: X.<t,x,y,z> = M.chart()
1853        sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
1854        sage: X_S.<u,v> = S.chart()
1855        sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
1856        ....:               name='Phi', latex_name=r'\Phi')
1857        sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
1858        ....:                       latex_name=r'\Phi^{-1}')
1859        sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
1860        sage: g = M.metric()
1861        sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
1862           
1863    A screen distribution for this section of the lightcone::
1864
1865        sage: V = M.vector_field(); V[3] = 1
1866        sage: S.set_transverse(rigging=t, normal=V)
1867        sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
1868        sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
1869        sage: Sc = S.screen('Sc', U, xi); Sc
1870        screen distribution Sc along the 2-dimensional degenerate submanifold S
1871        embedded in 4-dimensional differentiable manifold M mapped into the
1872        4-dimensional Lorentzian manifold M
1873
1874    Different lists of vector fields spanning respectively the radical
1875    distribution and the complementary of the normal distribution in
1876    the transverse bundle::
1877
1878        sage:: Rad = Sc.normal_tangent_vector(); Rad[0].disp()
1879        sqrt(u^2 + v^2) d/dt + u d/dx + v d/dy
1880        sage: rig = Sc.rigging(); rig[0].disp()
1881        -d/dt       
1882
1883        """
1884   
1885    def __init__(self, submanifold, name, screen, rad, latex_name=None):
1886        r"""
1887
1888        TESTS::
1889
1890            sage: M = Manifold(4, 'M', structure="Lorentzian")
1891            sage: X.<t,x,y,z> = M.chart()
1892            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
1893            sage: X_S.<u,v> = S.chart()
1894            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
1895            ....:               name='Phi', latex_name=r'\Phi')
1896            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
1897            ....:                       latex_name=r'\Phi^{-1}')
1898            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
1899            sage: g = M.metric()
1900            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
1901            sage: V = M.vector_field(); V[3] = 1
1902            sage: S.set_transverse(rigging=t, normal=V)
1903            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
1904            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
1905            sage: Sc = S.screen('Sc', U, xi); Sc
1906            screen distribution Sc along the 2-dimensional degenerate submanifold S
1907            embedded in 4-dimensional differentiable manifold M mapped into the
1908            4-dimensional Lorentzian manifold M
1909
1910        """
1911        if not isinstance(submanifold, DegenerateSubmanifold):
1912            raise TypeError("the first argument must be a null submanifold")
1913        VectorFieldModule.__init__(self, submanifold, dest_map=submanifold.immersion())
1914        try:
1915            self._rigging = submanifold._transverse['rigging']
1916        except KeyError:
1917            raise ValueError("set first transverse by using `set_transverse` method")
1918        self._screen = list(screen)
1919        self._rad = list(rad)
1920        self._name = name
1921        if not latex_name:
1922            latex_name = name
1923        self._latex_name = latex_name
1924
1925    def _repr_(self):
1926        r"""
1927        String representation of ``self``.
1928
1929        TESTS::
1930
1931            sage: M = Manifold(4, 'M', structure="Lorentzian")
1932            sage: X.<t,x,y,z> = M.chart()
1933            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
1934            sage: X_S.<u,v> = S.chart()
1935            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
1936            ....:               name='Phi', latex_name=r'\Phi')
1937            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
1938            ....:                       latex_name=r'\Phi^{-1}')
1939            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
1940            sage: g = M.metric()
1941            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
1942            sage: V = M.vector_field(); V[3] = 1
1943            sage: S.set_transverse(rigging=t, normal=V)
1944            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
1945            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
1946            sage: Sc = S.screen('Sc', U, xi); Sc._repr_()
1947            'screen distribution Sc along the 2-dimensional degenerate submanifold S
1948            embedded in 4-dimensional differentiable manifold M mapped into the
1949            4-dimensional Lorentzian manifold M'
1950
1951        """
1952        description = "screen distribution "+self._name
1953        if self._dest_map is self._domain.identity_map():
1954            description += " on the {}".format(self._domain)
1955        else:
1956            description += (" along the {}".format(self._domain)
1957                            + " mapped into the {}".format(self._ambient_domain))
1958        return description
1959
1960    def __getitem__(self, i):
1961        r"""
1962        Access vector fields spanning the screen distribution.
1963
1964        INPUT:
1965
1966        - ``i`` -- index of the coordinate; if the slice ``[:]``, then all
1967            the coordinates are returned
1968
1969        OUTPUT:
1970
1971        - a vector field on the ambient manifold that belong to
1972        the screen distribution
1973
1974        TESTS::
1975
1976            sage: M = Manifold(4, 'M', structure="Lorentzian")
1977            sage: X.<t,x,y,z> = M.chart()
1978            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
1979            sage: X_S.<u,v> = S.chart()
1980            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
1981            ....:               name='Phi', latex_name=r'\Phi')
1982            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
1983            ....:                       latex_name=r'\Phi^{-1}')
1984            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
1985            sage: g = M.metric()
1986            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
1987            sage: V = M.vector_field(); V[3] = 1
1988            sage: S.set_transverse(rigging=t, normal=V)
1989            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
1990            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
1991            sage: Sc = S.screen('Sc', U, xi)
1992            sage: Sc.__getitem__(0)
1993            Vector field along the 2-dimensional degenerate submanifold S
1994            embedded in 4-dimensional differentiable manifold M with
1995            values on the 4-dimensional Lorentzian manifold M
1996
1997        """
1998        sc = [elt.along(self._domain.immersion()) for elt in self._screen]
1999        return sc[i-self._domain._sindex]
2000 
2001    def normal_tangent_vector(self):
2002        r"""
2003
2004        return either a list ``Rad`` of vector fields spanning the radical
2005        distribution or (in case of hypersurface) a normal tangent null
2006        vector field spanning the radical distribution.
2007
2008        OUTPUT:
2009
2010        - either a list made by vector fields or a vector field in
2011          case of hypersurface
2012
2013        EXAMPLES:
2014
2015        The horizon of the Shawrzschild black hole::
2016
2017            sage: M = Manifold(4, 'M', structure="Lorentzian")
2018            sage: X_M.<t, r, th, ph> = \
2019            ....: M.chart(r"t r:(0,oo) th:(0,pi):\theta ph:(0,2*pi):\phi")
2020            sage: var('m'); assume(m>0)
2021            m
2022            sage: g = M.metric()
2023            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = \
2024            ....: -1+2*m/r, 2*m/r, 1+2*m/r, r^2, r^2*sin(th)^2
2025            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
2026            sage: X_H.<ht,hth,hph> = \
2027            ....: H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta hph:(0,2*pi):\phi")
2028            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]}, \
2029            ....: name='Phi', latex_name=r'\Phi')
2030            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]}, \
2031            ....: name='Phi_inv', latex_name=r'\Phi^{-1}')
2032            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
2033            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
2034            sage: e2=M.vector_field();xi[0]=-1;v[0]=r;v[1]=-r;e1[2]=1;e2[3]=1
2035
2036        A screen distribution for the Shawrzschild black hole horizon::
2037
2038            sage: H.set_transverse(rigging=v)
2039            sage: S = H.screen('S', [e1, e2], (xi));
2040
2041        The corresponding normal tangent null vector field::
2042
2043            sage: Rad = S.normal_tangent_vector(); Rad.disp()
2044            xi = -d/dt
2045
2046        """
2047        rad = [elt.along(self._domain.immersion()) for elt in self._rad]
2048        if self._domain._codim==1:
2049            xi = rad[0]
2050            xi.set_name(name='xi', latex_name=r'\xi')
2051            return xi
2052        else:
2053            return rad
2054
2055    def rigging(self):
2056        r"""
2057
2058        Return either a list ``Rad`` of vector fields spanning the
2059        complementary of the normal distribution `T^\perp H` in the
2060        transverse bundle or (When `H` is a null hypersurface) the
2061        null transversal vector field defined in `\cite{DB1996]`.
2062
2063        OUTPUT:
2064
2065        - either a list made by vector fields or a vector field in
2066          case of hypersurface
2067
2068        EXAMPLES:
2069
2070        The horizon of the Shawrzschild black hole::
2071
2072            sage: M = Manifold(4, 'M', structure="Lorentzian")
2073            sage: X_M.<t, r, th, ph> = \
2074            ....: M.chart(r"t r:(0,oo) th:(0,pi):\theta ph:(0,2*pi):\phi")
2075            sage: var('m'); assume(m>0)
2076            m
2077            sage: g = M.metric()
2078            sage: g[0,0], g[0,1], g[1,1], g[2,2], g[3,3] = \
2079            ....: -1+2*m/r, 2*m/r, 1+2*m/r, r^2, r^2*sin(th)^2
2080            sage: H = Manifold(3, 'H', ambient=M, structure='degenerate_metric')
2081            sage: X_H.<ht,hth,hph> = \
2082            ....: H.chart(r"ht:(-oo,oo):t hth:(0,pi):\theta hph:(0,2*pi):\phi")
2083            sage: Phi = H.diff_map(M, {(X_H, X_M): [ht, 2*m,hth, hph]}, \
2084            ....: name='Phi', latex_name=r'\Phi')
2085            sage: Phi_inv = M.diff_map(H, {(X_M, X_H): [t,th, ph]}, \
2086            ....: name='Phi_inv', latex_name=r'\Phi^{-1}')
2087            sage: H.set_immersion(Phi, inverse=Phi_inv); H.declare_embedding()
2088            sage: xi=M.vector_field(); v=M.vector_field(); e1=M.vector_field()
2089            sage: e2=M.vector_field();xi[0]=-1;v[0]=r;v[1]=-r;e1[2]=1;e2[3]=1
2090
2091        A screen distribution for the Shawrzschild black hole horizon::
2092
2093            sage: H.set_transverse(rigging=v)
2094            sage: S = H.screen('S', [e1, e2], (xi));
2095
2096        The corresponding null transversal vector field::
2097
2098            sage: N = S.rigging(); N.disp()
2099            N = d/dt - d/dr
2100
2101        """
2102        im = self._domain.immersion()
2103        rig = [elt.along(im) for elt in self._domain._transverse['rigging']]
2104        if self._domain._codim!=1:
2105            return rig
2106        xi = self.normal_tangent_vector()
2107        v = rig[0]
2108        g = self._domain.ambient_metric().along(im)
2109        N = (1/g(xi, v))*(v-(g(v,v)/(2*g(xi, v)))*xi)
2110        N.set_name(name='N')
2111        return N
2112
2113   
2114#*******************************************************************************************
2115
2116from sage.manifolds.differentiable.tensorfield_paral import TensorFieldParal
2117from sage.manifolds.differentiable.tensorfield import TensorField
2118from sage.tensor.modules.tensor_with_indices import TensorWithIndices
2119
2120class TangentTensor(TensorFieldParal):
2121    r"""
2122    Let `S` be a lightlike submanifold embedded in a pseudo-Riemannian
2123    manifold `(M,g)` with `Phi` the embedding map. Let `T1` be a tensor
2124    on `M` along `S` or not. `TangentTensor(T1,Phi)` returns restriction
2125    `T2` of `T1` along `S` that in addition can be applied only on vector
2126    fields tangent to `S`, when `T1` has a covariant part.
2127
2128    INPUT:
2129
2130    - ``tensor`` -- a tensor field on the ambient manifold
2131
2132    OUTPUT:
2133
2134    - a tensor field on the ambient manifold along the submanifold
2135       
2136    EXAMPLES:
2137
2138        Section of the lightcone of the Minkowski space with a hyperplane
2139        passing through the origin::
2140
2141            sage: M = Manifold(4, 'M', structure="Lorentzian")
2142            sage: X.<t,x,y,z> = M.chart()
2143            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
2144            sage: X_S.<u,v> = S.chart()
2145            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
2146            ....:               name='Phi', latex_name=r'\Phi')
2147            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
2148            ....:                       latex_name=r'\Phi^{-1}')
2149            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
2150            sage: g = M.metric()
2151            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
2152            sage: V = M.vector_field(); V[3] = 1
2153            sage: S.set_transverse(rigging=t, normal=V)
2154            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
2155            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
2156            sage: Sc = S.screen('Sc', U, xi);
2157            sage: T1 = M.tensor_field(1,1).along(Phi); T1[0,0] = 1
2158            sage: V1 = M.vector_field().along(Phi); V1[0] = 1; V1[1]=1
2159            sage: T1(V1).disp()
2160            d/dt
2161            sage: from sage.manifolds.differentiable.degenerate_submanifold import TangentTensor
2162            sage: T2 = TangentTensor(T1, Phi); V2 = S.projection(V1)
2163            sage: T2(V2).disp()
2164            u/sqrt(u^2 + v^2) d/dt
2165
2166        Of course `T1` and `T2` give the same output on vector fields tangent to S::
2167
2168            sage: T1(xi.along(Phi)).disp()
2169            sqrt(u^2 + v^2) d/dt
2170            sage: T2(xi.along(Phi)).disp()
2171            sqrt(u^2 + v^2) d/dt
2172
2173
2174
2175        """
2176   
2177    def __init__(self, tensor, embedding):
2178        r"""
2179
2180        TESTS::
2181
2182            sage: M = Manifold(4, 'M', structure="Lorentzian")
2183            sage: X.<t,x,y,z> = M.chart()
2184            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
2185            sage: X_S.<u,v> = S.chart()
2186            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
2187            ....:               name='Phi', latex_name=r'\Phi')
2188            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
2189            ....:                       latex_name=r'\Phi^{-1}')
2190            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
2191            sage: g = M.metric()
2192            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
2193            sage: V = M.vector_field(); V[3] = 1
2194            sage: S.set_transverse(rigging=t, normal=V)
2195            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
2196            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
2197            sage: Sc = S.screen('Sc', U, xi);
2198            sage: T1 = M.tensor_field(1,1).along(Phi); T1[0,0] = 1
2199            sage: V1 = M.vector_field().along(Phi); V1[0] = 1; V1[1]=1
2200            sage: from sage.manifolds.differentiable.degenerate_submanifold import TangentTensor
2201            sage: T2 = TangentTensor(T1, Phi); V2 = S.projection(V1)
2202            sage: T1(xi.along(Phi)).disp()
2203            sqrt(u^2 + v^2) d/dt
2204            sage: T2(xi.along(Phi)).disp()
2205            sqrt(u^2 + v^2) d/dt
2206       
2207        """
2208        if not isinstance(tensor, TensorField):
2209            raise TypeError("the second argument must be a tensor field")
2210        self._tensor = tensor
2211        self._tensor.set_name(tensor._name, latex_name=tensor._latex_name)
2212        self._embedding = embedding
2213        try:
2214            tensor = tensor.along(embedding)
2215        except ValueError:
2216            pass
2217        if isinstance(tensor, TensorFieldParal):
2218            TensorFieldParal.__init__(self, tensor._vmodule, tensor._tensor_type, name=tensor._name,
2219                   latex_name=tensor._latex_name, sym=tensor._sym, antisym=tensor._antisym)
2220        else:
2221            TensorField.__init__(self, tensor._vmodule, tensor._tensor_type, name=tensor._name,
2222                   latex_name=tensor._latex_name, sym=tensor._sym, antisym=tensor._antisym)
2223        f = tensor._domain._ambient.default_frame().along(embedding)
2224        self[f, :] = tensor[f, :]
2225       
2226    def __call__(self, *args):
2227        r"""
2228
2229        TESTS::
2230
2231            sage: M = Manifold(4, 'M', structure="Lorentzian")
2232            sage: X.<t,x,y,z> = M.chart()
2233            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
2234            sage: X_S.<u,v> = S.chart()
2235            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
2236            ....:               name='Phi', latex_name=r'\Phi')
2237            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
2238            ....:                       latex_name=r'\Phi^{-1}')
2239            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
2240            sage: g = M.metric()
2241            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
2242            sage: V = M.vector_field(); V[3] = 1
2243            sage: S.set_transverse(rigging=t, normal=V)
2244            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
2245            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
2246            sage: Sc = S.screen('Sc', U, xi);
2247            sage: T1 = M.tensor_field(1,1).along(Phi); T1[0,0] = 1
2248            sage: V1 = M.vector_field().along(Phi); V1[0] = 1; V1[1]=1
2249            sage: from sage.manifolds.differentiable.degenerate_submanifold import TangentTensor
2250            sage: T2 = TangentTensor(T1, Phi); V2 = S.projection(V1)
2251            sage: T1(xi.along(Phi)).disp()
2252            sqrt(u^2 + v^2) d/dt
2253            sage: T2(xi.along(Phi)).disp()
2254            sqrt(u^2 + v^2) d/dt
2255
2256        """
2257        for vector in args:
2258            try:
2259                vector = vector.along(self._embedding)
2260            except ValueError:
2261                pass
2262            if not self._domain.is_tangent(vector):
2263                raise ValueError("The provided vector field is not "+
2264                        "tangent to {}".format(self._domain._name))
2265        try:
2266            return TensorField.__call__(self._tensor.along(self._embedding), *args)
2267        except ValueError:   
2268            return TensorField.__call__(self._tensor, *args)
2269
2270    def extension(self):
2271        r"""
2272
2273        Return initial tensor
2274
2275        EXAMPLES:
2276
2277        Section of the lightcone of the Minkowski space with a hyperplane
2278        passing through the origin::
2279
2280            sage: M = Manifold(4, 'M', structure="Lorentzian")
2281            sage: X.<t,x,y,z> = M.chart()
2282            sage: S = Manifold(2, 'S', ambient=M, structure='degenerate_metric')
2283            sage: X_S.<u,v> = S.chart()
2284            sage: Phi = S.diff_map(M, {(X_S, X): [sqrt(u^2+v^2), u, v, 0]},
2285            ....:               name='Phi', latex_name=r'\Phi')
2286            sage: Phi_inv = M.diff_map(S, {(X, X_S): [x, y]}, name='Phi_inv',
2287            ....:                       latex_name=r'\Phi^{-1}')
2288            sage: S.set_immersion(Phi, inverse=Phi_inv); S.declare_embedding()
2289            sage: g = M.metric()
2290            sage: g[0,0], g[1,1], g[2,2], g[3,3] = -1,1,1,1
2291            sage: V = M.vector_field(); V[3] = 1
2292            sage: S.set_transverse(rigging=t, normal=V)
2293            sage: xi = M.vector_field(); xi[0] = sqrt(x^2+y^2+z^2); xi[1] = x; xi[2] = y
2294            sage: U = M.vector_field(); U[1] = sqrt(x^2+y^2+z^2); U[0] = x
2295            sage: Sc = S.screen('Sc', U, xi);
2296            sage: T1 = M.tensor_field(1,1).along(Phi); T1[0,0] = 1
2297            sage: from sage.manifolds.differentiable.degenerate_submanifold import TangentTensor
2298            sage: T2 = TangentTensor(T1, Phi); T3 = T2.extension()
2299            sage: T3 is T2
2300            False
2301            sage: T3 is T1
2302            True
2303       
2304        """
2305        return self._tensor