Tangent Vectors - Manifolds

Skip to content
Back to top
View this page
Edit this page

# Tangent Vectors

The class `TangentVector` implements tangent vectors to a differentiable manifold.

AUTHORS:

- Eric Gourgoulhon, Michal Bejger (2014-2015): initial version

- Travis Scrimshaw (2016): review tweaks

REFERENCES:

- Chap. 3 of [Lee2013]

class sage.manifolds.differentiable.tangent_vector.TangentVector(parent, name=None, latex_name=None)

  Bases: `FiniteRankFreeModuleElement`

  Tangent vector to a differentiable manifold at a given point.

  INPUT:

  - `parent` – `TangentSpace`; the tangent space to which the vector belongs

  - `name` – (default: `None`) string; symbol given to the vector

  - `latex_name` – (default: `None`) string; LaTeX symbol to denote the vector; if `None`, `name` will be used

  EXAMPLES:

  A tangent vector \(v\) on a 2-dimensional manifold:

  Sage

      sage: M = Manifold(2, 'M')
      sage: X.<x,y> = M.chart()
      sage: p = M.point((2,3), name='p')
      sage: Tp = M.tangent_space(p)
      sage: v = Tp((-2,1), name='v') ; v
      Tangent vector v at Point p on the 2-dimensional differentiable
       manifold M
      sage: v.display()
      v = -2 ∂/∂x + ∂/∂y
      sage: v.parent()
      Tangent space at Point p on the 2-dimensional differentiable manifold M
      sage: v in Tp
      True

  Python

      >>> from sage.all import *
      >>> M = Manifold(Integer(2), 'M')
      >>> X = M.chart(names=('x', 'y',)); (x, y,) = X._first_ngens(2)
      >>> p = M.point((Integer(2),Integer(3)), name='p')
      >>> Tp = M.tangent_space(p)
      >>> v = Tp((-Integer(2),Integer(1)), name='v') ; v
      Tangent vector v at Point p on the 2-dimensional differentiable
       manifold M
      >>> v.display()
      v = -2 ∂/∂x + ∂/∂y
      >>> v.parent()
      Tangent space at Point p on the 2-dimensional differentiable manifold M
      >>> v in Tp
      True

  Tangent vectors can also be constructed via the manifold method `tangent_vector()`:

  Sage

      sage: v = M.tangent_vector(p, (-2, 1), name='v'); v
      Tangent vector v at Point p on the 2-dimensional differentiable
       manifold M
      sage: v.display()
      v = -2 ∂/∂x + ∂/∂y

  [Python]

      >>> from sage.all import *
      >>> v = M.tangent_vector(p, (-Integer(2), Integer(1)), name='v'); v
      Tangent vector v at Point p on the 2-dimensional differentiable
       manifold M
      >>> v.display()
      v = -2 ∂/∂x + ∂/∂y

  or via the method `at()` of vector fields:

  Sage

      sage: vf = M.vector_field(x - 4*y/3, (x-y)^2, name='v')
      sage: v = vf.at(p); v
      Tangent vector v at Point p on the 2-dimensional differentiable
       manifold M
      sage: v.display()
      v = -2 ∂/∂x + ∂/∂y

  Python

      >>> from sage.all import *
      >>> vf = M.vector_field(x - Integer(4)*y/Integer(3), (x-y)**Integer(2), name='v')
      >>> v = vf.at(p); v
      Tangent vector v at Point p on the 2-dimensional differentiable
       manifold M
      >>> v.display()
      v = -2 ∂/∂x + ∂/∂y

  By definition, a tangent vector at \(p\in M\) is a derivation at \(p\) on the space \(C^\infty(M)\) of smooth scalar fields on \(M\). Indeed let us consider a generic scalar field \(f\):

  Sage

      sage: f = M.scalar_field(function('F')(x,y), name='f')
      sage: f.display()
      f: M → ℝ
         (x, y) ↦ F(x, y)

  [Python]

      >>> from sage.all import *
      >>> f = M.scalar_field(function('F')(x,y), name='f')
      >>> f.display()
      f: M → ℝ
         (x, y) ↦ F(x, y)

  The tangent vector \(v\) maps \(f\) to the real number \(v^i \left. \frac{\partial F}{\partial x^i} \right|_p\):

  Sage

      sage: v(f)
      -2*D[0](F)(2, 3) + D[1](F)(2, 3)
      sage: vdf(x, y) = v[0]*diff(f.expr(), x) + v[1]*diff(f.expr(), y)
      sage: X(p)
      (2, 3)
      sage: bool( v(f) == vdf(*X(p)) )
      True

  Python

      >>> from sage.all import *
      >>> v(f)
      -2*D[0](F)(2, 3) + D[1](F)(2, 3)
      >>> __tmp__=var("x,y"); vdf = symbolic_expression(v[Integer(0)]*diff(f.expr(), x) + v[Integer(1)]*diff(f.expr(), y)).function(x,y)
      >>> X(p)
      (2, 3)
      >>> bool( v(f) == vdf(*X(p)) )
      True

  and if \(g\) is a second scalar field on \(M\):

  Sage

      sage: g = M.scalar_field(function('G')(x,y), name='g')

  [Python]

      >>> from sage.all import *
      >>> g = M.scalar_field(function('G')(x,y), name='g')

  then the product \(f g\) is also a scalar field on \(M\):

  Sage

      sage: (f*g).display()
      f*g: M → ℝ
         (x, y) ↦ F(x, y)*G(x, y)

  Python

      >>> from sage.all import *
      >>> (f*g).display()
      f*g: M → ℝ
         (x, y) ↦ F(x, y)*G(x, y)

  and we have the derivation law \(v(f g) = v(f) g(p) + f(p) v(g)\):

  Sage

      sage: bool( v(f*g) == v(f)*g(p) + f(p)*v(g) )
      True

  [Python]

      >>> from sage.all import *
      >>> bool( v(f*g) == v(f)*g(p) + f(p)*v(g) )
      True

  See also

  `FiniteRankFreeModuleElement` for more documentation.

  plot(chart=None, ambient_coords=None, mapping=None, color='blue', print_label=True, label=None, label_color=None, fontsize=10, label_offset=0.1, parameters=None, scale=1, **extra_options)

    Plot the vector in a Cartesian graph based on the coordinates of some ambient chart.

    The vector is drawn in terms of two (2D graphics) or three (3D graphics) coordinates of a given chart, called hereafter the ambient chart. The vector’s base point \(p\) (or its image \(\Phi(p)\) by some differentiable mapping \(\Phi\)) must lie in the ambient chart’s domain. If \(\Phi\) is different from the identity mapping, the vector actually depicted is \(\mathrm{d}\Phi_p(v)\), where \(v\) is the current vector (`self`) (see the example of a vector tangent to the 2-sphere below, where \(\Phi: S^2 \to \RR^3\)).

    INPUT:

    - `chart` – (default: `None`) the ambient chart (see above); if `None`, it is set to the default chart of the open set containing the point at which the vector (or the vector image via the differential \(\mathrm{d}\Phi_p\) of `mapping`) is defined

    - `ambient_coords` – (default: `None`) tuple containing the 2 or 3 coordinates of the ambient chart in terms of which the plot is performed; if `None`, all the coordinates of the ambient chart are considered

    - `mapping` – (default: `None`) `DiffMap`; differentiable mapping \(\Phi\) providing the link between the point \(p\) at which the vector is defined and the ambient chart `chart`: the domain of `chart` must contain \(\Phi(p)\); if `None`, the identity mapping is assumed

    - `scale` – (default: 1) value by which the length of the arrow representing the vector is multiplied

    - `color` – (default: `'blue'`) color of the arrow representing the vector

    - `print_label` – boolean (default: `True`); determines whether a label is printed next to the arrow representing the vector

    - `label` – (string; default: `None`) label printed next to the arrow representing the vector; if `None`, the vector’s symbol is used, if any

    - `label_color` – (default: `None`) color to print the label; if `None`, the value of `color` is used

    - `fontsize` – (default: 10) size of the font used to print the label

    - `label_offset` – (default: 0.1) determines the separation between the vector arrow and the label

    - `parameters` – (default: `None`) dictionary giving the numerical values of the parameters that may appear in the coordinate expression of `self` (see example below)

    - `**extra_options` – extra options for the arrow plot, like `linestyle`, `width` or `arrowsize` (see `arrow2d()` and `arrow3d()` for details)

    OUTPUT:

    - a graphic object, either an instance of `Graphics` for a 2D plot (i.e. based on 2 coordinates of `chart`) or an instance of `Graphics3d` for a 3D plot (i.e. based on 3 coordinates of `chart`)

    EXAMPLES:

    Vector tangent to a 2-dimensional manifold:

    Sage

        sage: M = Manifold(2, 'M')
        sage: X.<x,y> = M.chart()
        sage: p = M((2,2), name='p')
        sage: Tp = M.tangent_space(p)
        sage: v = Tp((2, 1), name='v') ; v
        Tangent vector v at Point p on the 2-dimensional differentiable
         manifold M

    Python

        >>> from sage.all import *
        >>> M = Manifold(Integer(2), 'M')
        >>> X = M.chart(names=('x', 'y',)); (x, y,) = X._first_ngens(2)
        >>> p = M((Integer(2),Integer(2)), name='p')
        >>> Tp = M.tangent_space(p)
        >>> v = Tp((Integer(2), Integer(1)), name='v') ; v
        Tangent vector v at Point p on the 2-dimensional differentiable
         manifold M

    Plot of the vector alone (arrow + label):

    Sage

        sage: v.plot()                                                              # needs sage.plot
        Graphics object consisting of 2 graphics primitives

    [Python]

        >>> from sage.all import *
        >>> v.plot()                                                              # needs sage.plot
        Graphics object consisting of 2 graphics primitives

    Plot atop of the chart grid:

    Sage

        sage: X.plot() + v.plot()                                                   # needs sage.plot
        Graphics object consisting of 20 graphics primitives

    Python

        >>> from sage.all import *
        >>> X.plot() + v.plot()                                                   # needs sage.plot
        Graphics object consisting of 20 graphics primitives

    Plots with various options:

    Sage

        sage: X.plot() + v.plot(color='green', scale=2, label='V')                  # needs sage.plot
        Graphics object consisting of 20 graphics primitives

    [Python]

        >>> from sage.all import *
        >>> X.plot() + v.plot(color='green', scale=Integer(2), label='V')                  # needs sage.plot
        Graphics object consisting of 20 graphics primitives

    Sage

        sage: X.plot() + v.plot(print_label=False)                                  # needs sage.plot
        Graphics object consisting of 19 graphics primitives

    Python

        >>> from sage.all import *
        >>> X.plot() + v.plot(print_label=False)                                  # needs sage.plot
        Graphics object consisting of 19 graphics primitives

    Sage

        sage: X.plot() + v.plot(color='green', label_color='black',                 # needs sage.plot
        ....:                   fontsize=20, label_offset=0.2)
        Graphics object consisting of 20 graphics primitives

    [Python]

        >>> from sage.all import *
        >>> X.plot() + v.plot(color='green', label_color='black',                 # needs sage.plot
        ...                   fontsize=Integer(20), label_offset=RealNumber('0.2'))
        Graphics object consisting of 20 graphics primitives

    Sage

        sage: X.plot() + v.plot(linestyle=':', width=4, arrowsize=8,                # needs sage.plot
        ....:                   fontsize=20)
        Graphics object consisting of 20 graphics primitives

    Python

        >>> from sage.all import *
        >>> X.plot() + v.plot(linestyle=':', width=Integer(4), arrowsize=Integer(8),                # needs sage.plot
        ...                   fontsize=Integer(20))
        Graphics object consisting of 20 graphics primitives

    Plot with specific values of some free parameters:

    Sage

        sage: var('a b')
        (a, b)
        sage: v = Tp((1+a, -b^2), name='v') ; v.display()
        v = (a + 1) ∂/∂x - b^2 ∂/∂y
        sage: X.plot() + v.plot(parameters={a: -2, b: 3})                           # needs sage.plot
        Graphics object consisting of 20 graphics primitives

    [Python]

        >>> from sage.all import *
        >>> var('a b')
        (a, b)
        >>> v = Tp((Integer(1)+a, -b**Integer(2)), name='v') ; v.display()
        v = (a + 1) ∂/∂x - b^2 ∂/∂y
        >>> X.plot() + v.plot(parameters={a: -Integer(2), b: Integer(3)})                           # needs sage.plot
        Graphics object consisting of 20 graphics primitives

    Special case of the zero vector:

    Sage

        sage: v = Tp.zero() ; v
        Tangent vector zero at Point p on the 2-dimensional differentiable
         manifold M
        sage: X.plot() + v.plot()                                                   # needs sage.plot
        Graphics object consisting of 19 graphics primitives

    Python

        >>> from sage.all import *
        >>> v = Tp.zero() ; v
        Tangent vector zero at Point p on the 2-dimensional differentiable
         manifold M
        >>> X.plot() + v.plot()                                                   # needs sage.plot
        Graphics object consisting of 19 graphics primitives

    Vector tangent to a 4-dimensional manifold:

    Sage

        sage: M = Manifold(4, 'M')
        sage: X.<t,x,y,z> = M.chart()
        sage: p = M((0,1,2,3), name='p')
        sage: Tp = M.tangent_space(p)
        sage: v = Tp((5,4,3,2), name='v') ; v
        Tangent vector v at Point p on the 4-dimensional differentiable
         manifold M

    [Python]

        >>> from sage.all import *
        >>> M = Manifold(Integer(4), 'M')
        >>> X = M.chart(names=('t', 'x', 'y', 'z',)); (t, x, y, z,) = X._first_ngens(4)
        >>> p = M((Integer(0),Integer(1),Integer(2),Integer(3)), name='p')
        >>> Tp = M.tangent_space(p)
        >>> v = Tp((Integer(5),Integer(4),Integer(3),Integer(2)), name='v') ; v
        Tangent vector v at Point p on the 4-dimensional differentiable
         manifold M

    We cannot make a 4D plot directly:

    Sage

        sage: v.plot()                                                              # needs sage.plot
        Traceback (most recent call last):
        ...
        ValueError: the number of coordinates involved in the plot must
         be either 2 or 3, not 4

    Python

        >>> from sage.all import *
        >>> v.plot()                                                              # needs sage.plot
        Traceback (most recent call last):
        ...
        ValueError: the number of coordinates involved in the plot must
         be either 2 or 3, not 4

    Rather, we have to select some chart coordinates for the plot, via the argument `ambient_coords`. For instance, for a 2-dimensional plot in terms of the coordinates \((x, y)\):

    Sage

        sage: v.plot(ambient_coords=(x,y))                                          # needs sage.plot
        Graphics object consisting of 2 graphics primitives

    [Python]

        >>> from sage.all import *
        >>> v.plot(ambient_coords=(x,y))                                          # needs sage.plot
        Graphics object consisting of 2 graphics primitives

    This plot involves only the components \(v^x\) and \(v^y\) of \(v\). Similarly, for a 3-dimensional plot in terms of the coordinates \((t, x, y)\):

    Sage

        sage: g = v.plot(ambient_coords=(t,x,z))                                    # needs sage.plot
        sage: print(g)                                                              # needs sage.plot
        Graphics3d Object

    Python

        >>> from sage.all import *
        >>> g = v.plot(ambient_coords=(t,x,z))                                    # needs sage.plot
        >>> print(g)                                                              # needs sage.plot
        Graphics3d Object

    This plot involves only the components \(v^t\), \(v^x\) and \(v^z\) of \(v\). A nice 3D view atop the coordinate grid is obtained via:

    Sage

        sage: (X.plot(ambient_coords=(t,x,z))  # long time                          # needs sage.plot
        ....:  + v.plot(ambient_coords=(t,x,z),
        ....:           label_offset=0.5, width=6))
        Graphics3d Object

    [Python]

        >>> from sage.all import *
        >>> (X.plot(ambient_coords=(t,x,z))  # long time                          # needs sage.plot
        ...  + v.plot(ambient_coords=(t,x,z),
        ...           label_offset=RealNumber('0.5'), width=Integer(6)))
        Graphics3d Object

    An example of plot via a differential mapping: plot of a vector tangent to a 2-sphere viewed in \(\RR^3\):

    Sage

        sage: S2 = Manifold(2, 'S^2')
        sage: U = S2.open_subset('U') # the open set covered by spherical coord.
        sage: XS.<th,ph> = U.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi')
        sage: R3 = Manifold(3, 'R^3')
        sage: X3.<x,y,z> = R3.chart()
        sage: F = S2.diff_map(R3, {(XS, X3): [sin(th)*cos(ph),
        ....:                                 sin(th)*sin(ph),
        ....:                                 cos(th)]}, name='F')
        sage: F.display() # the standard embedding of S^2 into R^3
        F: S^2 → R^3
        on U: (th, ph) ↦ (x, y, z) = (cos(ph)*sin(th), sin(ph)*sin(th), cos(th))
        sage: p = U.point((pi/4, 7*pi/4), name='p')
        sage: v = XS.frame()[1].at(p) ; v  # the coordinate vector ∂/∂phi at p
        Tangent vector ∂/∂ph at Point p on the 2-dimensional differentiable
         manifold S^2
        sage: graph_v = v.plot(mapping=F)                                           # needs sage.plot
        sage: graph_S2 = XS.plot(chart=X3, mapping=F, number_values=9)  # long time, needs sage.plot
        sage: graph_v + graph_S2                                        # long time, needs sage.plot
        Graphics3d Object

    Python

        >>> from sage.all import *
        >>> S2 = Manifold(Integer(2), 'S^2')
        >>> U = S2.open_subset('U') # the open set covered by spherical coord.
        >>> XS = U.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi', names=('th', 'ph',)); (th, ph,) = XS._first_ngens(2)
        >>> R3 = Manifold(Integer(3), 'R^3')
        >>> X3 = R3.chart(names=('x', 'y', 'z',)); (x, y, z,) = X3._first_ngens(3)
        >>> F = S2.diff_map(R3, {(XS, X3): [sin(th)*cos(ph),
        ...                                 sin(th)*sin(ph),
        ...                                 cos(th)]}, name='F')
        >>> F.display() # the standard embedding of S^2 into R^3
        F: S^2 → R^3
        on U: (th, ph) ↦ (x, y, z) = (cos(ph)*sin(th), sin(ph)*sin(th), cos(th))
        >>> p = U.point((pi/Integer(4), Integer(7)*pi/Integer(4)), name='p')
        >>> v = XS.frame()[Integer(1)].at(p) ; v  # the coordinate vector ∂/∂phi at p
        Tangent vector ∂/∂ph at Point p on the 2-dimensional differentiable
         manifold S^2
        >>> graph_v = v.plot(mapping=F)                                           # needs sage.plot
        >>> graph_S2 = XS.plot(chart=X3, mapping=F, number_values=Integer(9))  # long time, needs sage.plot
        >>> graph_v + graph_S2                                        # long time, needs sage.plot
        Graphics3d Object