{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 12. Vector fields - continuation\n",
"\n",
"This notebook is part of the [Introduction to manifolds in SageMath](https://sagemanifolds.obspm.fr/intro_to_manifolds.html) by Andrzej Chrzeszczyk (Jan Kochanowski University of Kielce, Poland)."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'SageMath version 9.6, Release Date: 2022-05-15'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"version()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Vector fields defined in the intersection of two coordinate neighborhoods\n",
"\n",
"
\n",
"\n",
"The vector field which is defined in the intersection of two coordinate neighborhoods, can be expressed using two different charts and two different frames.\n",
"\n",
"
\n",
"\n",
"**Example 12.1**\n",
"\n",
"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."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"R2 = Manifold(2, 'R^2') # manifold R2\n",
"c_cart. = R2.chart() # Cartesian coordinates on R2\n",
"c_pol. = R2.chart(r'r:(0,+oo) ph:(0,2*pi):\\phi') # polar coord.\n",
"# U is an open subset of R2, such that, the transition from Cart.to pol. \n",
"# coord. and from polar to Cartesian coord. are smooth and bijective\n",
"U = R2.open_subset('U',coord_def={c_cart:(y!=0,x<0),c_pol:(ph!=0)});\n",
"cart_to_pol = c_cart.transition_map(c_pol, # Cart. --> polar\n",
" [sqrt(x^2 + y^2),arctan2(y, x) ]) # transition \n",
"pol_to_cart = c_pol.transition_map(c_cart, # polar --> Cart.\n",
" [r*cos(ph), r*sin(ph)]) # transition\n",
"v = R2.vector_field(2*x*y, (1-x^2+y^2), name='v') # vector field v"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Display vector field $v$ in default chart and default frame:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle v = 2 \\, x y \\frac{\\partial}{\\partial x } + \\left( -x^{2} + y^{2} + 1 \\right) \\frac{\\partial}{\\partial y }\\)"
],
"text/latex": [
"$\\displaystyle v = 2 \\, x y \\frac{\\partial}{\\partial x } + \\left( -x^{2} + y^{2} + 1 \\right) \\frac{\\partial}{\\partial y }$"
],
"text/plain": [
"v = 2*x*y ∂/∂x + (-x^2 + y^2 + 1) ∂/∂y"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%display latex # display v in default chart \n",
"v.display() # and frame"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Display $v$ in polar frame, Cartesian chart:"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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} }\\)"
],
"text/latex": [
"$\\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} }$"
],
"text/plain": [
"v = (y^3 + (x^2 + 1)*y)/sqrt(x^2 + y^2) ∂/∂r - (x^3 + x*y^2 - x)/(x^2 + y^2) ∂/∂ph"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v.display(c_pol.frame()) # v in polar frame, Cart.chart"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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} }\\)"
],
"text/latex": [
"$\\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} }$"
],
"text/plain": [
"v = (x^2 + y^2 + 1)*y/sqrt(x^2 + y^2) ∂/∂r - (x^2 + y^2 - 1)*x/(x^2 + y^2) ∂/∂ph"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# the same with factored components\n",
"v.apply_map(factor,frame=c_pol.frame()) # apply factor to comp.\n",
"v.display(c_pol.frame())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can also display components separately:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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}\\)"
],
"text/latex": [
"$\\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}$"
],
"text/plain": [
"v^r = (x^2 + y^2 + 1)*y/sqrt(x^2 + y^2) \n",
"v^ph = -(x^2 + y^2 - 1)*x/(x^2 + y^2) "
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v.display_comp(c_pol.frame()) # display components "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now use the polar basis and polar coordinates:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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} }\\)"
],
"text/latex": [
"$\\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} }$"
],
"text/plain": [
"v = (r^2*sin(ph) + sin(ph)) ∂/∂r - (r^2*cos(ph) - cos(ph))/r ∂/∂ph"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
" v.display(c_pol.frame(),c_pol) # pol.chart, pol.frame"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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} }\\)"
],
"text/latex": [
"$\\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} }$"
],
"text/plain": [
"v = (r^2 + 1)*sin(ph) ∂/∂r - (r + 1)*(r - 1)*cos(ph)/r ∂/∂ph"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# the same with factored components\n",
"v.apply_map(factor,frame=c_pol.frame(),chart=c_pol) \n",
"v.display(c_pol.frame(),c_pol) # factor comp."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Polar components, separately:"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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}\\)"
],
"text/latex": [
"$\\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}$"
],
"text/plain": [
"v^r = (r^2 + 1)*sin(ph) \n",
"v^ph = -(r + 1)*(r - 1)*cos(ph)/r "
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v.display_comp(c_pol.frame(),c_pol) # display comp."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"### Module $\\mathfrak{X}(M)$\n",
"\n",
"
\n",
"\n",
"Let $\\mathfrak{X}(M)$ be the set of all **smooth vector fields** on a smooth manifold $M$. \n",
"\n",
"The set $\\mathfrak{X}(M)$ is a module (over $C^\\infty(M)\\ $) if we define the operations\n",
"\n",
"$$(X+Y)_p=X_p+Y_p,\\\\\n",
"(fX)_p=f(p)X_p,\n",
"$$\n",
"\n",
"for $X,Y\\in \\mathfrak{X}(M),\\ \\ f\\in C^\\infty(M).$\n",
"\n",
"One can check that the just defined operations have the properties\n",
"\n",
"$$(aX+bY)f=aXf+bYf,\\\\\n",
"(gX)f=g(Xf),\n",
"$$\n",
"\n",
"for $X,Y\\in \\mathfrak{X}(M),\\ \\ a,b\\in R.\\ \\ f,g\\in C^\\infty(M).$\n",
"\n",
"
\n",
"\n",
"### Lie bracket\n",
"\n",
"
\n",
"\n",
"For $X,Y\\in \\mathfrak{X}(M)$ the **Lie bracket** is defined by\n",
"\n",
"$$[X,Y]f=X(Yf)-Y(Xf),\\quad\\mbox{for}\\quad f\\in C^\\infty(M).$$\n",
"\n",
"From this definition it follows that $$[X,Y]=-[Y,X].$$\n",
"\n",
"One can also prove that $[X,Y]\\in\\mathfrak{X}(M)$ and the Lie bracket is bilinear.\n",
"\n",
"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.\n",
"For that purpose let us note that for $\\ f,g\\in C^\\infty(M),\\ p\\in M$\n",
"\n",
"$$[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))\\\\\n",
"=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))\\\\\n",
"=f(p)[X,Y]_p(g)+g(p)[X,Y]_p(f),\n",
"$$\n",
"\n",
"and for $a,b\\in R$\n",
"\n",
"$$\n",
"[X,Y]_p(af+bg)=X_p(Y_p(af+bg))-Y_p(X_p(af+bg))\\\\\n",
"=X_p(aY_p(f)+bY_p(g))-Y_p(aX_p(f)+bX_p(g))\\\\\n",
"=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).\n",
"$$\n",
"\n",
"\n",
"The bilinearity denotes\n",
"\n",
"$$[aX + bY, Z] = a[X, Z] + b[Y, Z],\\\\\n",
"[X, aY + bZ] = a[X, Y] + b[X, Z],\n",
"$$\n",
"\n",
"for $a, b ∈ R,\\quad X, Y, Z ∈ \\mathfrak{X}(M)$.
\n",
"\n",
"This is true since\n",
"$$\n",
"[aX + bY, Z] f = (aX + bY)(Z f ) − Z (aX + bY) f\\\\\n",
"= aX(Z f ) + bY(Z f ) − Z(aX f + bY f )\\\\\n",
"= aX(Z f ) + bY(Z f ) − aZ(X f ) − bZ(Y f )\\\\\n",
"= a[X, Z] f + b[Y, Z] f.\n",
"$$\n",
"\n",
"From the antisymmetry it follows that the linearity in the first argument implies the linearity in the second argument.\n",
"\n",
"
\n",
"\n",
"### Jacobi identity\n",
"\n",
"
\n",
"\n",
"\n",
"The following **Jacobi identity**\n",
"holds true
\n",
"\n",
"$$[X, [Y, Z]] + [Y, [Z, X]] + [Z, [X, Y]] = 0.$$\n",
"\n",
"Note that\n",
"\n",
"$$\n",
"([X, [Y, Z]] + [Y, [Z, X]] + [Z, [X, Y]]) f\\\\\n",
"= X([Y, Z] f ) − [Y, Z]X f + Y([Z, X] f ) − [Z, X]Y f + Z([X, Y] f ) − [X, Y]Z f\\\\\n",
"= X (Y(Z f )) − X(Z(Y f )) − Y (Z(X f )) + Z( Y(X f ))\\\\\n",
"+Y (Z(X f )) − Y(X(Z f )) − Z (X(Y f )) + X(Z(Y f ))\\\\\n",
"+Z( X(Y f )) − Z(Y(X f )) − X (Y(Z f )) + Y (X(Z f ))\n",
"= 0.\n",
"$$\n",
"\n",
"
\n",
"\n",
"### Lie bracket of vector fields multiplied by functions\n",
"\n",
"
\n",
"\n",
"For $X,Y\\in\\mathfrak{X}(M)$ and $f,g\\in C^\\infty(M)$ we have
\n",
"\n",
"$$[ f X, gY] = f g[X, Y] + f \\cdot(Xg)Y − g\\cdot(Y f )X.$$\n",
"\n",
"To prove this equality let us observe that for $h \\in C^\\infty(M)$\n",
"\n",
"$$\n",
"[ f X, gY]h = f X(gYh) − gY( f Xh)\n",
"= f \\cdot(gX(Yh) + (Xg)Yh )− g\\cdot (f Y(Xh) + (Y f )Xh)\\\\\n",
"= f g[X, Y]h + f \\cdot(Xg)Yh − g\\cdot(Y f )Xh.\n",
"$$\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"### Lie bracket for the local basis vector fields\n",
"\n",
"
\n",
"\n",
"If $(U, φ)$ is a chart on $M$ with coordinates $x^1 , x^2 ,\\ldots , x^n$ , then we have\n",
"$$\\Big[\\frac{\\partial}{\\partial x^i},\\frac{\\partial}{\\partial x^j}\\Big]=0.$$\n",
"\n",
"Recall that from definition (8.3) it follows\n",
"$\\quad \\frac{\\partial}{\\partial x^i}f=\n",
"[D_i(f\\circ\\phi^{-1})]\\circ\\phi.\\quad$\n",
"Note that if we set $F=\\{[D_j(f\\circ\\phi^{-1})]\\circ \\phi\\}$, then\n",
"$$\n",
"\\frac{\\partial}{\\partial x^i}\\{[D_j(f\\circ\\phi^{-1})]\\circ \\phi\\}\n",
"=\\frac{\\partial}{\\partial x^i}F=[D_i(F\\circ\\phi^{-1})]\\circ\\phi\\\\\n",
"=\\{[D_i[D_j(f\\circ\\phi^{-1})]\\circ\\phi]\\circ\\phi^{-1}\\}\\circ\\phi\n",
"=D_i(D_j(f\\circ\\phi^{-1})\\circ\\phi).\n",
"$$\n",
"Therefore\n",
"$$\\Big[\\frac{\\partial}{\\partial x^i},\\frac{\\partial}{\\partial x^j}\\Big]f =\n",
"\\frac{\\partial}{\\partial x^i}\\{[D_j(f\\circ\\phi^{-1})]\\circ \\phi\\}\n",
"-\\frac{∂}{∂ x^j}\\{[D_i ( f ◦ φ^{−1} )] ◦ φ\\}\\\\\n",
"= \\{{D_i D_j ( f ◦ φ^{−1} ) − D_j D_i ( f ◦ φ^{−1} )}\\} ◦ φ\n",
"= 0.$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"### Lie bracket in components\n",
"\n",
"
\n",
"\n",
"If $X,Y\\in\\mathfrak{X}(M)$ are expressed in local coordinates:\n",
"$X=X^i\\frac{\\partial}{\\partial x^i},\\quad Y=Y^j\\frac{\\partial}{\\partial x^j},\\quad$ then\n",
"$$[X,Y]=(XY^i-YX^i)\\frac{\\partial}{\\partial x^i}.$$\n",
"\n",
"The components of the Lie bracket $[X, Y]$\n",
"are obtained by applying the vector field $[X, Y]$ to the coordinates $x^i$ (cf. (8.5)), so\n",
"\n",
"$$[X, Y]x^i = X(Yx^i ) − Y(Xx^i ) = XY^i − YX^i.$$\n",
"\n",
"Therefore $\\ [X, Y] = (XY^i − YX^i ) \\frac{∂}{∂ x^i}.$\n",
"\n",
"
\n",
"\n",
"**Example 12.2**\n",
"\n",
"Compute the Lie bracket for vector fields\n",
"$$X=xy\\frac{\\partial}{\\partial x}\n",
"+\\frac{1}{z}\\frac{\\partial}{\\partial y}\n",
"-3yz^3\\frac{\\partial}{\\partial z},\\quad\n",
"Y=\\frac{\\partial}{\\partial x}+(x+y)\\frac{\\partial}{\\partial z}.$$\n",
"\n",
"
\n",
"\n",
"According to the general formula, the components of $[X,Y]$ are\n",
"$$XY^1-YX^1=X(1)-Y(xy)=-\\frac{\\partial}{\\partial x}(xy)=-y,$$\n",
"$$XY^2-YX^2=X(0)-Y(1/z)=-(x+y)\\frac{\\partial}{\\partial z}(1/z)=\\frac{x+y}{z^2},$$\n",
"$$XY^3-YX^3=X(x+y)-Y(-3yz^3)$$\n",
"$$=\n",
"xy\\frac{\\partial}{\\partial x}(x+y)\n",
"+\\frac{1}{z}\\frac{\\partial}{\\partial y}(x+y)\n",
"-3yz^3\\frac{\\partial}{\\partial z}(x+y)$$\n",
"$$-[\\frac{\\partial}{\\partial x}+(x+y)\\frac{\\partial}{\\partial z}](-3yz^3)\n",
"=xy+\\frac{1}{z}+(x+y)(9yz^2).$$\n",
"\n",
"Define the corresponding vector fields and their Lie bracket in SageMath."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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 }\\)"
],
"text/latex": [
"$\\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 }$"
],
"text/plain": [
"[X,Y] = -y ∂/∂x + (x + y)/z^2 ∂/∂y + (9*(x*y + y^2)*z^3 + x*y*z + 1)/z ∂/∂z"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"R3 = Manifold(3, 'R^3') # manifold R3\n",
"c_cart. = R3.chart() # Cart. coord\n",
"X = R3.vector_field(x*y, 1/z, -3*y*z^3, name='X') # X v.field\n",
"Y = R3.vector_field(1, 0, x+y, name='Y') # Y v.field\n",
"%display latex \n",
"v=X.bracket(Y) # [X,Y]\n",
"v.display()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We can make some simplifications to all components using `apply_map`:"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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 }\\)"
],
"text/latex": [
"$\\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 }$"
],
"text/plain": [
"[X,Y] = -y ∂/∂x + (x/z^2 + y/z^2) ∂/∂y + (9*x*y*z^2 + 9*y^2*z^2 + x*y + 1/z) ∂/∂z"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v.apply_map(expand)\n",
"v.display()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The above hand-made computations can be replaced by:"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\left[-y, \\frac{x + y}{z^{2}}, 9 \\, x y z^{2} + 9 \\, y^{2} z^{2} + x y + \\frac{1}{z}\\right]\\)"
],
"text/latex": [
"$\\displaystyle \\left[-y, \\frac{x + y}{z^{2}}, 9 \\, x y z^{2} + 9 \\, y^{2} z^{2} + x y + \\frac{1}{z}\\right]$"
],
"text/plain": [
"[-y, (x + y)/z^2, 9*x*y*z^2 + 9*y^2*z^2 + x*y + 1/z]"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Xx=R3.scalar_field(x*y,name='Xx') # x-coordinate of X\n",
"Yx=R3.scalar_field(1,name='Yx') # x-coordinate of Y\n",
"Xy=R3.scalar_field(1/z,name='Xy') # y-coordinate of X\n",
"Yy=R3.scalar_field(0,name='Yy') # y-coordinate of Y\n",
"Xz=R3.scalar_field(-3*y*z^3,name='Xz') # z-coordinate of X\n",
"Yz=R3.scalar_field(x+y,name='Yx') # z-coordinate of Y\n",
"# use the general formula to compute the coordinates of [X,Y]\n",
"[(X(Yx)-Y(Xx)).expr(),(X(Yy)-Y(Xy)).expr(),\n",
" (X(Yz)-Y(Xz)).expr().expand()]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To obtain the components of $[X,Y]$,\n",
"one can also compute the values of Lie bracket $[X,Y]$ on coordinate functions $x,y,z$."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\left[-y, \\frac{x + y}{z^{2}}, 9 \\, x y z^{2} + 9 \\, y^{2} z^{2} + x y + \\frac{1}{z}\\right]\\)"
],
"text/latex": [
"$\\displaystyle \\left[-y, \\frac{x + y}{z^{2}}, 9 \\, x y z^{2} + 9 \\, y^{2} z^{2} + x y + \\frac{1}{z}\\right]$"
],
"text/plain": [
"[-y, (x + y)/z^2, 9*x*y*z^2 + 9*y^2*z^2 + x*y + 1/z]"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fx=R3.scalar_field(x,name='fx') # fx(x,y,z)=x\n",
"fy=R3.scalar_field(y,name='fy') # fy(x,y,z)=y\n",
"fz=R3.scalar_field(z,name='fz') # fz(x,y,z)=z\n",
"[(X.bracket(Y))(fx).expr(),(X.bracket(Y))(fy).expr(),\n",
" (X.bracket(Y))(fz).expr().expand()] # [X,Y] on fx,fy,fz"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 12.3**\n",
"\n",
"Compute $[X,Y],\\ [X,Z]$ and $\\ [Y,Z]\\ $ for\n",
"\n",
"$$X=(1+r^2)\\sin(\\theta)\\frac{\\partial}{\\partial r} + \\frac{1-r^2}{r}\\cos(\\theta) \\frac{\\partial}{\\partial \\theta}, \\\\\n",
"Y=-(1+r^2)\\cos(\\theta)\\frac{\\partial}{\\partial r} + \\frac{1-r^2}{r}\\sin(\\theta) \n",
"\\frac{\\partial}{\\partial \\theta},\\\\\n",
"Z=\\frac{\\partial}{\\partial \\theta}.\n",
"$$"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\left[X,Y\\right] = -4 \\frac{\\partial}{\\partial {\\theta} }\\)"
],
"text/latex": [
"$\\displaystyle \\left[X,Y\\right] = -4 \\frac{\\partial}{\\partial {\\theta} }$"
],
"text/plain": [
"[X,Y] = -4 ∂/∂th"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"R2 = Manifold(2, 'R^2') # manifold R2\n",
" # polar coordinates:\n",
"c_pol. = R2.chart(r'r:(0,+oo) th:(0,2*pi):\\theta')\n",
" # vector fields X,Y,Z:\n",
"X=R2.vector_field((1+r^2)*sin(th),(1-r^2)/r*cos(th),name='X')\n",
"Y=R2.vector_field(-(1+r^2)*cos(th),(1-r^2)/r*sin(th),name='Y')\n",
"Z=R2.vector_field(0,1,name='Z')\n",
"v1=X.bracket(Y) # [X,Y]\n",
"v1.display() # show [X,Y]"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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} }\\)"
],
"text/latex": [
"$\\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} }$"
],
"text/plain": [
"[X,Z] = -(r^2 + 1)*cos(th) ∂/∂r - (r^2 - 1)*sin(th)/r ∂/∂th"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v2=X.bracket(Z) # [X,Z]\n",
"v2.display() # show [X,Z]"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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} }\\)"
],
"text/latex": [
"$\\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} }$"
],
"text/plain": [
"[Y,Z] = -(r^2 + 1)*sin(th) ∂/∂r + (r^2 - 1)*cos(th)/r ∂/∂th"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v3=Y.bracket(Z) # [Y,Z]\n",
"v3.display() # show [Y,Z]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Components of the last result can be also obtained by applying $[Y,Z]$ to coordinate functions $r,\\theta$:"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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}\\)"
],
"text/latex": [
"$\\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}$"
],
"text/plain": [
"[Y,Z](fr): R^2 → ℝ\n",
" (r, th) ↦ -(r^2 + 1)*sin(th)"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fr=R2.scalar_field(r,name='fr') # fr(r,th)=r\n",
"# [Y,Z]r\n",
"v3(fr).display() # [Y,Z](fr)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\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}\\)"
],
"text/latex": [
"$\\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}$"
],
"text/plain": [
"[Y,Z](fth): R^2 → ℝ\n",
" (r, th) ↦ (r^2 - 1)*cos(th)/r"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fth=R2.scalar_field(th,name='fth') # fth(r,th)=th\n",
"# [Y,Z] theta\n",
"v3(fth).display() # [Y,Z](fth)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## What's next?\n",
"\n",
"Take a look at the notebook [Tensor fields](https://nbviewer.org/github/sagemanifolds/IntroToManifolds/blob/main/13Manifold_TensorFields.ipynb)."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "SageMath 9.6",
"language": "sage",
"name": "sagemath"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 4
}