{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# 13. Tensor fields\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": [
"### Linear differential forms (1- forms, covector fields) on a manifold\n",
"\n",
"
\n",
"\n",
"Let $M$ be a smooth manifold.\n",
"A **linear differential form or 1-form or covector field** $α$ on $M$ is a map that assigns to each $p ∈ M$ an element\n",
"$α( p) ∈ T_p^∗M$ (the space $T_p^∗M$ was defined in [notebook 9](https://nbviewer.org/github/sagemanifolds/IntroToManifolds/blob/main/09Manifold_LinearFormsTensors_onTp.ipynb)) . The 1-form $α( p)$ will also be denoted by $α_p$, it is \n",
"smooth (of class $C^∞$ ) if for all $X ∈ \\mathfrak{X}(M)$ the function $α(X)$ defined by\\begin{equation}\n",
"(α(X))( p) = α_p (X_p ),\\quad\\text{for }\\ p\\in M\n",
"\\label{}\\tag{13.1}\n",
"\\end{equation}\n",
"is smooth (of class $C^∞$ ).\n",
"\n",
"The set of all smooth 1-forms on $M$ is denoted by $\\Omega^1 (M)$. The\n",
"set $\\Omega^1(M)$ is a **module over** $C^∞ (M)$ with the algebraic operations given by\n",
"\\begin{equation}\n",
"\\begin{matrix}\n",
"(α + β)_p ≡ α_p + β_p ,\\\\\n",
"( f α)_p ≡ f ( p)α_p ,\n",
"\\end{matrix}\n",
"\\label{}\\tag{13.2}\n",
"\\end{equation}\n",
"for $α, β ∈ \\Omega^1 (M)$ and $f ∈ C^∞ (M).$\n",
"\n",
"
\n",
"\n",
"**Example 13.1**"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let us define a 1-form on a 3-dimensional manifold."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\mbox{1-form on the 3-dimensional differentiable manifold M}\\)"
],
"text/latex": [
"$\\displaystyle \\mbox{1-form on the 3-dimensional differentiable manifold M}$"
],
"text/plain": [
"1-form on the 3-dimensional differentiable manifold M"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%display latex\n",
"N = 3 # dimension of manifold M\n",
"M = Manifold(N, 'M') # manifold M\n",
"a = M.diff_form(1) # 1-form on M\n",
"a # print information on a"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\Omega^{1}\\left(M\\right)\\)"
],
"text/latex": [
"$\\displaystyle \\Omega^{1}\\left(M\\right)$"
],
"text/plain": [
"Module Omega^1(M) of 1-forms on the 3-dimensional differentiable manifold M"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# mathematical object of which \"a\" is an element.\n",
"a.parent()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"### Differential of scalar functions\n",
"\n",
"
\n",
"\n",
"If $f ∈ C^∞ (M)$, the **differential**\n",
"of $f$ denoted by $d f$ is given by $$d f ( p) = d f_p,\\quad\\text{for}\\ p\\in M,$$ where $df_p$ is the differential at point defined in (9.1).\n",
"The differential $df$ belongs to $\\Omega^1(M).$ If $X ∈ \\mathfrak{X}(M),$\n",
"then from (13.1),(11.1),(9.1) it follows that\n",
"\n",
"$$(df(X))(p)=df_p(X_p)=X_p(f)=(Xf)(p),$$\n",
"for $p ∈ M$ i.e.,\n",
"\\begin{equation}\n",
"df(X)=X(f).\n",
"\\label{}\\tag{13.3}\n",
"\\end{equation}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.2**\n",
"\n",
"Define a scalar function $f$ and its differential $df$. The differential is an example of 1-form."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\mbox{1-form on the 3-dimensional differentiable manifold M}\\)"
],
"text/latex": [
"$\\displaystyle \\mbox{1-form on the 3-dimensional differentiable manifold M}$"
],
"text/plain": [
"1-form on the 3-dimensional differentiable manifold M"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# continuation\n",
"f = M.scalar_field()\n",
"f.differential()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"### The differential of function is a derivation\n",
"\n",
"
\n",
"\n",
"The map $d : C^∞ (M) →\\Omega^1 (M)$, which sends $f$ into $df$, satisfies\n",
"\\begin{equation}\n",
"\\begin{matrix}\n",
"d(a f + bg) = ad f + bdg,\\\\\n",
"d( f g) = f dg + gd f,\n",
"\\end{matrix}\n",
"\\label{}\\tag{13.4}\n",
"\\end{equation}\n",
"for $f, g ∈ C^∞ (M)$ and $a, b ∈ R.$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To check the first equality note, that for $X\\in \\mathfrak{X}(M)$\n",
"\n",
"$$\n",
"d(a f + bg)(X) = X(a f + bg) = aX f + bXg\n",
"= a\\,d f (X) + b\\,dg(X) = (a\\,d f + b\\,dg)(X).\n",
"$$\n",
"\n",
"The second one follows from\n",
"\n",
"$$\n",
"d( f g)(X) = X( f g) = f Xg + gX f\n",
"= f dg(X) + gd f (X) = ( f dg + gd f )(X).\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"### Differentials of coordinate functions form local bases for $\\Omega^1(M)$\n",
"\n",
"
\n",
"\n",
"If $(U, φ)$ is a chart on $M$, then as we have checked in [notebook 9](https://nbviewer.org/github/sagemanifolds/IntroToManifolds/blob/main/09Manifold_LinearFormsTensors_onTp.ipynb),\n",
"the differentials of the\n",
"coordinate functions $x^1 , x^2 , . . . , x^n$ computed at $p\\in U$\n",
"form the basis of $T_p^*M$.
\n",
"The formula (9.1') implies that on $U$ we have\n",
"$$\n",
"dx^i(X)=X(x^i).\n",
"$$\n",
"\n",
"Since from (8.5) we have on $U$: $X=X(x^i)\\frac{\\partial}{\\partial x^i},$ the covector field $dx^i$ assigns to the vector field $X$ its $i$-th component function $X(x^i)$ in the frame $\\{\\frac{\\partial}{\\partial x^j}\\}_{j=1}^n$.
\n",
"If $α\\in\\Omega^1(M)$, using (9.2), we obtain for $p\\in M$\n",
"and $α(p) ∈ T_p^∗ (M)$ \n",
"\n",
"$$\\alpha(p)=\\alpha(p)\\big(\\frac{\\partial}{\\partial x^i}\\Big|_p\\big)dx^i_p=\\Big[\\alpha\\big(\\frac{\\partial}{\\partial x^i}\\big) dx^i\\Big](p).$$\n",
"\n",
"Thus\n",
"\n",
"\\begin{equation}\n",
"\\alpha=\\alpha\\big(\\frac{\\partial}{\\partial x^i}\\big) dx^i.\n",
"\\label{}\\tag{13.5}\n",
"\\end{equation}\n",
"\n",
"If we denote $\\alpha\\big(\\frac{\\partial}{\\partial x^i}\\big)$ by $\\alpha_i$ then in local coordinates every element of $\\Omega^1(M)$ is of the form\n",
"\n",
"$$\\alpha_idx^i.$$\n",
"\n",
"**Remark**. Let us underscore that the last expressions holds only locally (in the domain of a local chart).\n",
"\n",
"
\n",
"\n",
"### Coframe\n",
"\n",
"
\n",
"\n",
"Recall that in [notebook 11](https://nbviewer.org/github/sagemanifolds/IntroToManifolds/blob/main/11Manifold_Vect_Fields.ipynb) we defined frames.\n",
"\n",
"
\n",
"\n",
"If $U$ is an open subset of a manifold $M$ (for example a coordinate neighborhood) then the **coframe** on $U$ is the sequence $e$ of covector fields on $U$ such that for each $p∈U, \\ e(p)$ is a basis of the cotangent space $T^*_pU$.
\n",
"From (13.5) it follows that the covectors $\\ dx^1,\\ldots,dx^n\\ $ define a coframe on the coordinate neighborhood $U.\\ $ Let us recall that the linear independence of $\\ dx^1_p,\\ldots,dx^n_p\\ $ for every $p\\in U$ was\n",
"checked in [notebook 9](https://nbviewer.org/github/sagemanifolds/IntroToManifolds/blob/main/09Manifold_LinearFormsTensors_onTp.ipynb) (cf. the argument before the formula (9.2)).\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\left(M,({x^{0}}, {x^{1}}, {x^{2}})\\right)\\)"
],
"text/latex": [
"$\\displaystyle \\left(M,({x^{0}}, {x^{1}}, {x^{2}})\\right)$"
],
"text/plain": [
"Chart (M, (x0, x1, x2))"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N = 3\n",
"M = Manifold(N, 'M') # manifold M\n",
"X = M.chart(' '.join(['x'+str(i)+':x^{'+str(i)+'}' for i in range(N)])) # chart on M\n",
"X"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\left(\\mathrm{d} {x^{0}}, \\mathrm{d} {x^{1}}, \\mathrm{d} {x^{2}}\\right)\\)"
],
"text/latex": [
"$\\displaystyle \\left(\\mathrm{d} {x^{0}}, \\mathrm{d} {x^{1}}, \\mathrm{d} {x^{2}}\\right)$"
],
"text/plain": [
"(1-form dx0 on the 3-dimensional differentiable manifold M,\n",
" 1-form dx1 on the 3-dimensional differentiable manifold M,\n",
" 1-form dx2 on the 3-dimensional differentiable manifold M)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X.coframe()[:]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n",
"Using the local representation we can give concrete examples of 1-forms/covector fields.\n",
"\n",
"
\n",
"\n",
"**Example 13.3**\n",
"\n",
"Define 1-form $\\ a=a_0dx^0+a_1dx^1+a_2dx^2\\ $ in SageMath."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle a = a_{0}\\left({x^{0}}, {x^{1}}, {x^{2}}\\right) \\mathrm{d} {x^{0}} + a_{1}\\left({x^{0}}, {x^{1}}, {x^{2}}\\right) \\mathrm{d} {x^{1}} + a_{2}\\left({x^{0}}, {x^{1}}, {x^{2}}\\right) \\mathrm{d} {x^{2}}\\)"
],
"text/latex": [
"$\\displaystyle a = a_{0}\\left({x^{0}}, {x^{1}}, {x^{2}}\\right) \\mathrm{d} {x^{0}} + a_{1}\\left({x^{0}}, {x^{1}}, {x^{2}}\\right) \\mathrm{d} {x^{1}} + a_{2}\\left({x^{0}}, {x^{1}}, {x^{2}}\\right) \\mathrm{d} {x^{2}}$"
],
"text/plain": [
"a = a0(x0, x1, x2) dx0 + a1(x0, x1, x2) dx1 + a2(x0, x1, x2) dx2"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"%display latex\n",
"N = 3 # dimension of manifold M\n",
"M = Manifold(N, 'M') # manifold M\n",
"X = M.chart(' '.join(['x'+str(i)+':x^{'+str(i)+'}' for i in range(N)])) # chart on M\n",
"a = M.diff_form(1,name='a') # 1-form a\n",
"ast = ['a'+str(j) for j in range(N)] # list of component names \n",
"af = [M.scalar_field(function(ast[j])(*X), name=ast[j]) \n",
" for j in range(N)] # list of component functions\n",
"a[:] = af # define all components of a\n",
"a.disp() # show a"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Function arguments can be omitted:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle a = a_{0} \\mathrm{d} {x^{0}} + a_{1} \\mathrm{d} {x^{1}} + a_{2} \\mathrm{d} {x^{2}}\\)"
],
"text/latex": [
"$\\displaystyle a = a_{0} \\mathrm{d} {x^{0}} + a_{1} \\mathrm{d} {x^{1}} + a_{2} \\mathrm{d} {x^{2}}$"
],
"text/plain": [
"a = a0 dx0 + a1 dx1 + a2 dx2"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Manifold.options.omit_function_arguments=True\n",
"a.disp() # show abbreviated a"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.4**\n",
"\n",
"Now use the local coordinates to show the differential of a scalar function."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1-form df on the 3-dimensional differentiable manifold M\n"
]
},
{
"data": {
"text/html": [
"\\(\\displaystyle \\mathrm{d}f = \\frac{\\partial\\,f}{\\partial {x^{0}}} \\mathrm{d} {x^{0}} + \\frac{\\partial\\,f}{\\partial {x^{1}}} \\mathrm{d} {x^{1}} + \\frac{\\partial\\,f}{\\partial {x^{2}}} \\mathrm{d} {x^{2}}\\)"
],
"text/latex": [
"$\\displaystyle \\mathrm{d}f = \\frac{\\partial\\,f}{\\partial {x^{0}}} \\mathrm{d} {x^{0}} + \\frac{\\partial\\,f}{\\partial {x^{1}}} \\mathrm{d} {x^{1}} + \\frac{\\partial\\,f}{\\partial {x^{2}}} \\mathrm{d} {x^{2}}$"
],
"text/plain": [
"df = d(f)/dx0 dx0 + d(f)/dx1 dx1 + d(f)/dx2 dx2"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# continuation # scalar function f:\n",
"f = M.scalar_field(function('f')(*X), name='f')\n",
"df = f.differential() # differential of f\n",
"print(df) # show information on df\n",
"df.disp() # show df"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To explain the last formula let us note that by (13.5)\n",
"$\\ d f = d f (\\frac{∂}{∂ x^i} )dx^i,\\ $ but, by virtue of (13.3), \n",
"$\\ d f (\\frac{\\partial}{\\partial x^i})= \\frac{∂}{∂ x^i} f,\\ $\n",
"so that\n",
"\\begin{equation}\n",
"d f = \\frac{\\partial f}{\\partial x^i}dx^i.\n",
"\\label{}\\tag{13.6}\n",
"\\end{equation}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Tensor fields\n",
"\n",
"
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Tensor fields of type $\\mathbf{(0,k)}$ (covariant tensor fields)\n",
"\n",
"
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A **tensor field $t$ of type $(0,k)$** or a **covariant tensor field of rank $k$** on a manifold $M$ is a map $t$ that associates with\n",
"each point $p∈M$ a tensor $t(p)=t_p\\in T^{(0,k)}_pM\\ \\ \\ $ ($T^{(0,k)}_pM$ was defined in [notebook 9](09Manifold_LinearFormsTensors_onTp.ipynb)). \n",
"
\n",
"If $t$\n",
"is a tensor field of type $(0, k)$ and $X_1 , . . . , X_k$ are vector fields on $M$, then $t (X_1 , . . . , X_k)$ is the real-valued function given by \n",
"\n",
"$$[t (X_1 , . . . , X _k )]( p) = t_p (X_1 ( p), . . . , X_k ( p)).$$\n",
"\n",
"We say that $t$ is smooth if $t (X_1 , . . . , X_k )$ is a smooth function for all\n",
"$X_1 , . . . , X_k ∈ \\mathfrak{X}(M)$.
\n",
"One can prove that if $x^1,\\ldots,x^n$ are local coordinates on $U$ and \n",
"$t_{i_1\\ldots i_k}=t(\\frac{\\partial}{\\partial x^{i_1}},\\ldots,\\frac{\\partial}{\\partial x^{i_k}})$, then $t$ is smooth iff for arbitrary $p\\in M$ there is a coordinate map \n",
"$(U,(x^1,\\ldots,x^n))$ around $p$ such that the real functions $t_{i_1\\ldots i_k}$ are smooth. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The operations of tensor addition, scalar multiplication and tensor product are defined pointwise:\n",
"\n",
"$$\n",
"\\begin{matrix}\n",
"(at + bs)_p = at_p + bs_p,\\\\\n",
"( f t)_p = f ( p)t_p,\\\\\n",
"(t ⊗ s)_p = t_p ⊗ s_p,\n",
"\\end{matrix}\n",
"$$\n",
"\n",
"for $a, b ∈ R\\ $, $s, t$ -covariant tensor fields on $M$ and $f : M → R.$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Using these formulas and (9.5) we can check that arbitrary tensor field of type $(0,k)$ can be expressed in local coordinates as follows\n",
"\n",
"\\begin{equation}\n",
"\\begin{matrix}\n",
"t=t_{i_1\\ldots i_k}dx^{i_1}\\otimes\\dots\\otimes dx^{i_k},\\\\\n",
"t_{i_1\\ldots i_k}=t\\big(\\frac{\\partial}{\\partial x^{i_1}},\\ldots,\\frac{\\partial}{\\partial x^{i_k}}\\big).\n",
"\\end{matrix}\n",
"\\tag{13.7}\n",
"\\end{equation}\n",
"\n",
"
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If $X_1 , . . . , X_k$ are vector fields on $M$ and $f\\in C^\\infty(M)$, then from the multi-linearity of $t_p$ on $T_pM$ for $p\\in M$ it follows that\n",
"\n",
"$$[t (X_1 , . . . , f X_i , . . . , X_k )]( p) =\n",
"t_p (X_1 ( p), . . . , ( f X_i )( p), . . . , X_k ( p))\\\\\n",
"= t_p (X_1 ( p), . . . , f ( p)X_i ( p), . . . , X_k ( p))\\\\\n",
"= f ( p)t_p( X_1 ( p), . . . , X_i ( p), . . . , X_k ( p))\\\\\n",
"= f ( p)[t (X_1 , . . . , X_i , . . . , X_k )]( p),\n",
"$$\n",
"\n",
"for $p ∈ M$. We have checked that \n",
"\n",
"$$t (X_1 , . . . , f X_i , . . . , X_k )=ft (X_1 , . . . , X_i , . . . , X_k ),\\quad i=1,\\ldots,k,$$\n",
"\n",
"for $X_i\\in \\mathfrak{X}(M)$ and $f\\in C^\\infty(M).$
\n",
"\n",
"Similarly for $X_i,Y_i\\in\\mathfrak{X}(M)$ we can check that for $i=1,\\ldots,k$\n",
"\n",
"$$t (X_1 , . . . , X_i + Y_i , . . . , X_k ) = t (X_1 , . . . , X_i , . . . , X_k ) + t (X_1 , . . . , Y_i , . . . , X_k ).$$\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"### Tensorial property\n",
"\n",
"
\n",
"\n",
"If $t$ is a map that to each set of $k$ vector fields $X_i\\in\\mathfrak{X}(M)\\ $ on $M$ associates a function $t(X_1,\\ldots,X_k):M\\to R$ with the property that for functions $f,g\\in C^\\infty(M),\\ $ $X_i,Y_i\\in\\mathfrak{X}(M)\\ $ and $i=1,\\ldots,k$\n",
"\n",
"$$t (X_1 , . . . , fX_i + gY_i , . . . , X_k ) = ft (X_1 , . . . , X_i , . . . , X_k ) +gt (X_1 , . . . , Y_i , . . . , X_k ),$$\n",
"\n",
"then $t$ is a tensor field of type $(0,k).$\n",
"\n",
"
\n",
"\n",
"Note that the last property means that covariant tensor fields of rank $k$ are just multilinear functions on the Cartesian product $\\underbrace{\\mathfrak{X}(M)\\times\\cdots\\times \\mathfrak{X}(M)}_{k\\ \\; \\mbox{times}}$ of $k$ copies of the module $\\mathfrak{X}(M)$ over the ring $C^\\infty(M)$.\n",
"\n",
"The module of covariant tensor fields of type $(0,k)\\ $ on a manifold $M$ will be denoted by $T^{(0,k)}M$. \n",
"\n",
"**Warning.** If $M$ is a module -not a manifold, in [notebook 9a](https://nbviewer.org/github/sagemanifolds/IntroToManifolds/blob/main/09aManifold_Tensors_onModules.ipynb) the same notations denote the space of covariant tensors of rank $k$ on the module $M$.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"### Covariant tensor fields in components\n",
"\n",
"
\n",
"\n",
"Using this property we can give another proof of (13.7). If the vector fields are expressed in the form $\\quad X_i = dx^j (X_i ) \\frac{∂}{∂ x^j} ,\\quad i = 1, . . . , k,$ then\n",
"$$t (X_1 , . . . , X_k ) = t(dx^i(X_1 )\\frac{∂}{∂ x^i} , . . . , \n",
"dx^m (X_k )\\frac{∂}{∂ x^m})\\\\\n",
"= dx^i (X_1 ) · · · dx^m (X_k )\\;t( \\frac{∂}{∂ x^i},\\ldots \\frac{∂}{∂ x^m})\\\\\n",
"=\\Big[t(\\frac{∂}{∂ x^i},\\ldots \\frac{∂}{∂ x^m})dx^i \\otimes · · · \\otimes dx^m\\Big] (X_1 , . . . , X_k ).$$\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.5**\n",
"\n",
"Define a general (0,2)-type tensor field on a 2-dimensional manifold (4 scalar functions as components)."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tensor field t of type (0,2) on the 2-dimensional differentiable manifold M\n"
]
}
],
"source": [
"N = 2 # dimension of manifold\n",
"M = Manifold(N, 'M') # manifold M of dim. N\n",
"X = M.chart(' '.join(['x'+str(i)+':x^{'+str(i)+'}' for i in range(N)])) # chart on M\n",
"t = M.tensor_field(0, 2, name='t') # tensor field of type (0,2)\n",
"print(t) # show information on t"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The components of the tensor field $t$ are scalar functions"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t = f_{00} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{10} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t = f_{00} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{10} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t = f00 dx0⊗dx0 + f01 dx0⊗dx1 + f10 dx1⊗dx0 + f11 dx1⊗dx1"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x0, x1 = X[:] # coordinates x^0 and x^1 of chart X as the Python variables x0 and x1\n",
"f00 = M.scalar_field(function('f00')(x0, x1), name='f00') # scalar functions\n",
"f01 = M.scalar_field(function('f01')(x0, x1), name='f01') # defining components\n",
"f10 = M.scalar_field(function('f10')(x0, x1), name='f10')\n",
"f11 = M.scalar_field(function('f11')(x0, x1), name='f11')\n",
"t[0,0] = f00; t[0,1] = f01 # components of tensor field t\n",
"t[1,0] = f10; t[1,1] = f11 \n",
"t.disp() # show t"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let us check that $t_{ij}=t(\\frac{\\partial}{\\partial x_i},\\frac{\\partial}{\\partial x_j})$"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\left(\\frac{\\partial}{\\partial {x^{0}} }, \\frac{\\partial}{\\partial {x^{1}} }\\right)\\)"
],
"text/latex": [
"$\\displaystyle \\left(\\frac{\\partial}{\\partial {x^{0}} }, \\frac{\\partial}{\\partial {x^{1}} }\\right)$"
],
"text/plain": [
"(Vector field ∂/∂x0 on the 2-dimensional differentiable manifold M,\n",
" Vector field ∂/∂x1 on the 2-dimensional differentiable manifold M)"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fr = X.frame();fr[:] # local frame on M"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\left(\\begin{array}{rr}\n",
"f_{00}\\left({x^{0}}, {x^{1}}\\right) & f_{01}\\left({x^{0}}, {x^{1}}\\right) \\\\\n",
"f_{10}\\left({x^{0}}, {x^{1}}\\right) & f_{11}\\left({x^{0}}, {x^{1}}\\right)\n",
"\\end{array}\\right)\\)"
],
"text/latex": [
"$\\displaystyle \\left(\\begin{array}{rr}\n",
"f_{00}\\left({x^{0}}, {x^{1}}\\right) & f_{01}\\left({x^{0}}, {x^{1}}\\right) \\\\\n",
"f_{10}\\left({x^{0}}, {x^{1}}\\right) & f_{11}\\left({x^{0}}, {x^{1}}\\right)\n",
"\\end{array}\\right)$"
],
"text/plain": [
"[f00(x0, x1) f01(x0, x1)]\n",
"[f10(x0, x1) f11(x0, x1)]"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"matrix(2,2,lambda i,j: t(fr[i],fr[j]).expr()) # compute t(d/dxi,d/dxj)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\left(\\mathrm{d} {x^{0}}, \\mathrm{d} {x^{1}}\\right)\\)"
],
"text/latex": [
"$\\displaystyle \\left(\\mathrm{d} {x^{0}}, \\mathrm{d} {x^{1}}\\right)$"
],
"text/plain": [
"(1-form dx0 on the 2-dimensional differentiable manifold M,\n",
" 1-form dx1 on the 2-dimensional differentiable manifold M)"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X.coframe()[:] # local coframe"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.6**\n",
"\n",
"Let us define a more concrete example with variable components (upper indices and powers do not mix well)."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t = {x^{0}}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}} {x^{1}} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}} {x^{1}} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + {x^{1}}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t = {x^{0}}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}} {x^{1}} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}} {x^{1}} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + {x^{1}}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t = x0^2 dx0⊗dx0 + x0*x1 dx0⊗dx1 + x0*x1 dx1⊗dx0 + x1^2 dx1⊗dx1"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# continuation\n",
"t[:] = matrix(2, 2, lambda i,j: X[i]*X[j]) # t_{ij}=x_i*x_j\n",
"t.disp()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.7**"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"An example of a (0,4)-type tensor field (`*` denotes the tensor product):"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t\\otimes t = {x^{0}}^{4} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}}^{3} {x^{1}} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{3} {x^{1}} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{3} {x^{1}} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}} {x^{1}}^{3} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{3} {x^{1}} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}} {x^{1}}^{3} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}} {x^{1}}^{3} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}} {x^{1}}^{3} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + {x^{1}}^{4} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t\\otimes t = {x^{0}}^{4} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}}^{3} {x^{1}} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{3} {x^{1}} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{3} {x^{1}} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}} {x^{1}}^{3} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{3} {x^{1}} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}} {x^{1}}^{3} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}}^{2} {x^{1}}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + {x^{0}} {x^{1}}^{3} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + {x^{0}} {x^{1}}^{3} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + {x^{1}}^{4} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t⊗t = x0^4 dx0⊗dx0⊗dx0⊗dx0 + x0^3*x1 dx0⊗dx0⊗dx0⊗dx1 + x0^3*x1 dx0⊗dx0⊗dx1⊗dx0 + x0^2*x1^2 dx0⊗dx0⊗dx1⊗dx1 + x0^3*x1 dx0⊗dx1⊗dx0⊗dx0 + x0^2*x1^2 dx0⊗dx1⊗dx0⊗dx1 + x0^2*x1^2 dx0⊗dx1⊗dx1⊗dx0 + x0*x1^3 dx0⊗dx1⊗dx1⊗dx1 + x0^3*x1 dx1⊗dx0⊗dx0⊗dx0 + x0^2*x1^2 dx1⊗dx0⊗dx0⊗dx1 + x0^2*x1^2 dx1⊗dx0⊗dx1⊗dx0 + x0*x1^3 dx1⊗dx0⊗dx1⊗dx1 + x0^2*x1^2 dx1⊗dx1⊗dx0⊗dx0 + x0*x1^3 dx1⊗dx1⊗dx0⊗dx1 + x0*x1^3 dx1⊗dx1⊗dx1⊗dx0 + x1^4 dx1⊗dx1⊗dx1⊗dx1"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(t*t).disp()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.8**\n",
"\n",
"Defining tensor fields with symbolic components we can use shorter and more general notation. \n",
"\n",
"Let us define a tensor field of type (0,2) in a more compact way."
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t = f_{00} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{10} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t = f_{00} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{10} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t = f00 dx0⊗dx0 + f01 dx0⊗dx1 + f10 dx1⊗dx0 + f11 dx1⊗dx1"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"N = 2 # dimension of manifold M\n",
"M = Manifold(N, 'M') # manifold M\n",
"X = M.chart(' '.join(['x'+str(i)+':x^{'+str(i)+'}' for i in range(N)])) # chart on M\n",
"t = M.tensor_field(0,2, name='t') # tensor field of type (0,2)\n",
"def fn(i,j): return 'f'+str(i)+str(j) # names for components\n",
"def fl(i,j): return 'f'+'_'+'{'+str(i)+str(j)+'}' # latex comp.names \n",
"ff=[[M.scalar_field(function(fn(i,j),latex_name=fl(i,j))(*X)) \n",
" for j in range(N)] for i in range(N)] # nested list of comp.\n",
"t[:] = ff # define all components\n",
"t.disp() # show the result"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As we can see, the result is the same as previously."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The functions arguments can be omitted."
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t = f_{00} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{10} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t = f_{00} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{10} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t = f00 dx0⊗dx0 + f01 dx0⊗dx1 + f10 dx1⊗dx0 + f11 dx1⊗dx1"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Manifold.options.omit_function_arguments=True\n",
"t.disp()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t\\otimes t = f_{00}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{00} f_{01} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{00} f_{10} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{00} f_{11} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + f_{00} f_{01} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{01} f_{10} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{01} f_{11} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + f_{00} f_{10} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01} f_{10} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{10}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{10} f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + f_{00} f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01} f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{10} f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{11}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t\\otimes t = f_{00}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{00} f_{01} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{00} f_{10} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{00} f_{11} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + f_{00} f_{01} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01}^{2} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{01} f_{10} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{01} f_{11} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + f_{00} f_{10} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01} f_{10} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{10}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{10} f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + f_{00} f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{01} f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{10} f_{11} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{11}^{2} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t⊗t = f00^2 dx0⊗dx0⊗dx0⊗dx0 + f00*f01 dx0⊗dx0⊗dx0⊗dx1 + f00*f10 dx0⊗dx0⊗dx1⊗dx0 + f00*f11 dx0⊗dx0⊗dx1⊗dx1 + f00*f01 dx0⊗dx1⊗dx0⊗dx0 + f01^2 dx0⊗dx1⊗dx0⊗dx1 + f01*f10 dx0⊗dx1⊗dx1⊗dx0 + f01*f11 dx0⊗dx1⊗dx1⊗dx1 + f00*f10 dx1⊗dx0⊗dx0⊗dx0 + f01*f10 dx1⊗dx0⊗dx0⊗dx1 + f10^2 dx1⊗dx0⊗dx1⊗dx0 + f10*f11 dx1⊗dx0⊗dx1⊗dx1 + f00*f11 dx1⊗dx1⊗dx0⊗dx0 + f01*f11 dx1⊗dx1⊗dx0⊗dx1 + f10*f11 dx1⊗dx1⊗dx1⊗dx0 + f11^2 dx1⊗dx1⊗dx1⊗dx1"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(t*t).disp()"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"Manifold.options.omit_function_arguments=False"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"**Remark**.\n",
"If we want to make purely algebraic operations on tensor fields, then we can use symbols, not functions as components (this will not work if we want to use derivatives!)."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.9**\n",
"\n",
"Define (0,3) type tensor field on a two dimensional manifold."
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tensor field t3 of type (0,3) on the 2-dimensional differentiable manifold M\n"
]
}
],
"source": [
"N = 2 # dimension of manifold M\n",
"M = Manifold(N, 'M') # manifold M\n",
"X = M.chart(' '.join(['x'+str(i)+':x^{'+str(i)+'}' for i in range(N)])) # chart on M\n",
"t3 = M.tensor_field(0,3, name='t3')# tensor field of type (0,3)\n",
"print(t3) # information on t3"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We define a three-dimensional table of symbols $a_{ijk}$"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"a3 =[[[SR('a'+str(i)+str(j)+str(k)) for k in range(N)] \n",
" for j in range(N)] for i in range(N)] # nested list of components"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"and all components define with one equality."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle \\left[\\left[\\left[a_{000}, a_{001}\\right], \\left[a_{010}, a_{011}\\right]\\right], \\left[\\left[a_{100}, a_{101}\\right], \\left[a_{110}, a_{111}\\right]\\right]\\right]\\)"
],
"text/latex": [
"$\\displaystyle \\left[\\left[\\left[a_{000}, a_{001}\\right], \\left[a_{010}, a_{011}\\right]\\right], \\left[\\left[a_{100}, a_{101}\\right], \\left[a_{110}, a_{111}\\right]\\right]\\right]$"
],
"text/plain": [
"[[[a000, a001], [a010, a011]], [[a100, a101], [a110, a111]]]"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t3[:] = a3 # define all components as symbols\n",
"t3[:] # show components of t3 "
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t3 = a_{000} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + a_{001} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + a_{010} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + a_{011} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + a_{100} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + a_{101} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + a_{110} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + a_{111} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t3 = a_{000} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + a_{001} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + a_{010} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + a_{011} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + a_{100} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + a_{101} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + a_{110} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + a_{111} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t3 = a000 dx0⊗dx0⊗dx0 + a001 dx0⊗dx0⊗dx1 + a010 dx0⊗dx1⊗dx0 + a011 dx0⊗dx1⊗dx1 + a100 dx1⊗dx0⊗dx0 + a101 dx1⊗dx0⊗dx1 + a110 dx1⊗dx1⊗dx0 + a111 dx1⊗dx1⊗dx1"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"t3.disp() # show the tensor"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Remember that the components in this example do not depend on coordinates. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.10**\n",
"\n",
"If we need a proper tensor field, with components depending on coordinates, the previous example should be modified.\n",
"\n",
"The first cell remains the same:"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tensor field t3 of type (0,3) on the 2-dimensional differentiable manifold M\n"
]
}
],
"source": [
"N = 2 # dimension of manifold\n",
"M = Manifold(N, 'M') # manifold M\n",
"X = M.chart(' '.join(['x'+str(i)+':x^{'+str(i)+'}' for i in range(N)])) # chart on M\n",
"t3 = M.tensor_field(0,3, name='t3');print(t3) # tensor field"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"but to define components we need scalar fields: "
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t3 = f_{000}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{001}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{010}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{011}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + f_{100}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{101}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{110}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{111}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t3 = f_{000}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{001}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{010}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{011}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + f_{100}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{101}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{110}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{111}\\left({x^{0}}, {x^{1}}\\right) \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t3 = f000(x0, x1) dx0⊗dx0⊗dx0 + f001(x0, x1) dx0⊗dx0⊗dx1 + f010(x0, x1) dx0⊗dx1⊗dx0 + f011(x0, x1) dx0⊗dx1⊗dx1 + f100(x0, x1) dx1⊗dx0⊗dx0 + f101(x0, x1) dx1⊗dx0⊗dx1 + f110(x0, x1) dx1⊗dx1⊗dx0 + f111(x0, x1) dx1⊗dx1⊗dx1"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def fn(i,j,k): return 'f'+str(i)+str(j)+str(k) # names of components\n",
"def fl(i,j,k): return 'f'+'_'+'{'+str(i)+str(j)+str(k)+'}' # latex names\n",
" # nested list of component functions\n",
"ff = [[[M.scalar_field(function(fn(i,j,k),latex_name=fl(i,j,k))(*X)) \n",
" for k in range(N)] for j in range(N)] for i in range(N)]\n",
"t3[:] = ff # define all components\n",
"t3.disp() # show t3"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The functions argument can be omitted:"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t3 = f_{000} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{001} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{010} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{011} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + f_{100} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{101} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{110} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{111} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t3 = f_{000} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{001} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{010} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{011} \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + f_{100} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + f_{101} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + f_{110} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + f_{111} \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t3 = f000 dx0⊗dx0⊗dx0 + f001 dx0⊗dx0⊗dx1 + f010 dx0⊗dx1⊗dx0 + f011 dx0⊗dx1⊗dx1 + f100 dx1⊗dx0⊗dx0 + f101 dx1⊗dx0⊗dx1 + f110 dx1⊗dx1⊗dx0 + f111 dx1⊗dx1⊗dx1"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Manifold.options.omit_function_arguments=True\n",
"t3.disp() # output without component arguments"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
"Manifold.options.omit_function_arguments=False"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Unfortunately, (in our system) latex encounters problems if the outputs are to long.\n",
"\n",
"If the latex formatted output is not needed, the `%display plain` method works properly."
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"t3⊗t3 = f000^2 dx0⊗dx0⊗dx0⊗dx0⊗dx0⊗dx0 + f000*f001 dx0⊗dx0⊗dx0⊗dx0⊗dx0⊗dx1 + f000*f010 dx0⊗dx0⊗dx0⊗dx0⊗dx1⊗dx0 + f000*f011 dx0⊗dx0⊗dx0⊗dx0⊗dx1⊗dx1 + f000*f100 dx0⊗dx0⊗dx0⊗dx1⊗dx0⊗dx0 + f000*f101 dx0⊗dx0⊗dx0⊗dx1⊗dx0⊗dx1 + f000*f110 dx0⊗dx0⊗dx0⊗dx1⊗dx1⊗dx0 + f000*f111 dx0⊗dx0⊗dx0⊗dx1⊗dx1⊗dx1 + f000*f001 dx0⊗dx0⊗dx1⊗dx0⊗dx0⊗dx0 + f001^2 dx0⊗dx0⊗dx1⊗dx0⊗dx0⊗dx1 + f001*f010 dx0⊗dx0⊗dx1⊗dx0⊗dx1⊗dx0 + f001*f011 dx0⊗dx0⊗dx1⊗dx0⊗dx1⊗dx1 + f001*f100 dx0⊗dx0⊗dx1⊗dx1⊗dx0⊗dx0 + f001*f101 dx0⊗dx0⊗dx1⊗dx1⊗dx0⊗dx1 + f001*f110 dx0⊗dx0⊗dx1⊗dx1⊗dx1⊗dx0 + f001*f111 dx0⊗dx0⊗dx1⊗dx1⊗dx1⊗dx1 + f000*f010 dx0⊗dx1⊗dx0⊗dx0⊗dx0⊗dx0 + f001*f010 dx0⊗dx1⊗dx0⊗dx0⊗dx0⊗dx1 + f010^2 dx0⊗dx1⊗dx0⊗dx0⊗dx1⊗dx0 + f010*f011 dx0⊗dx1⊗dx0⊗dx0⊗dx1⊗dx1 + f010*f100 dx0⊗dx1⊗dx0⊗dx1⊗dx0⊗dx0 + f010*f101 dx0⊗dx1⊗dx0⊗dx1⊗dx0⊗dx1 + f010*f110 dx0⊗dx1⊗dx0⊗dx1⊗dx1⊗dx0 + f010*f111 dx0⊗dx1⊗dx0⊗dx1⊗dx1⊗dx1 + f000*f011 dx0⊗dx1⊗dx1⊗dx0⊗dx0⊗dx0 + f001*f011 dx0⊗dx1⊗dx1⊗dx0⊗dx0⊗dx1 + f010*f011 dx0⊗dx1⊗dx1⊗dx0⊗dx1⊗dx0 + f011^2 dx0⊗dx1⊗dx1⊗dx0⊗dx1⊗dx1 + f011*f100 dx0⊗dx1⊗dx1⊗dx1⊗dx0⊗dx0 + f011*f101 dx0⊗dx1⊗dx1⊗dx1⊗dx0⊗dx1 + f011*f110 dx0⊗dx1⊗dx1⊗dx1⊗dx1⊗dx0 + f011*f111 dx0⊗dx1⊗dx1⊗dx1⊗dx1⊗dx1 + f000*f100 dx1⊗dx0⊗dx0⊗dx0⊗dx0⊗dx0 + f001*f100 dx1⊗dx0⊗dx0⊗dx0⊗dx0⊗dx1 + f010*f100 dx1⊗dx0⊗dx0⊗dx0⊗dx1⊗dx0 + f011*f100 dx1⊗dx0⊗dx0⊗dx0⊗dx1⊗dx1 + f100^2 dx1⊗dx0⊗dx0⊗dx1⊗dx0⊗dx0 + f100*f101 dx1⊗dx0⊗dx0⊗dx1⊗dx0⊗dx1 + f100*f110 dx1⊗dx0⊗dx0⊗dx1⊗dx1⊗dx0 + f100*f111 dx1⊗dx0⊗dx0⊗dx1⊗dx1⊗dx1 + f000*f101 dx1⊗dx0⊗dx1⊗dx0⊗dx0⊗dx0 + f001*f101 dx1⊗dx0⊗dx1⊗dx0⊗dx0⊗dx1 + f010*f101 dx1⊗dx0⊗dx1⊗dx0⊗dx1⊗dx0 + f011*f101 dx1⊗dx0⊗dx1⊗dx0⊗dx1⊗dx1 + f100*f101 dx1⊗dx0⊗dx1⊗dx1⊗dx0⊗dx0 + f101^2 dx1⊗dx0⊗dx1⊗dx1⊗dx0⊗dx1 + f101*f110 dx1⊗dx0⊗dx1⊗dx1⊗dx1⊗dx0 + f101*f111 dx1⊗dx0⊗dx1⊗dx1⊗dx1⊗dx1 + f000*f110 dx1⊗dx1⊗dx0⊗dx0⊗dx0⊗dx0 + f001*f110 dx1⊗dx1⊗dx0⊗dx0⊗dx0⊗dx1 + f010*f110 dx1⊗dx1⊗dx0⊗dx0⊗dx1⊗dx0 + f011*f110 dx1⊗dx1⊗dx0⊗dx0⊗dx1⊗dx1 + f100*f110 dx1⊗dx1⊗dx0⊗dx1⊗dx0⊗dx0 + f101*f110 dx1⊗dx1⊗dx0⊗dx1⊗dx0⊗dx1 + f110^2 dx1⊗dx1⊗dx0⊗dx1⊗dx1⊗dx0 + f110*f111 dx1⊗dx1⊗dx0⊗dx1⊗dx1⊗dx1 + f000*f111 dx1⊗dx1⊗dx1⊗dx0⊗dx0⊗dx0 + f001*f111 dx1⊗dx1⊗dx1⊗dx0⊗dx0⊗dx1 + f010*f111 dx1⊗dx1⊗dx1⊗dx0⊗dx1⊗dx0 + f011*f111 dx1⊗dx1⊗dx1⊗dx0⊗dx1⊗dx1 + f100*f111 dx1⊗dx1⊗dx1⊗dx1⊗dx0⊗dx0 + f101*f111 dx1⊗dx1⊗dx1⊗dx1⊗dx0⊗dx1 + f110*f111 dx1⊗dx1⊗dx1⊗dx1⊗dx1⊗dx0 + f111^2 dx1⊗dx1⊗dx1⊗dx1⊗dx1⊗dx1"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#(t3*t3).disp() returns latex code string\n",
"#(t3*t3)[:] works OK\n",
"Manifold.options.omit_function_arguments=True\n",
"tt = t3*t3\n",
"%display plain\n",
"tt.disp()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"### Tensor fields of type $(k,0)$ (contravariant tensor fields of rank $k$)\n",
"\n",
"
\n",
"\n",
"A **tensor field of type $(k, 0)$** (or a **contravariant tensor field\n",
" of rank $k$**) on a manifold $M$ is a map $t$ that\n",
" associates to each point $p ∈ M$ a tensor $t(p)=t_p\\in T^{(k,0)}_pM\\ \\ \\ $ ($T^{(k,0)}_pM$ was defined in [notebook 9](09Manifold_LinearFormsTensors_onTp.ipynb)). \n",
"
\n",
"The tensor\n",
"field $t$ is smooth if for arbitrary 1-forms $α_1 , . . . , α_k$ , the function $t(α_1 , . . . , α_k )$,\n",
"defined by $[t (α_1, . . . , α_k )]( p) = t_p( α_1(p), . . . , α_k(p))$ , is smooth. \n",
"\n",
"The operations of tensor addition, scalar multiplication and tensor product are defined pointwise as in the case of covariant tensor fields.\n",
"\n",
"
\n",
"\n",
"### Tensorial property\n",
"\n",
"
\n",
"\n",
"A map $t$ is a tensor field of type $(k,0)$ iff it associates to each set of $k$ covector fields $α_1 , . . . , α_k$ on $M$ a function $t(α_1 , . . . , α_k):M\\to R$ with \n",
"the property that for functions $f,g:M\\to R$, $\\alpha_1,\\ldots,\\alpha_k,\\beta_1,\\ldots,\\beta_k\\in T^*(M)$, and $i=1,\\ldots,k$\n",
"\n",
"$$t (\\alpha_1 , . . . , f\\alpha_i + g\\beta_i , . . . , \\alpha_k ) = ft (\\alpha_1 , . . . , \\alpha_i , . . . , \\alpha_k ) +gt (\\alpha_1 , . . . , \\beta_i , . . . , \\alpha_k ).$$\n",
"\n",
"
\n",
"\n",
"Note that the last property means that contravariant tensor fields of rank $k$ are just multilinear functions on the Cartesian product $\\underbrace{\\Omega^1(M)\\times\\cdots\\times \\Omega^1(M)}_{k\\ \\; \\mbox{times}}$ of $k$ copies of the module $\\Omega^1(M)$ over the ring $C^\\infty(M)$.\n",
"\n",
"The module of contravariant tensor fields of type $(k,0)$\n",
"on a manifold $M$ will be denoted by $T^{(𝑘,0)}M.$\n",
"\n",
"\n",
"**Warning**. If $M$\n",
"is a module -not a manifold, in [notebook 9a](https://nbviewer.org/github/sagemanifolds/IntroToManifolds/blob/main/09aManifold_Tensors_onModules.ipynb) the same notations denote the space of contravariant tensors of rank 𝑘 on the module $M$.\n",
"\n",
"
\n",
"\n",
"### Contravariant tensor fields in components\n",
"\n",
"
\n",
"\n",
"Using (9.7) we can check that any tensor\n",
"field of type $(k,0)$ on $M$ is expressed locally as\n",
"\n",
"\\begin{equation}\n",
"t = t (dx^{i_1} , . . . , dx^{i_k} )\\frac{\\partial}{\\partial x^{i_1}}\\otimes\\dots\\otimes\n",
"\\frac{\\partial}{\\partial x^{i_k}}.\n",
"\\label{}\\tag{13.8}\n",
"\\end{equation}\n",
"\n",
"One can prove that if $x^1,\\ldots,x^n$ are local coordinates on $U$ and \n",
"$\\ t^{i_1\\ldots i_k}=t(dx^{i_1} , . . . , dx^{i_k} )\\ $, then $t$ is smooth iff for arbitrary $p\\in M$ there is a coordinate map \n",
"$(U,(x^1,\\ldots,x^n))$ around $p$ such that the real functions $\\ t^{i_1\\ldots i_k}\\ $ are smooth. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.11**\n",
"\n",
"Let us show an example of tensor field $t\\in T^{(2,0)}M$.
"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tensor field t of type (2,0) on the 2-dimensional differentiable manifold M\n"
]
}
],
"source": [
"%display latex\n",
"N = 2 # dimension of manifold M\n",
"M = Manifold(N, 'M') # manifold M\n",
"X = M.chart(' '.join(['x'+str(i)+':x^{'+str(i)+'}' for i in range(N)])) # chart on M\n",
"t = M.tensor_field(2,0, name='t'); print(t) # tensor field (2,0) type"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Below, we use superscripts to show that the contravariant tensor fields may look in SageMath Manifolds as in textbooks."
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t = f^{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\)"
],
"text/latex": [
"$\\displaystyle t = f^{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }$"
],
"text/plain": [
"t = f00 ∂/∂x0⊗∂/∂x0 + f01 ∂/∂x0⊗∂/∂x1 + f10 ∂/∂x1⊗∂/∂x0 + f11 ∂/∂x1⊗∂/∂x1"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def fn(i,j): return 'f'+str(i)+str(j) # component names\n",
"def fl(i,j): return 'f'+'^'+'{'+str(i)+str(j)+'}' # latex names\n",
"ff = [[M.scalar_field(function(fn(i,j),latex_name=fl(i,j))(*X)) \n",
" for j in range(N)] for i in range(N)] # nested list of comp.\n",
"t[:] = ff # define all components\n",
"Manifold.options.omit_function_arguments=True # output without comp. arguments\n",
"t.disp() # show t"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Using tensor products it is easy to obtain large outputs."
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t\\otimes t = f^{00}\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{01}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{10}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{01}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{01}\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{01}\\left({x^{0}}, {x^{1}}\\right) f^{10}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{01}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{10}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{01}\\left({x^{0}}, {x^{1}}\\right) f^{10}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{10}\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{10}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{01}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{10}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{11}\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\)"
],
"text/latex": [
"$\\displaystyle t\\otimes t = f^{00}\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{01}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{10}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{01}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{01}\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{01}\\left({x^{0}}, {x^{1}}\\right) f^{10}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{01}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{10}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{01}\\left({x^{0}}, {x^{1}}\\right) f^{10}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{10}\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{10}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{00}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{01}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{10}\\left({x^{0}}, {x^{1}}\\right) f^{11}\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{11}\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }$"
],
"text/plain": [
"t⊗t = f00(x0, x1)^2 ∂/∂x0⊗∂/∂x0⊗∂/∂x0⊗∂/∂x0 + f00(x0, x1)*f01(x0, x1) ∂/∂x0⊗∂/∂x0⊗∂/∂x0⊗∂/∂x1 + f00(x0, x1)*f10(x0, x1) ∂/∂x0⊗∂/∂x0⊗∂/∂x1⊗∂/∂x0 + f00(x0, x1)*f11(x0, x1) ∂/∂x0⊗∂/∂x0⊗∂/∂x1⊗∂/∂x1 + f00(x0, x1)*f01(x0, x1) ∂/∂x0⊗∂/∂x1⊗∂/∂x0⊗∂/∂x0 + f01(x0, x1)^2 ∂/∂x0⊗∂/∂x1⊗∂/∂x0⊗∂/∂x1 + f01(x0, x1)*f10(x0, x1) ∂/∂x0⊗∂/∂x1⊗∂/∂x1⊗∂/∂x0 + f01(x0, x1)*f11(x0, x1) ∂/∂x0⊗∂/∂x1⊗∂/∂x1⊗∂/∂x1 + f00(x0, x1)*f10(x0, x1) ∂/∂x1⊗∂/∂x0⊗∂/∂x0⊗∂/∂x0 + f01(x0, x1)*f10(x0, x1) ∂/∂x1⊗∂/∂x0⊗∂/∂x0⊗∂/∂x1 + f10(x0, x1)^2 ∂/∂x1⊗∂/∂x0⊗∂/∂x1⊗∂/∂x0 + f10(x0, x1)*f11(x0, x1) ∂/∂x1⊗∂/∂x0⊗∂/∂x1⊗∂/∂x1 + f00(x0, x1)*f11(x0, x1) ∂/∂x1⊗∂/∂x1⊗∂/∂x0⊗∂/∂x0 + f01(x0, x1)*f11(x0, x1) ∂/∂x1⊗∂/∂x1⊗∂/∂x0⊗∂/∂x1 + f10(x0, x1)*f11(x0, x1) ∂/∂x1⊗∂/∂x1⊗∂/∂x1⊗∂/∂x0 + f11(x0, x1)^2 ∂/∂x1⊗∂/∂x1⊗∂/∂x1⊗∂/∂x1"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Manifold.options.omit_function_arguments=False # output with comp. arguments\n",
"(t*t).disp() # show tensor product"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"t⊗t = f00^2 ∂/∂x0⊗∂/∂x0⊗∂/∂x0⊗∂/∂x0 + f00*f01 ∂/∂x0⊗∂/∂x0⊗∂/∂x0⊗∂/∂x1 + f00*f10 ∂/∂x0⊗∂/∂x0⊗∂/∂x1⊗∂/∂x0 + f00*f11 ∂/∂x0⊗∂/∂x0⊗∂/∂x1⊗∂/∂x1 + f00*f01 ∂/∂x0⊗∂/∂x1⊗∂/∂x0⊗∂/∂x0 + f01^2 ∂/∂x0⊗∂/∂x1⊗∂/∂x0⊗∂/∂x1 + f01*f10 ∂/∂x0⊗∂/∂x1⊗∂/∂x1⊗∂/∂x0 + f01*f11 ∂/∂x0⊗∂/∂x1⊗∂/∂x1⊗∂/∂x1 + f00*f10 ∂/∂x1⊗∂/∂x0⊗∂/∂x0⊗∂/∂x0 + f01*f10 ∂/∂x1⊗∂/∂x0⊗∂/∂x0⊗∂/∂x1 + f10^2 ∂/∂x1⊗∂/∂x0⊗∂/∂x1⊗∂/∂x0 + f10*f11 ∂/∂x1⊗∂/∂x0⊗∂/∂x1⊗∂/∂x1 + f00*f11 ∂/∂x1⊗∂/∂x1⊗∂/∂x0⊗∂/∂x0 + f01*f11 ∂/∂x1⊗∂/∂x1⊗∂/∂x0⊗∂/∂x1 + f10*f11 ∂/∂x1⊗∂/∂x1⊗∂/∂x1⊗∂/∂x0 + f11^2 ∂/∂x1⊗∂/∂x1⊗∂/∂x1⊗∂/∂x1"
]
},
"execution_count": 33,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Manifold.options.omit_function_arguments=True # output without comp. arguments\n",
"%display plain\n",
"(t*t).disp() # show tensor product"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.12**\n",
"\n",
"The superscripts in contravariant tensor components are not obligatory. \n",
"Let us modify the previous example using subscripts."
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t2 = h_{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\)"
],
"text/latex": [
"$\\displaystyle t2 = h_{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }$"
],
"text/plain": [
"t2 = h00 ∂/∂x0⊗∂/∂x0 + h01 ∂/∂x0⊗∂/∂x1 + h10 ∂/∂x1⊗∂/∂x0 + h11 ∂/∂x1⊗∂/∂x1"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"reset()\n",
"N = 2 # dimension of manifold M\n",
"M = Manifold(N, 'M') # manifold M\n",
"X = M.chart(' '.join(['x'+str(i)+':x^{'+str(i)+'}' for i in range(N)])) # chart on M\n",
"t2 = M.tensor_field(2,0, name='t2') # tensor field (2,0) type\n",
"def hn(i,j): return 'h'+str(i)+str(j) # names for components\n",
"def hl(i,j): return 'h'+'_'+'{'+str(i)+str(j)+'}' # latex names\n",
"ff = [[M.scalar_field(function(hn(i,j), latex_name=hl(i,j))(*X)) \n",
" for j in range(N)] for i in range(N)] # component functions\n",
"t2[:] = ff # define all components\n",
"Manifold.options.omit_function_arguments=True # output without comp.arg\n",
"%display latex\n",
"t2.disp() # show the tensor field"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t2\\otimes t2 = h_{00}^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{00} h_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{00} h_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{00} h_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{00} h_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{01}^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{01} h_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{01} h_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{00} h_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{01} h_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{10}^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{10} h_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{00} h_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{01} h_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{10} h_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{11}^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\)"
],
"text/latex": [
"$\\displaystyle t2\\otimes t2 = h_{00}^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{00} h_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{00} h_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{00} h_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{00} h_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{01}^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{01} h_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{01} h_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{00} h_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{01} h_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{10}^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{10} h_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{00} h_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{01} h_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + h_{10} h_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + h_{11}^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }$"
],
"text/plain": [
"t2⊗t2 = h00^2 ∂/∂x0⊗∂/∂x0⊗∂/∂x0⊗∂/∂x0 + h00*h01 ∂/∂x0⊗∂/∂x0⊗∂/∂x0⊗∂/∂x1 + h00*h10 ∂/∂x0⊗∂/∂x0⊗∂/∂x1⊗∂/∂x0 + h00*h11 ∂/∂x0⊗∂/∂x0⊗∂/∂x1⊗∂/∂x1 + h00*h01 ∂/∂x0⊗∂/∂x1⊗∂/∂x0⊗∂/∂x0 + h01^2 ∂/∂x0⊗∂/∂x1⊗∂/∂x0⊗∂/∂x1 + h01*h10 ∂/∂x0⊗∂/∂x1⊗∂/∂x1⊗∂/∂x0 + h01*h11 ∂/∂x0⊗∂/∂x1⊗∂/∂x1⊗∂/∂x1 + h00*h10 ∂/∂x1⊗∂/∂x0⊗∂/∂x0⊗∂/∂x0 + h01*h10 ∂/∂x1⊗∂/∂x0⊗∂/∂x0⊗∂/∂x1 + h10^2 ∂/∂x1⊗∂/∂x0⊗∂/∂x1⊗∂/∂x0 + h10*h11 ∂/∂x1⊗∂/∂x0⊗∂/∂x1⊗∂/∂x1 + h00*h11 ∂/∂x1⊗∂/∂x1⊗∂/∂x0⊗∂/∂x0 + h01*h11 ∂/∂x1⊗∂/∂x1⊗∂/∂x0⊗∂/∂x1 + h10*h11 ∂/∂x1⊗∂/∂x1⊗∂/∂x1⊗∂/∂x0 + h11^2 ∂/∂x1⊗∂/∂x1⊗∂/∂x1⊗∂/∂x1"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tt2 = t2*t2\n",
"tt2.disp() # show tensor product"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.13**\n",
"\n",
"Let us show an example of (3,0) type tensor field, using superscripts."
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [],
"source": [
"%display latex \n",
"N = 2 # dimension of manifold M\n",
"M = Manifold(N, 'M') # manifold M\n",
"X = M.chart(' '.join(['x'+str(i)+':x^{'+str(i)+'}' for i in range(N)])) # chart on M\n",
"s3 = M.tensor_field(3,0, name='s3'); # tensor field of type (3,0)"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle s3 = f^{000} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{001} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{010} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{011} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{100} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{101} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{110} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{111} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\)"
],
"text/latex": [
"$\\displaystyle s3 = f^{000} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{001} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{010} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{011} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{100} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{101} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} } + f^{110} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} } + f^{111} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }$"
],
"text/plain": [
"s3 = f000 ∂/∂x0⊗∂/∂x0⊗∂/∂x0 + f001 ∂/∂x0⊗∂/∂x0⊗∂/∂x1 + f010 ∂/∂x0⊗∂/∂x1⊗∂/∂x0 + f011 ∂/∂x0⊗∂/∂x1⊗∂/∂x1 + f100 ∂/∂x1⊗∂/∂x0⊗∂/∂x0 + f101 ∂/∂x1⊗∂/∂x0⊗∂/∂x1 + f110 ∂/∂x1⊗∂/∂x1⊗∂/∂x0 + f111 ∂/∂x1⊗∂/∂x1⊗∂/∂x1"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def fn(i,j,k): return 'f'+str(i)+str(j)+str(k) # components names\n",
"def fl(i,j,k): return 'f'+'^'+'{'+str(i)+str(j)+str(k)+'}' # latex names\n",
"ff = [[[M.scalar_field(function(fn(i,j,k),latex_name=fl(i,j,k))(*X)) \n",
" for k in range(N)] for j in range(N)] for i in range(N)] # components\n",
"s3[:] = ff # define all components\n",
"Manifold.options.omit_function_arguments=True # output without comp. args\n",
"s3.disp() # show the tensor"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Tensor field s3⊗s3 of type (6,0) on the 2-dimensional differentiable manifold M\n"
]
}
],
"source": [
"# check tensor product \n",
"ss3 = s3*s3\n",
"print(ss3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"### Tensor fields of type $(𝑘,m)$ (mixed tensor fields) \n",
"\n",
"
"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A tensor field of type $(k,m)$ (a mixed tensor field) on $M$ is a map $t$ \n",
"that to each point $p ∈ M$ associates a tensor $t(p)=t_p\\in T^{(k,m)}_pM\\ \\ \\ $ ($T^{(k,m)}_pM$ was defined in [notebook 9](https://nbviewer.org/github/sagemanifolds/IntroToManifolds/blob/main/09Manifold_LinearFormsTensors_onTp.ipynb).\n",
"\n",
"
\n",
"A tensor field of type $(0,0)$ on $M$ is a scalar function $M\\to R$. \n",
"\n",
"A tensor field\n",
"$t$ of type $(k,m)$ is smooth if for $X_1 , . . . , X_m ∈ \\mathfrak{X}(M)$ and $α_1 , . . . , α_k ∈ \\Omega^1 (M)$,\n",
"the function $M \\to R$ that to each point $p ∈ M$ associates the value $t_p(α_1 ( p), . . . , α_k ( p),X_1 ( p), . . . , X_m ( p) )$ is smooth.\n",
"
\n",
"The sum, the product by scalars, the product by real-valued functions, and the\n",
"tensor product of mixed tensor fields are defined pointwise as in the case of covariant and contravariant tensors."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$\n",
"\\begin{matrix}\n",
"(at + bs)_p = at_p + bs_p,\\\\\n",
"( f t)_p = f ( p)t_p,\\\\\n",
"(t ⊗ s)_p = t_p ⊗ s_p,\n",
"\\end{matrix}\n",
"$$\n",
"\n",
"for $a, b ∈ R$, $s, t$ mixed tensor fields on $M$ and $f : M → R$ (addition is defined only for tensors of the same type).\n",
"\n",
"The set of smooth\n",
"tensor fields of type $(k,m)$ on a manifold $M$, will be denoted by $T^{(k,m)}M$.
\n",
"$T^{(k,m)}M$ **is a module over the ring $C^∞(M)$**.\n",
"\n",
"**Warning.** Recall, that in [notebook 9a](https://nbviewer.org/github/sagemanifolds/IntroToManifolds/blob/main/09aManifold_Tensors_onModules.ipynb), the same symbol $\\ T^{(k,m)}M\\ $ denotes the space of mixed tensors on a module $M$.\n",
"\n",
"
\n",
"\n",
"### Tensorial property\n",
"\n",
"
\n",
"\n",
"As previously, we can check, that tensor fields of type $(k,m)$ are just multilinear functions on the Cartesian product \n",
"$\\underbrace{\\Omega^1(M)\\times\\cdots\\times \\Omega^1(M)}_{k\\ \\; \\mbox{times}}\n",
"\\times \\underbrace{\\mathfrak{X}(M)\\times\\cdots\\times \\mathfrak{X}(M)}_{m\\ \\; \\mbox{times}}\n",
"$ of $k$ copies of the module $\\Omega^1(M)$ and $m$ copies of the module $\\mathfrak{X}(M)$ over the ring $C^\\infty(M)$.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"### General tensor fields in components\n",
"\n",
"
\n",
"\n",
"Generalizing the formulas (13.7) and (13.8) we obtain the following expression for the general tensor field $t\\in T^{(k,m)}M$ in local components\n",
"\n",
"\\begin{equation}\n",
"t=\n",
"t\\big(dx^{i_1},..,dx^{i_k},\\frac{\\partial}{\\partial x^{j_1}},..,\\frac{\\partial}{\\partial x^{j_m}}\\big)\n",
"\\frac{\\partial}{\\partial x^{i_1}}\\otimes\\dots\\otimes\\frac{\\partial}{\\partial x^{i_k}}\\otimes dx^{j_1}\\otimes\\ldots\\otimes dx^{j_m}.\n",
"\\label{}\\tag{13.9}\n",
"\\end{equation}\n",
"\n",
"Very often the notation\n",
"$$t^{i_1\\ldots i_k}_{j_1\\ldots j_m}=t\\big(dx^{i_1},..,dx^{i_k},\\frac{\\partial}{\\partial x^{j_1}},..,\\frac{\\partial}{\\partial x^{j_m}}\\big)\n",
"$$\n",
"is used and then \n",
"$$t=t^{i_1\\ldots i_k}_{j_1\\ldots j_m}\\frac{\\partial}{\\partial x^{i_1}}\\otimes\\dots\\otimes\\frac{\\partial}{\\partial x^{i_k}}\\otimes dx^{j_1}\\otimes\\ldots\\otimes dx^{j_m}.\n",
"$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"One can prove that if $x^1,\\ldots,x^n$ are local coordinates on $U$ and $t^{i_1\\ldots i_k}_{j_1\\ldots j_m}$ are defined as above,\n",
" then $t$ is smooth iff for arbitrary $p\\in M$ there is a coordinate map \n",
"$(U,(x^1,\\ldots,x^n))$ around $p$ such that the real functions $t^{i_1\\ldots i_k}_{j_1\\ldots j_m}$ are smooth."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.14**\n",
"\n",
"Consider a 2-dimensional manifold with global coordinates $x^0,x^1$:"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [],
"source": [
"%display latex\n",
"N = 2 # dimension of manifold M\n",
"M = Manifold(N, 'M') # manifold M\n",
"X = M.chart(' '.join(['x'+str(i)+':x^{'+str(i)+'}' for i in range(N)])) # chart on M"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Define a general tensor field of type (1,1).\n",
"\n",
"In the case of mixed type tensor fields it is important to distinguish the lower and upper indices!"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t = t^0_0 \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}} + t^0_1 \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}} + t^1_0 \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}} + t^1_1 \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t = t^0_0 \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}} + t^0_1 \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}} + t^1_0 \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}} + t^1_1 \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t = t00 ∂/∂x0⊗dx0 + t01 ∂/∂x0⊗dx1 + t10 ∂/∂x1⊗dx0 + t11 ∂/∂x1⊗dx1"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def fn(i,j): return 't'+str(i)+str(j) # component names\n",
"def fl(i,j): return 't'+'^'+str(i)+'_'+str(j) # latex names\n",
"ff = [[M.scalar_field(function(fn(i,j),latex_name=fl(i,j))(*X)) \n",
" for j in range(N)] for i in range(N)] # list of components\n",
"t = M.tensor_field(1,1, name='t') # tensor of (1,1) type\n",
"t[:] = ff # define all components\n",
"t.disp() # show the tensor"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"With this notations, the tensor product can be computed without problems:"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t\\otimes t = t^0_0\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^0_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^0_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^0_1\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^1_0\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^0_1\\left({x^{0}}, {x^{1}}\\right) t^1_0\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^0_1\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^1_0\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^0_1\\left({x^{0}}, {x^{1}}\\right) t^1_0\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^0_1\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^1_0\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^1_0\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^1_0\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^1_1\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t\\otimes t = t^0_0\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^0_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^0_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^0_1\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^1_0\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^0_1\\left({x^{0}}, {x^{1}}\\right) t^1_0\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^0_1\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^1_0\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^0_1\\left({x^{0}}, {x^{1}}\\right) t^1_0\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^0_0\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^0_1\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^1_0\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^1_0\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^1_0\\left({x^{0}}, {x^{1}}\\right) t^1_1\\left({x^{0}}, {x^{1}}\\right) \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^1_1\\left({x^{0}}, {x^{1}}\\right)^{2} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t⊗t = t00(x0, x1)^2 ∂/∂x0⊗∂/∂x0⊗dx0⊗dx0 + t00(x0, x1)*t01(x0, x1) ∂/∂x0⊗∂/∂x0⊗dx0⊗dx1 + t00(x0, x1)*t01(x0, x1) ∂/∂x0⊗∂/∂x0⊗dx1⊗dx0 + t01(x0, x1)^2 ∂/∂x0⊗∂/∂x0⊗dx1⊗dx1 + t00(x0, x1)*t10(x0, x1) ∂/∂x0⊗∂/∂x1⊗dx0⊗dx0 + t00(x0, x1)*t11(x0, x1) ∂/∂x0⊗∂/∂x1⊗dx0⊗dx1 + t01(x0, x1)*t10(x0, x1) ∂/∂x0⊗∂/∂x1⊗dx1⊗dx0 + t01(x0, x1)*t11(x0, x1) ∂/∂x0⊗∂/∂x1⊗dx1⊗dx1 + t00(x0, x1)*t10(x0, x1) ∂/∂x1⊗∂/∂x0⊗dx0⊗dx0 + t01(x0, x1)*t10(x0, x1) ∂/∂x1⊗∂/∂x0⊗dx0⊗dx1 + t00(x0, x1)*t11(x0, x1) ∂/∂x1⊗∂/∂x0⊗dx1⊗dx0 + t01(x0, x1)*t11(x0, x1) ∂/∂x1⊗∂/∂x0⊗dx1⊗dx1 + t10(x0, x1)^2 ∂/∂x1⊗∂/∂x1⊗dx0⊗dx0 + t10(x0, x1)*t11(x0, x1) ∂/∂x1⊗∂/∂x1⊗dx0⊗dx1 + t10(x0, x1)*t11(x0, x1) ∂/∂x1⊗∂/∂x1⊗dx1⊗dx0 + t11(x0, x1)^2 ∂/∂x1⊗∂/∂x1⊗dx1⊗dx1"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#t*t works\n",
"Manifold.options.omit_function_arguments=False # output with comp.args\n",
"tt = t*t # tensor product\n",
"tt.disp() # show tensor product"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"
\n",
"\n",
"**Example 13.15**\n",
"\n",
"Now let us try to define (2,2)-type tensor field on the same two-dimensional manifold"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle t = t^{00}_{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^{00}_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^{00}_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^{00}_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^{01}_{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^{01}_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^{01}_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^{01}_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^{10}_{00} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^{10}_{01} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^{10}_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^{10}_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^{11}_{00} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^{11}_{01} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^{11}_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^{11}_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle t = t^{00}_{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^{00}_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^{00}_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^{00}_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^{01}_{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^{01}_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^{01}_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^{01}_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^{10}_{00} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^{10}_{01} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^{10}_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^{10}_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + t^{11}_{00} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + t^{11}_{01} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + t^{11}_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + t^{11}_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"t = t0000 ∂/∂x0⊗∂/∂x0⊗dx0⊗dx0 + t0001 ∂/∂x0⊗∂/∂x0⊗dx0⊗dx1 + t0010 ∂/∂x0⊗∂/∂x0⊗dx1⊗dx0 + t0011 ∂/∂x0⊗∂/∂x0⊗dx1⊗dx1 + t0100 ∂/∂x0⊗∂/∂x1⊗dx0⊗dx0 + t0101 ∂/∂x0⊗∂/∂x1⊗dx0⊗dx1 + t0110 ∂/∂x0⊗∂/∂x1⊗dx1⊗dx0 + t0111 ∂/∂x0⊗∂/∂x1⊗dx1⊗dx1 + t1000 ∂/∂x1⊗∂/∂x0⊗dx0⊗dx0 + t1001 ∂/∂x1⊗∂/∂x0⊗dx0⊗dx1 + t1010 ∂/∂x1⊗∂/∂x0⊗dx1⊗dx0 + t1011 ∂/∂x1⊗∂/∂x0⊗dx1⊗dx1 + t1100 ∂/∂x1⊗∂/∂x1⊗dx0⊗dx0 + t1101 ∂/∂x1⊗∂/∂x1⊗dx0⊗dx1 + t1110 ∂/∂x1⊗∂/∂x1⊗dx1⊗dx0 + t1111 ∂/∂x1⊗∂/∂x1⊗dx1⊗dx1"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# continuation; first define names and latex names of components\n",
"def fl(i0,i1,i2,i3): return 't'+'^'+'{'+str(i0)+str(i1)+'}'+'_'+'{'+str(i2)+str(i3)+'}'\n",
"def fn(i0,i1,i2,i3): return 't'+str(i0)+str(i1)+str(i2)+str(i3)\n",
"# define nested list of components of the tensor\n",
"ff = [[[[M.scalar_field(function(fn(i0,i1,i2,i3),latex_name=fl(i0,i1,i2,i3))(*X)) \n",
" for i3 in range(N)] for i2 in range(N)] for i1 in range(N)] for i0 in range(N)]\n",
"t = M.tensor_field(2,2, name='t') # tensor field of type (2,2)\n",
"t[:] = ff # define all components#\n",
"Manifold.options.omit_function_arguments=True # output without comp. args\n",
"t.disp() # show the tensor"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Tensor product works with this notations (but the output is very long)."
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [],
"source": [
"#t*t works\n",
"tt = t*t"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
"# tt.disp() -latex code\n",
"# tt[:] very long output after very long time"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"# %display plain\n",
"# tt.disp() # very-very long output"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It is easier to check that the linear operations work:"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\\(\\displaystyle 3 \\, t^{00}_{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{00}_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{00}_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{00}_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{01}_{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{01}_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{01}_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{01}_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{10}_{00} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{10}_{01} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{10}_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{10}_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{11}_{00} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{11}_{01} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{11}_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{11}_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}\\)"
],
"text/latex": [
"$\\displaystyle 3 \\, t^{00}_{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{00}_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{00}_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{00}_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{01}_{00} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{01}_{01} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{01}_{10} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{01}_{11} \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{10}_{00} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{10}_{01} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{10}_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{10}_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{0}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{11}_{00} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{11}_{01} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{0}}\\otimes \\mathrm{d} {x^{1}} + 3 \\, t^{11}_{10} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{0}} + 3 \\, t^{11}_{11} \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\frac{\\partial}{\\partial {x^{1}} }\\otimes \\mathrm{d} {x^{1}}\\otimes \\mathrm{d} {x^{1}}$"
],
"text/plain": [
"3*t0000 ∂/∂x0⊗∂/∂x0⊗dx0⊗dx0 + 3*t0001 ∂/∂x0⊗∂/∂x0⊗dx0⊗dx1 + 3*t0010 ∂/∂x0⊗∂/∂x0⊗dx1⊗dx0 + 3*t0011 ∂/∂x0⊗∂/∂x0⊗dx1⊗dx1 + 3*t0100 ∂/∂x0⊗∂/∂x1⊗dx0⊗dx0 + 3*t0101 ∂/∂x0⊗∂/∂x1⊗dx0⊗dx1 + 3*t0110 ∂/∂x0⊗∂/∂x1⊗dx1⊗dx0 + 3*t0111 ∂/∂x0⊗∂/∂x1⊗dx1⊗dx1 + 3*t1000 ∂/∂x1⊗∂/∂x0⊗dx0⊗dx0 + 3*t1001 ∂/∂x1⊗∂/∂x0⊗dx0⊗dx1 + 3*t1010 ∂/∂x1⊗∂/∂x0⊗dx1⊗dx0 + 3*t1011 ∂/∂x1⊗∂/∂x0⊗dx1⊗dx1 + 3*t1100 ∂/∂x1⊗∂/∂x1⊗dx0⊗dx0 + 3*t1101 ∂/∂x1⊗∂/∂x1⊗dx0⊗dx1 + 3*t1110 ∂/∂x1⊗∂/∂x1⊗dx1⊗dx0 + 3*t1111 ∂/∂x1⊗∂/∂x1⊗dx1⊗dx1"
]
},
"execution_count": 46,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Manifold.options.omit_function_arguments=True # output without comp.args\n",
"(t + 2*t).disp() # show t+2*t"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## What's next?\n",
"\n",
"Take a look at the notebook [Differential k-forms](https://nbviewer.org/github/sagemanifolds/IntroToManifolds/blob/main/14Manifold_Differential_Forms.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
}