# 12. Vector fields - continuation¶

This notebook is part of the Introduction to manifolds in SageMath by Andrzej Chrzeszczyk (Jan Kochanowski University of Kielce, Poland).

In [1]:
version()

Out[1]:
'SageMath version 9.6, Release Date: 2022-05-15'

### Vector fields defined in the intersection of two coordinate neighborhoods¶

The vector field which is defined in the intersection of two coordinate neighborhoods, can be expressed using two different charts and two different frames.

Example 12.1

Define a vector field $v$ in Cartesian coordinates in $R^2$. Check that if transition maps from Cartesian to polar and from polar to Cartesian coordinates are defined, then we have automatically the access to the representation of $v$ in both coordinate systems.

In [2]:
R2 = Manifold(2, 'R^2')              # manifold R2
c_cart.<x,y> = R2.chart()            # Cartesian coordinates on R2
c_pol.<r,ph> = R2.chart(r'r:(0,+oo) ph:(0,2*pi):\phi') # polar coord.
# U is an open subset of R2, such that, the transition from Cart.to pol.
# coord. and from polar to Cartesian coord. are smooth and bijective
U = R2.open_subset('U',coord_def={c_cart:(y!=0,x<0),c_pol:(ph!=0)});
cart_to_pol = c_cart.transition_map(c_pol,        # Cart. --> polar
[sqrt(x^2 + y^2),arctan2(y, x) ])    # transition
pol_to_cart = c_pol.transition_map(c_cart,        # polar --> Cart.
[r*cos(ph), r*sin(ph)])              # transition
v = R2.vector_field(2*x*y, (1-x^2+y^2), name='v') # vector field v


Display vector field $v$ in default chart and default frame:

In [3]:
%display latex                      # display v in default chart
v.display()                         # and frame

Out[3]:
$\displaystyle v = 2 \, x y \frac{\partial}{\partial x } + \left( -x^{2} + y^{2} + 1 \right) \frac{\partial}{\partial y }$

Display $v$ in polar frame, Cartesian chart:

In [4]:
v.display(c_pol.frame())          # v in polar frame, Cart.chart

Out[4]:
$\displaystyle v = \left( \frac{y^{3} + {\left(x^{2} + 1\right)} y}{\sqrt{x^{2} + y^{2}}} \right) \frac{\partial}{\partial r } + \left( -\frac{x^{3} + x y^{2} - x}{x^{2} + y^{2}} \right) \frac{\partial}{\partial {\phi} }$
In [5]:
# the same with factored components
v.apply_map(factor,frame=c_pol.frame()) # apply factor to comp.
v.display(c_pol.frame())

Out[5]:
$\displaystyle v = \left( \frac{{\left(x^{2} + y^{2} + 1\right)} y}{\sqrt{x^{2} + y^{2}}} \right) \frac{\partial}{\partial r } + \left( -\frac{{\left(x^{2} + y^{2} - 1\right)} x}{x^{2} + y^{2}} \right) \frac{\partial}{\partial {\phi} }$

We can also display components separately:

In [6]:
v.display_comp(c_pol.frame())          # display components

Out[6]:
$\displaystyle \begin{array}{lcl} v_{\phantom{\, r}}^{ \, r } & = & \frac{{\left(x^{2} + y^{2} + 1\right)} y}{\sqrt{x^{2} + y^{2}}} \\ v_{\phantom{\, {\phi}}}^{ \, {\phi} } & = & -\frac{{\left(x^{2} + y^{2} - 1\right)} x}{x^{2} + y^{2}} \end{array}$

Now use the polar basis and polar coordinates:

In [7]:
 v.display(c_pol.frame(),c_pol)    # pol.chart, pol.frame

Out[7]:
$\displaystyle v = \left( r^{2} \sin\left({\phi}\right) + \sin\left({\phi}\right) \right) \frac{\partial}{\partial r } + \left( -\frac{r^{2} \cos\left({\phi}\right) - \cos\left({\phi}\right)}{r} \right) \frac{\partial}{\partial {\phi} }$
In [8]:
# the same with factored components
v.apply_map(factor,frame=c_pol.frame(),chart=c_pol)
v.display(c_pol.frame(),c_pol)     # factor comp.

Out[8]:
$\displaystyle v = {\left(r^{2} + 1\right)} \sin\left({\phi}\right) \frac{\partial}{\partial r } -\frac{{\left(r + 1\right)} {\left(r - 1\right)} \cos\left({\phi}\right)}{r} \frac{\partial}{\partial {\phi} }$

Polar components, separately:

In [9]:
v.display_comp(c_pol.frame(),c_pol) # display comp.

Out[9]:
$\displaystyle \begin{array}{lcl} v_{\phantom{\, r}}^{ \, r } & = & {\left(r^{2} + 1\right)} \sin\left({\phi}\right) \\ v_{\phantom{\, {\phi}}}^{ \, {\phi} } & = & -\frac{{\left(r + 1\right)} {\left(r - 1\right)} \cos\left({\phi}\right)}{r} \end{array}$

### Module $\mathfrak{X}(M)$¶

Let $\mathfrak{X}(M)$ be the set of all smooth vector fields on a smooth manifold $M$.

The set $\mathfrak{X}(M)$ is a module (over $C^\infty(M)\$) if we define the operations

$$(X+Y)_p=X_p+Y_p,\\ (fX)_p=f(p)X_p,$$

for $X,Y\in \mathfrak{X}(M),\ \ f\in C^\infty(M).$

One can check that the just defined operations have the properties

$$(aX+bY)f=aXf+bYf,\\ (gX)f=g(Xf),$$

for $X,Y\in \mathfrak{X}(M),\ \ a,b\in R.\ \ f,g\in C^\infty(M).$

### Lie bracket¶

For $X,Y\in \mathfrak{X}(M)$ the Lie bracket is defined by

$$[X,Y]f=X(Yf)-Y(Xf),\quad\mbox{for}\quad f\in C^\infty(M).$$

From this definition it follows that $$[X,Y]=-[Y,X].$$

One can also prove that $[X,Y]\in\mathfrak{X}(M)$ and the Lie bracket is bilinear.

In fact if $X,Y\in\mathfrak{X}(M)$ and $f ∈ C^∞ (M)$, then $\ X(Y f )\$ and $\ Y(X f )\$ also belong to $C^∞ (M)$. We need to show that $[X,Y]$ has the derivation property. For that purpose let us note that for $\ f,g\in C^\infty(M),\ p\in M$

$$[X,Y]_p(fg)=X_p(Y_p(fg))-Y_p(X_p(fg))\\=X_p(f(p)Y_p(g)+g(p)Y_p(f))-Y_p(f(p)X_p(g)+g(p)X_p(f))\\ =f(p)X_p(Y_p(g))+g(p)X_p(Y_p(f))-f(p)Y_p(X_p(g))-g(p)(Y_p(X_p(f))\\ =f(p)[X,Y]_p(g)+g(p)[X,Y]_p(f),$$

and for $a,b\in R$

$$[X,Y]_p(af+bg)=X_p(Y_p(af+bg))-Y_p(X_p(af+bg))\\ =X_p(aY_p(f)+bY_p(g))-Y_p(aX_p(f)+bX_p(g))\\ =aX_p(Y_p(f))+bX_p(Y_p(g))-aY_p(X_p(f))-bY_p(X_p(g))\\=a[X,Y]_p(f)-b[X,Y]_p(g).$$

The bilinearity denotes

$$[aX + bY, Z] = a[X, Z] + b[Y, Z],\\ [X, aY + bZ] = a[X, Y] + b[X, Z],$$

for $a, b ∈ R,\quad X, Y, Z ∈ \mathfrak{X}(M)$.

This is true since $$[aX + bY, Z] f = (aX + bY)(Z f ) − Z (aX + bY) f\\ = aX(Z f ) + bY(Z f ) − Z(aX f + bY f )\\ = aX(Z f ) + bY(Z f ) − aZ(X f ) − bZ(Y f )\\ = a[X, Z] f + b[Y, Z] f.$$

From the antisymmetry it follows that the linearity in the first argument implies the linearity in the second argument.

### Jacobi identity¶

The following Jacobi identity holds true

$$[X, [Y, Z]] + [Y, [Z, X]] + [Z, [X, Y]] = 0.$$

Note that

$$([X, [Y, Z]] + [Y, [Z, X]] + [Z, [X, Y]]) f\\ = X([Y, Z] f ) − [Y, Z]X f + Y([Z, X] f ) − [Z, X]Y f + Z([X, Y] f ) − [X, Y]Z f\\ = X (Y(Z f )) − X(Z(Y f )) − Y (Z(X f )) + Z( Y(X f ))\\ +Y (Z(X f )) − Y(X(Z f )) − Z (X(Y f )) + X(Z(Y f ))\\ +Z( X(Y f )) − Z(Y(X f )) − X (Y(Z f )) + Y (X(Z f )) = 0.$$

### Lie bracket of vector fields multiplied by functions¶

For $X,Y\in\mathfrak{X}(M)$ and $f,g\in C^\infty(M)$ we have

$$[ f X, gY] = f g[X, Y] + f \cdot(Xg)Y − g\cdot(Y f )X.$$

To prove this equality let us observe that for $h \in C^\infty(M)$

$$[ f X, gY]h = f X(gYh) − gY( f Xh) = f \cdot(gX(Yh) + (Xg)Yh )− g\cdot (f Y(Xh) + (Y f )Xh)\\ = f g[X, Y]h + f \cdot(Xg)Yh − g\cdot(Y f )Xh.$$

### Lie bracket for the local basis vector fields¶

If $(U, φ)$ is a chart on $M$ with coordinates $x^1 , x^2 ,\ldots , x^n$ , then we have $$\Big[\frac{\partial}{\partial x^i},\frac{\partial}{\partial x^j}\Big]=0.$$

Recall that from definition (8.3) it follows $\quad \frac{\partial}{\partial x^i}f= [D_i(f\circ\phi^{-1})]\circ\phi.\quad$ Note that if we set $F=\{[D_j(f\circ\phi^{-1})]\circ \phi\}$, then $$\frac{\partial}{\partial x^i}\{[D_j(f\circ\phi^{-1})]\circ \phi\} =\frac{\partial}{\partial x^i}F=[D_i(F\circ\phi^{-1})]\circ\phi\\ =\{[D_i[D_j(f\circ\phi^{-1})]\circ\phi]\circ\phi^{-1}\}\circ\phi =D_i(D_j(f\circ\phi^{-1})\circ\phi).$$ Therefore $$\Big[\frac{\partial}{\partial x^i},\frac{\partial}{\partial x^j}\Big]f = \frac{\partial}{\partial x^i}\{[D_j(f\circ\phi^{-1})]\circ \phi\} -\frac{∂}{∂ x^j}\{[D_i ( f ◦ φ^{−1} )] ◦ φ\}\\ = \{{D_i D_j ( f ◦ φ^{−1} ) − D_j D_i ( f ◦ φ^{−1} )}\} ◦ φ = 0.$$

### Lie bracket in components¶

If $X,Y\in\mathfrak{X}(M)$ are expressed in local coordinates: $X=X^i\frac{\partial}{\partial x^i},\quad Y=Y^j\frac{\partial}{\partial x^j},\quad$ then $$[X,Y]=(XY^i-YX^i)\frac{\partial}{\partial x^i}.$$

The components of the Lie bracket $[X, Y]$ are obtained by applying the vector field $[X, Y]$ to the coordinates $x^i$ (cf. (8.5)), so

$$[X, Y]x^i = X(Yx^i ) − Y(Xx^i ) = XY^i − YX^i.$$

Therefore $\ [X, Y] = (XY^i − YX^i ) \frac{∂}{∂ x^i}.$

Example 12.2

Compute the Lie bracket for vector fields $$X=xy\frac{\partial}{\partial x} +\frac{1}{z}\frac{\partial}{\partial y} -3yz^3\frac{\partial}{\partial z},\quad Y=\frac{\partial}{\partial x}+(x+y)\frac{\partial}{\partial z}.$$

According to the general formula, the components of $[X,Y]$ are $$XY^1-YX^1=X(1)-Y(xy)=-\frac{\partial}{\partial x}(xy)=-y,$$ $$XY^2-YX^2=X(0)-Y(1/z)=-(x+y)\frac{\partial}{\partial z}(1/z)=\frac{x+y}{z^2},$$ $$XY^3-YX^3=X(x+y)-Y(-3yz^3)$$ $$= xy\frac{\partial}{\partial x}(x+y) +\frac{1}{z}\frac{\partial}{\partial y}(x+y) -3yz^3\frac{\partial}{\partial z}(x+y)$$ $$-[\frac{\partial}{\partial x}+(x+y)\frac{\partial}{\partial z}](-3yz^3) =xy+\frac{1}{z}+(x+y)(9yz^2).$$

Define the corresponding vector fields and their Lie bracket in SageMath.

In [10]:
R3 = Manifold(3, 'R^3')                            # manifold R3
c_cart.<x,y,z> = R3.chart()                        # Cart. coord
X = R3.vector_field(x*y, 1/z, -3*y*z^3, name='X')  # X v.field
Y = R3.vector_field(1, 0, x+y, name='Y')           # Y v.field
%display latex
v=X.bracket(Y)                                     # [X,Y]
v.display()

Out[10]:
$\displaystyle \left[X,Y\right] = -y \frac{\partial}{\partial x } + \left( \frac{x + y}{z^{2}} \right) \frac{\partial}{\partial y } + \left( \frac{9 \, {\left(x y + y^{2}\right)} z^{3} + x y z + 1}{z} \right) \frac{\partial}{\partial z }$

We can make some simplifications to all components using apply_map:

In [11]:
v.apply_map(expand)
v.display()

Out[11]:
$\displaystyle \left[X,Y\right] = -y \frac{\partial}{\partial x } + \left( \frac{x}{z^{2}} + \frac{y}{z^{2}} \right) \frac{\partial}{\partial y } + \left( 9 \, x y z^{2} + 9 \, y^{2} z^{2} + x y + \frac{1}{z} \right) \frac{\partial}{\partial z }$

The above hand-made computations can be replaced by:

In [12]:
Xx=R3.scalar_field(x*y,name='Xx')       # x-coordinate of X
Yx=R3.scalar_field(1,name='Yx')         # x-coordinate of Y
Xy=R3.scalar_field(1/z,name='Xy')       # y-coordinate of X
Yy=R3.scalar_field(0,name='Yy')         # y-coordinate of Y
Xz=R3.scalar_field(-3*y*z^3,name='Xz')  # z-coordinate of X
Yz=R3.scalar_field(x+y,name='Yx')       # z-coordinate of Y
# use the general formula to compute the coordinates of [X,Y]
[(X(Yx)-Y(Xx)).expr(),(X(Yy)-Y(Xy)).expr(),
(X(Yz)-Y(Xz)).expr().expand()]

Out[12]:
$\displaystyle \left[-y, \frac{x + y}{z^{2}}, 9 \, x y z^{2} + 9 \, y^{2} z^{2} + x y + \frac{1}{z}\right]$

To obtain the components of $[X,Y]$, one can also compute the values of Lie bracket $[X,Y]$ on coordinate functions $x,y,z$.

In [13]:
fx=R3.scalar_field(x,name='fx')        # fx(x,y,z)=x
fy=R3.scalar_field(y,name='fy')        # fy(x,y,z)=y
fz=R3.scalar_field(z,name='fz')        # fz(x,y,z)=z
[(X.bracket(Y))(fx).expr(),(X.bracket(Y))(fy).expr(),
(X.bracket(Y))(fz).expr().expand()]  # [X,Y] on fx,fy,fz

Out[13]:
$\displaystyle \left[-y, \frac{x + y}{z^{2}}, 9 \, x y z^{2} + 9 \, y^{2} z^{2} + x y + \frac{1}{z}\right]$

Example 12.3

Compute $[X,Y],\ [X,Z]$ and $\ [Y,Z]\$ for

$$X=(1+r^2)\sin(\theta)\frac{\partial}{\partial r} + \frac{1-r^2}{r}\cos(\theta) \frac{\partial}{\partial \theta}, \\ Y=-(1+r^2)\cos(\theta)\frac{\partial}{\partial r} + \frac{1-r^2}{r}\sin(\theta) \frac{\partial}{\partial \theta},\\ Z=\frac{\partial}{\partial \theta}.$$
In [14]:
R2 = Manifold(2, 'R^2')              # manifold R2
# polar coordinates:
c_pol.<r,th> = R2.chart(r'r:(0,+oo) th:(0,2*pi):\theta')
# vector fields X,Y,Z:
X=R2.vector_field((1+r^2)*sin(th),(1-r^2)/r*cos(th),name='X')
Y=R2.vector_field(-(1+r^2)*cos(th),(1-r^2)/r*sin(th),name='Y')
Z=R2.vector_field(0,1,name='Z')
v1=X.bracket(Y)                      # [X,Y]
v1.display()                         # show [X,Y]

Out[14]:
$\displaystyle \left[X,Y\right] = -4 \frac{\partial}{\partial {\theta} }$
In [15]:
v2=X.bracket(Z)                      # [X,Z]
v2.display()                         # show [X,Z]

Out[15]:
$\displaystyle \left[X,Z\right] = -{\left(r^{2} + 1\right)} \cos\left({\theta}\right) \frac{\partial}{\partial r } -\frac{{\left(r^{2} - 1\right)} \sin\left({\theta}\right)}{r} \frac{\partial}{\partial {\theta} }$
In [16]:
v3=Y.bracket(Z)                      # [Y,Z]
v3.display()                         # show [Y,Z]

Out[16]:
$\displaystyle \left[Y,Z\right] = -{\left(r^{2} + 1\right)} \sin\left({\theta}\right) \frac{\partial}{\partial r } + \frac{{\left(r^{2} - 1\right)} \cos\left({\theta}\right)}{r} \frac{\partial}{\partial {\theta} }$

Components of the last result can be also obtained by applying $[Y,Z]$ to coordinate functions $r,\theta$:

In [17]:
fr=R2.scalar_field(r,name='fr')      # fr(r,th)=r
# [Y,Z]r
v3(fr).display()                     # [Y,Z](fr)

Out[17]:
$\displaystyle \begin{array}{llcl} \left[Y,Z\right]\left(fr\right):& R^2 & \longrightarrow & \mathbb{R} \\ & \left(r, {\theta}\right) & \longmapsto & -{\left(r^{2} + 1\right)} \sin\left({\theta}\right) \end{array}$
In [18]:
fth=R2.scalar_field(th,name='fth')   # fth(r,th)=th
# [Y,Z] theta
v3(fth).display()                    # [Y,Z](fth)

Out[18]:
$\displaystyle \begin{array}{llcl} \left[Y,Z\right]\left(fth\right):& R^2 & \longrightarrow & \mathbb{R} \\ & \left(r, {\theta}\right) & \longmapsto & \frac{{\left(r^{2} - 1\right)} \cos\left({\theta}\right)}{r} \end{array}$

## What's next?¶

Take a look at the notebook Tensor fields.