 construct an Array that can be indexed to return the values of a tensorial expression - Maple Programming Help

Physics[TensorArray] - construct an Array that can be indexed to return the values of a tensorial expression

 Calling Sequence TensorArray(expression, ...)

Parameters

 expression - any algebraic tensorial expression having spacetime free indices possibly having also repeated indices implying summation freeindices = [...] - optional, the right-hand side is a list indicating the ordering of the free indices in the returned output - relevant when expression involves products and sums of tensors with free indices. performmatrixoperations - optional, can be true or false (default), to perform the matrix operations involved in a tensorial expression, for instance when it involves the Pauli or Dirac matrices, represented as 4-vectors performsumoverrepeatedindices - optional, can be true (default) or false, to perform the sum over repeated tensor indices in the returned result simplifier = ... - optional - indicates the simplifier to be used instead; default is none

Description

 • The TensorArray receives a tensorial expression having n free indices, typically involving sums and products, and returns a corresponding n dimensional Array, which can be indexed as a single object to return the values of the tensorial expression for given values of its free indices.
 • To check and determine the free and repeated indices of an expression use Check.
 • The returned Array is constructed taking into account the covariant and contravariant character of each free index in expression. To compute the values of expression you index this array giving values between 1 and the spacetime dimension to the indices.
 • By default, in the returned result, summation is explicitly performed over all the repeated indices found in expression, taking into account the covariant/contravariant character of each index. To avoid performing this summation and keep repeated indices not summed pass the optional argument performsumoverrepeatedindices = false.
 • Both Pauli and Dirac Matrices, respectively represented by the Psigma and Dgamma commands, are implemented as 4-vectors, where each component represents a matrix. Thus, when computing tensor arrays of components, one can optionally visualize the matrices behind these 4-vector representations and perform the matrix operations if any. For this purpose, pass the optional argument performmatrixoperations
 • By default, the Array is constructed without simplifying its components; to have them simplified indicate the simplifier on the right-hand-side of the optional argument simplifier = .... A frequently convenient simplification is achieved with simplifier = simplify.
 • When expression involves sums and products of tensors having free indices, the ordering of the free indices in the returned Array is arbitrary. To indicated a desired ordering of these free indices, use the option freeindices = [...] where the list [...] indicates the desired ordering.

Examples

 > $\mathrm{with}\left(\mathrm{Physics}\right):$
 > $\mathrm{Setup}\left(\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$ (1)

Set the spacetime metric to be the Schwarzschild metric and construct an Array for the product of the metric tensor g_ contracted and multiplied with an arbitrary tensor $A$  as in ${g}_{\mathrm{\mu },\mathrm{\rho }}{A}_{}^{\mathrm{\rho }}{A}_{\mathrm{\nu }}$ For this purpose, set first the metric and the coordinates -you can use Setup for that, or because the Schwarzschild metric is known to the system you can directly pass the keyword or an abbreviation of it to the metric g_ to do all in one step

 > ${\mathrm{g_}}_{\mathrm{sc}}$
 ${}\mathrm{_______________________________________________________}$
 ${}\mathrm{Systems of spacetime coordinates are:}{}\left\{X=\left(r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right)\right\}$
 ${}\mathrm{Default differentiation variables for d_, D_ and dAlembertian are:}{}\left\{X=\left(r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right)\right\}$
 ${}\mathrm{The Schwarzschild metric in coordinates}{}\left[r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right]$
 $\mathrm{Parameters:}\left[m\right]$
 ${}\mathrm{_______________________________________________________}$
 ${{\mathrm{g_}}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}\left(\left[\begin{array}{cccc}\frac{r}{-r+2{}m}& 0& 0& 0\\ 0& -{r}^{2}& 0& 0\\ 0& 0& -{r}^{2}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}& 0\\ 0& 0& 0& \frac{r-2{}m}{r}\end{array}\right]\right)$ (2)

Define now an arbitrary tensor $A$

 > $\mathrm{Define}\left(A\right)$
 $\mathrm{Defined objects with tensor properties}$
 $\left\{{A}{,}{{▿}}_{{\mathrm{\mu }}}{,}{{\mathrm{\gamma }}}_{{\mathrm{\mu }}}{,}{{\mathrm{\sigma }}}_{{\mathrm{\mu }}}{,}{{R}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{R}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}{,}{\mathrm{\alpha }}{,}{\mathrm{\beta }}}{,}{{C}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}{,}{\mathrm{\alpha }}{,}{\mathrm{\beta }}}{,}{{X}}_{{\mathrm{\mu }}}{,}{{\partial }}_{{\mathrm{\mu }}}{,}{{g}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\Gamma }}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}{,}{\mathrm{\alpha }}}{,}{{G}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}\right\}$ (3)

Construct now the tensorial expression mentioned

 > ${\mathrm{g_}}_{\mathrm{μ},\mathrm{ρ}}{A}_{\mathrm{~rho}}{A}_{\mathrm{ν}}$
 ${{g}}_{{\mathrm{\mu }}{,}{\mathrm{\rho }}}{}{{A}}_{\phantom{{}}\phantom{{\mathrm{\rho }}}}^{\phantom{{}}{\mathrm{\rho }}}{}{{A}}_{{\mathrm{\nu }}}$ (4)

Check the indices

 > $\mathrm{Check}\left(,\mathrm{all}\right)$
 $\mathrm{The repeated indices per term are:}\left[\left\{\mathrm{...}\right\}{,}\left\{\mathrm{...}\right\}{,}\mathrm{...}\right]\mathrm{, the free indices are:}\left\{\mathrm{...}\right\}$
 $\left[\left\{{\mathrm{\rho }}\right\}\right]{,}\left\{{\mathrm{\mu }}{,}{\mathrm{\nu }}\right\}$ (5)

Construct now the tensor-array

 > $T≔\mathrm{TensorArray}\left(\right)$
 $\left[\begin{array}{cccc}\frac{{A}_{1}{}{A}_{\mathrm{~1}}{}r}{-r+2{}m}& \frac{{A}_{2}{}{A}_{\mathrm{~1}}{}r}{-r+2{}m}& \frac{{A}_{3}{}{A}_{\mathrm{~1}}{}r}{-r+2{}m}& \frac{{A}_{4}{}{A}_{\mathrm{~1}}{}r}{-r+2{}m}\\ -{A}_{1}{}{r}^{2}{}{A}_{\mathrm{~2}}& -{A}_{2}{}{r}^{2}{}{A}_{\mathrm{~2}}& -{A}_{3}{}{r}^{2}{}{A}_{\mathrm{~2}}& -{A}_{4}{}{r}^{2}{}{A}_{\mathrm{~2}}\\ -{A}_{1}{}{A}_{\mathrm{~3}}{}{r}^{2}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}& -{A}_{2}{}{A}_{\mathrm{~3}}{}{r}^{2}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}& -{A}_{3}{}{A}_{\mathrm{~3}}{}{r}^{2}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}& -{A}_{4}{}{A}_{\mathrm{~3}}{}{r}^{2}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}\\ -\frac{{A}_{1}{}{A}_{\mathrm{~4}}{}\left(-r+2{}m\right)}{r}& -\frac{{A}_{2}{}{A}_{\mathrm{~4}}{}\left(-r+2{}m\right)}{r}& -\frac{{A}_{3}{}{A}_{\mathrm{~4}}{}\left(-r+2{}m\right)}{r}& -\frac{{A}_{4}{}{A}_{\mathrm{~4}}{}\left(-r+2{}m\right)}{r}\end{array}\right]$ (6)

In the above, the sum over $\mathrm{\rho }$ is performed. With performsumoverrepeatedindices = false the sum is not performed:

 > $\mathrm{TensorArray}\left(,\mathrm{performsumoverrepeatedindices}=\mathrm{false}\right)$
 $\left[\begin{array}{cccc}{\mathrm{g_}}_{1,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{1}& {\mathrm{g_}}_{1,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{2}& {\mathrm{g_}}_{1,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{3}& {\mathrm{g_}}_{1,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{4}\\ {\mathrm{g_}}_{2,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{1}& {\mathrm{g_}}_{2,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{2}& {\mathrm{g_}}_{2,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{3}& {\mathrm{g_}}_{2,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{4}\\ {\mathrm{g_}}_{3,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{1}& {\mathrm{g_}}_{3,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{2}& {\mathrm{g_}}_{3,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{3}& {\mathrm{g_}}_{3,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{4}\\ {\mathrm{g_}}_{4,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{1}& {\mathrm{g_}}_{4,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{2}& {\mathrm{g_}}_{4,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{3}& {\mathrm{g_}}_{4,\mathrm{ρ}}{}{A}_{\mathrm{~rho}}{}{A}_{4}\end{array}\right]$ (7)

Also, in (6) the ordering of the free indices $\mathrm{\mu },\mathrm{\nu }$ is not defined. In the computations above, TensorArray choose the ordering $\left[\mathrm{\mu },\mathrm{\nu }\right]$ but one may prefer, for instance, $\left[\mathrm{\nu },\mathrm{\mu }\right]$, resulting in the transpose of the matrix (8). To indicate any desired ordering you can use the optional argument freeindices = [...]

 > $T≔\mathrm{TensorArray}\left(,\mathrm{freeindices}=\left[\mathrm{ν},\mathrm{μ}\right]\right)$
 $\left[\begin{array}{cccc}\frac{{A}_{1}{}{A}_{\mathrm{~1}}{}r}{-r+2{}m}& -{A}_{1}{}{r}^{2}{}{A}_{\mathrm{~2}}& -{A}_{1}{}{A}_{\mathrm{~3}}{}{r}^{2}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}& -\frac{{A}_{1}{}{A}_{\mathrm{~4}}{}\left(-r+2{}m\right)}{r}\\ \frac{{A}_{2}{}{A}_{\mathrm{~1}}{}r}{-r+2{}m}& -{A}_{2}{}{r}^{2}{}{A}_{\mathrm{~2}}& -{A}_{2}{}{A}_{\mathrm{~3}}{}{r}^{2}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}& -\frac{{A}_{2}{}{A}_{\mathrm{~4}}{}\left(-r+2{}m\right)}{r}\\ \frac{{A}_{3}{}{A}_{\mathrm{~1}}{}r}{-r+2{}m}& -{A}_{3}{}{r}^{2}{}{A}_{\mathrm{~2}}& -{A}_{3}{}{A}_{\mathrm{~3}}{}{r}^{2}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}& -\frac{{A}_{3}{}{A}_{\mathrm{~4}}{}\left(-r+2{}m\right)}{r}\\ \frac{{A}_{4}{}{A}_{\mathrm{~1}}{}r}{-r+2{}m}& -{A}_{4}{}{r}^{2}{}{A}_{\mathrm{~2}}& -{A}_{4}{}{A}_{\mathrm{~3}}{}{r}^{2}{}{\mathrm{sin}{}\left(\mathrm{θ}\right)}^{2}& -\frac{{A}_{4}{}{A}_{\mathrm{~4}}{}\left(-r+2{}m\right)}{r}\end{array}\right]$ (8)

Rewrite the Riemann tensor with all its indices covariant in terms of Christoffel symbols and their derivatives and construct a tensor-array for the resulting tensorial expression; in view of the presence of trigonometric functions, use the simplifier option

 > ${\mathrm{Riemann}}_{\mathrm{μ},\mathrm{ν},\mathrm{α},\mathrm{β}}$
 ${{R}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}$ (9)
 > $\mathrm{convert}\left(,\mathrm{Christoffel}\right)$
 ${{g}}_{{\mathrm{\alpha }}{,}{\mathrm{\lambda }}}{}\left({{\partial }}_{{\mathrm{\mu }}}{}\left({{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\lambda }}}{\mathrm{\beta }}{,}{\mathrm{\nu }}}^{\phantom{{}}{\mathrm{\lambda }}\phantom{{\mathrm{\beta }}{,}{\mathrm{\nu }}}}\right){-}{{\partial }}_{{\mathrm{\nu }}}{}\left({{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\lambda }}}{\mathrm{\beta }}{,}{\mathrm{\mu }}}^{\phantom{{}}{\mathrm{\lambda }}\phantom{{\mathrm{\beta }}{,}{\mathrm{\mu }}}}\right){+}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\lambda }}}{\mathrm{\mu }}{,}{\mathrm{\upsilon }}}^{\phantom{{}}{\mathrm{\lambda }}\phantom{{\mathrm{\mu }}{,}{\mathrm{\upsilon }}}}{}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\upsilon }}}{\mathrm{\beta }}{,}{\mathrm{\nu }}}^{\phantom{{}}{\mathrm{\upsilon }}\phantom{{\mathrm{\beta }}{,}{\mathrm{\nu }}}}{-}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\lambda }}}{\mathrm{\nu }}{,}{\mathrm{\upsilon }}}^{\phantom{{}}{\mathrm{\lambda }}\phantom{{\mathrm{\nu }}{,}{\mathrm{\upsilon }}}}{}{{\mathrm{\Gamma }}}_{\phantom{{}}\phantom{{\mathrm{\upsilon }}}{\mathrm{\beta }}{,}{\mathrm{\mu }}}^{\phantom{{}}{\mathrm{\upsilon }}\phantom{{\mathrm{\beta }}{,}{\mathrm{\mu }}}}\right)$ (10)
 > $R≔\mathrm{TensorArray}\left(,\mathrm{simplifier}=\mathrm{simplify}\right)$
 ${{\mathrm{_rtable}}}_{{18446884251904522710}}$ (11)

Verify the result comparing $R$, constructed with the definition of Riemann in terms of Christoffel symbols, with the Riemann tensor itself

 > ${R}_{1,3,1,3}$
 ${-}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{m}}{{-}{r}{+}{2}{}{m}}$ (12)
 > ${\mathrm{Riemann}}_{1,3,1,3}$
 ${-}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{m}}{{-}{r}{+}{2}{}{m}}$ (13)

Compare all the nonzero values of the two arrays: for Riemann, pass the option nonzero, for $R$ use ArrayElems; all the nonzero components are same:

 > ${\mathrm{Riemann}}_{\mathrm{nonzero}}$
 ${{R}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{=}\left\{\left({1}{,}{2}{,}{1}{,}{2}\right){=}{-}\frac{{m}}{{-}{r}{+}{2}{}{m}}{,}\left({1}{,}{2}{,}{2}{,}{1}\right){=}\frac{{m}}{{-}{r}{+}{2}{}{m}}{,}\left({1}{,}{3}{,}{1}{,}{3}\right){=}{-}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{m}}{{-}{r}{+}{2}{}{m}}{,}\left({1}{,}{3}{,}{3}{,}{1}\right){=}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{m}}{{-}{r}{+}{2}{}{m}}{,}\left({1}{,}{4}{,}{1}{,}{4}\right){=}\frac{{2}{}{m}}{{{r}}^{{3}}}{,}\left({1}{,}{4}{,}{4}{,}{1}\right){=}{-}\frac{{2}{}{m}}{{{r}}^{{3}}}{,}\left({2}{,}{1}{,}{1}{,}{2}\right){=}\frac{{m}}{{-}{r}{+}{2}{}{m}}{,}\left({2}{,}{1}{,}{2}{,}{1}\right){=}{-}\frac{{m}}{{-}{r}{+}{2}{}{m}}{,}\left({2}{,}{3}{,}{2}{,}{3}\right){=}{-}{2}{}{r}{}{m}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{,}\left({2}{,}{3}{,}{3}{,}{2}\right){=}{2}{}{r}{}{m}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{,}\left({2}{,}{4}{,}{2}{,}{4}\right){=}\frac{\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}{,}\left({2}{,}{4}{,}{4}{,}{2}\right){=}\frac{{-}{2}{}{{m}}^{{2}}{+}{m}{}{r}}{{{r}}^{{2}}}{,}\left({3}{,}{1}{,}{1}{,}{3}\right){=}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{m}}{{-}{r}{+}{2}{}{m}}{,}\left({3}{,}{1}{,}{3}{,}{1}\right){=}{-}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{m}}{{-}{r}{+}{2}{}{m}}{,}\left({3}{,}{2}{,}{2}{,}{3}\right){=}{2}{}{r}{}{m}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{,}\left({3}{,}{2}{,}{3}{,}{2}\right){=}{-}{2}{}{r}{}{m}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{,}\left({3}{,}{4}{,}{3}{,}{4}\right){=}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}{,}\left({3}{,}{4}{,}{4}{,}{3}\right){=}{-}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}{,}\left({4}{,}{1}{,}{1}{,}{4}\right){=}{-}\frac{{2}{}{m}}{{{r}}^{{3}}}{,}\left({4}{,}{1}{,}{4}{,}{1}\right){=}\frac{{2}{}{m}}{{{r}}^{{3}}}{,}\left({4}{,}{2}{,}{2}{,}{4}\right){=}\frac{{-}{2}{}{{m}}^{{2}}{+}{m}{}{r}}{{{r}}^{{2}}}{,}\left({4}{,}{2}{,}{4}{,}{2}\right){=}\frac{\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}{,}\left({4}{,}{3}{,}{3}{,}{4}\right){=}{-}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}{,}\left({4}{,}{3}{,}{4}{,}{3}\right){=}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}\right\}$ (14)
 > $\mathrm{ArrayElems}\left(R\right)$
 $\left\{\left({1}{,}{2}{,}{1}{,}{2}\right){=}{-}\frac{{m}}{{-}{r}{+}{2}{}{m}}{,}\left({1}{,}{2}{,}{2}{,}{1}\right){=}\frac{{m}}{{-}{r}{+}{2}{}{m}}{,}\left({1}{,}{3}{,}{1}{,}{3}\right){=}{-}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{m}}{{-}{r}{+}{2}{}{m}}{,}\left({1}{,}{3}{,}{3}{,}{1}\right){=}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{m}}{{-}{r}{+}{2}{}{m}}{,}\left({1}{,}{4}{,}{1}{,}{4}\right){=}\frac{{2}{}{m}}{{{r}}^{{3}}}{,}\left({1}{,}{4}{,}{4}{,}{1}\right){=}{-}\frac{{2}{}{m}}{{{r}}^{{3}}}{,}\left({2}{,}{1}{,}{1}{,}{2}\right){=}\frac{{m}}{{-}{r}{+}{2}{}{m}}{,}\left({2}{,}{1}{,}{2}{,}{1}\right){=}{-}\frac{{m}}{{-}{r}{+}{2}{}{m}}{,}\left({2}{,}{3}{,}{2}{,}{3}\right){=}{-}{2}{}{r}{}{m}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{,}\left({2}{,}{3}{,}{3}{,}{2}\right){=}{2}{}{r}{}{m}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{,}\left({2}{,}{4}{,}{2}{,}{4}\right){=}\frac{\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}{,}\left({2}{,}{4}{,}{4}{,}{2}\right){=}\frac{{-}{2}{}{{m}}^{{2}}{+}{m}{}{r}}{{{r}}^{{2}}}{,}\left({3}{,}{1}{,}{1}{,}{3}\right){=}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{m}}{{-}{r}{+}{2}{}{m}}{,}\left({3}{,}{1}{,}{3}{,}{1}\right){=}{-}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{m}}{{-}{r}{+}{2}{}{m}}{,}\left({3}{,}{2}{,}{2}{,}{3}\right){=}{2}{}{r}{}{m}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{,}\left({3}{,}{2}{,}{3}{,}{2}\right){=}{-}{2}{}{r}{}{m}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{,}\left({3}{,}{4}{,}{3}{,}{4}\right){=}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}{,}\left({3}{,}{4}{,}{4}{,}{3}\right){=}{-}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}{,}\left({4}{,}{1}{,}{1}{,}{4}\right){=}{-}\frac{{2}{}{m}}{{{r}}^{{3}}}{,}\left({4}{,}{1}{,}{4}{,}{1}\right){=}\frac{{2}{}{m}}{{{r}}^{{3}}}{,}\left({4}{,}{2}{,}{2}{,}{4}\right){=}\frac{{-}{2}{}{{m}}^{{2}}{+}{m}{}{r}}{{{r}}^{{2}}}{,}\left({4}{,}{2}{,}{4}{,}{2}\right){=}\frac{\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}{,}\left({4}{,}{3}{,}{3}{,}{4}\right){=}{-}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}{,}\left({4}{,}{3}{,}{4}{,}{3}\right){=}\frac{{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}\left({-}{r}{+}{2}{}{m}\right){}{m}}{{{r}}^{{2}}}\right\}$ (15)
 > $\mathrm{evalb}\left(\mathrm{simplify}\left(\mathrm{rhs}\left(\right)=\right)\right)$
 ${\mathrm{true}}$ (16)

A contraction of the Riemann tensor over two of its indices

 > ${\mathrm{Riemann}}_{\mathrm{α},\mathrm{β},\mathrm{μ},\mathrm{ν}}{\mathrm{Riemann}}_{\mathrm{~alpha},\mathrm{~beta},\mathrm{~nu},\mathrm{~sigma}}$
 ${{R}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{}{{R}}_{\phantom{{}}\phantom{{\mathrm{\alpha }}}\phantom{{,}}\phantom{{\mathrm{\beta }}}\phantom{{,}}\phantom{{\mathrm{\nu }}}\phantom{{,}}\phantom{{\mathrm{\sigma }}}}^{\phantom{{}}{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\nu }}{,}{\mathrm{\sigma }}}$ (17)
 > $\mathrm{Check}\left(,\mathrm{all}\right)$
 $\mathrm{The repeated indices per term are:}\left[\left\{\mathrm{...}\right\}{,}\left\{\mathrm{...}\right\}{,}\mathrm{...}\right]\mathrm{, the free indices are:}\left\{\mathrm{...}\right\}$
 $\left[\left\{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\nu }}\right\}\right]{,}\left\{{\mathrm{\mu }}{,}{\mathrm{~sigma}}\right\}$ (18)
 > $\mathrm{TensorArray}\left(,\mathrm{simplifier}=\mathrm{simplify}\right)$
 $\left[\begin{array}{cccc}-\frac{12{}{m}^{2}}{{r}^{6}}& 0& 0& 0\\ 0& -\frac{12{}{m}^{2}}{{r}^{6}}& 0& 0\\ 0& 0& -\frac{12{}{m}^{2}}{{r}^{6}}& 0\\ 0& 0& 0& -\frac{12{}{m}^{2}}{{r}^{6}}\end{array}\right]$ (19)

When Physics is loaded, the standard representation of the Dirac matrices is automatically set. These matrices, as Pauli matrices, are implemented as 4-vectors in a Minkowski spacetime

 > $\mathrm{Setup}\left(\mathrm{coordinates}=\mathrm{cartesian},\mathrm{metric}=\mathrm{minkowski},\mathrm{spaceindices}=\mathrm{lowercaselatin}\right)$
 ${}\mathrm{Default differentiation variables for d_, D_ and dAlembertian are:}{}\left\{X=\left(x{,}y{,}z{,}t\right)\right\}$
 ${}\mathrm{Systems of spacetime coordinates are:}{}\left\{X=\left(x{,}y{,}z{,}t\right)\right\}$
 ${}\mathrm{_______________________________________________________}$
 ${}\mathrm{The Minkowski metric in coordinates}{}\left[x{,}y{,}z{,}t\right]$
 ${}\mathrm{_______________________________________________________}$
 $\mathrm{_______________________________________________________}$
 $\left[{\mathrm{coordinatesystems}}{=}\left\{{X}\right\}{,}{\mathrm{metric}}{=}\left\{\left({1}{,}{1}\right){=}{-1}{,}\left({2}{,}{2}\right){=}{-1}{,}\left({3}{,}{3}\right){=}{-1}{,}\left({4}{,}{4}\right){=}{1}\right\}{,}{\mathrm{spaceindices}}{=}{\mathrm{lowercaselatin}}\right]$ (20)
 > ${\mathrm{g_}}_{[]}$
 ${{\mathrm{g_}}}_{{\mathrm{μ}}{,}{\mathrm{ν}}}{=}\left(\left[\begin{array}{rrrr}-1& 0& 0& 0\\ 0& -1& 0& 0\\ 0& 0& -1& 0\\ 0& 0& 0& 1\end{array}\right]\right)$ (21)
 > ${\mathrm{Psigma}}_{\mathrm{definition}}$
 ${\mathrm{%Commutator}}{}\left({{\mathrm{Psigma}}}_{{a}}{,}{{\mathrm{Psigma}}}_{{b}}\right){=}{2}{}{I}{}{{\mathrm{\epsilon }}}_{{a}{,}{b}\phantom{{c}}}^{\phantom{{a}}\phantom{{,}{b}}{c}}{}{{\mathrm{\sigma }}}_{{c}}{,}{\mathrm{%AntiCommutator}}{}\left({{\mathrm{Psigma}}}_{{a}}{,}{{\mathrm{Psigma}}}_{{b}}\right){=}{-}{2}{}{{g}}_{{a}{,}{b}}$ (22)

The components of the first of these equations are

 > $\mathrm{TensorArray}\left({1}_{}\right)$
 $\left[\begin{array}{ccc}\mathrm{%Commutator}{}\left({\mathrm{Psigma}}_{1},{\mathrm{Psigma}}_{1}\right)=0& \mathrm{%Commutator}{}\left({\mathrm{Psigma}}_{1},{\mathrm{Psigma}}_{2}\right)=2{}I{}{\mathrm{Psigma}}_{3}& \mathrm{%Commutator}{}\left({\mathrm{Psigma}}_{1},{\mathrm{Psigma}}_{3}\right)=-2{}I{}{\mathrm{Psigma}}_{2}\\ \mathrm{%Commutator}{}\left({\mathrm{Psigma}}_{2},{\mathrm{Psigma}}_{1}\right)=-2{}I{}{\mathrm{Psigma}}_{3}& \mathrm{%Commutator}{}\left({\mathrm{Psigma}}_{2},{\mathrm{Psigma}}_{2}\right)=0& \mathrm{%Commutator}{}\left({\mathrm{Psigma}}_{2},{\mathrm{Psigma}}_{3}\right)=2{}I{}{\mathrm{Psigma}}_{1}\\ \mathrm{%Commutator}{}\left({\mathrm{Psigma}}_{3},{\mathrm{Psigma}}_{1}\right)=2{}I{}{\mathrm{Psigma}}_{2}& \mathrm{%Commutator}{}\left({\mathrm{Psigma}}_{3},{\mathrm{Psigma}}_{2}\right)=-2{}I{}{\mathrm{Psigma}}_{1}& \mathrm{%Commutator}{}\left({\mathrm{Psigma}}_{3},{\mathrm{Psigma}}_{3}\right)=0\end{array}\right]$ (23)

In the above the commutators are expressed in inert form. To perform the matrix operations involved in these components you can use performmatrixoperations together with value to activate the inert commutators.

 > $\mathrm{value}\left(\mathrm{TensorArray}\left({1}_{},\mathrm{performmatrixoperations}\right)\right)$
 $\left[\begin{array}{ccc}\left(\left[\begin{array}{rr}0& 0\\ 0& 0\end{array}\right]\right)=\left(\left[\begin{array}{rr}0& 0\\ 0& 0\end{array}\right]\right)& \left(\left[\begin{array}{cc}2{}I& 0\\ 0& -2{}I\end{array}\right]\right)=\left(\left[\begin{array}{cc}2{}I& 0\\ 0& -2{}I\end{array}\right]\right)& \left(\left[\begin{array}{rr}0& -2\\ 2& 0\end{array}\right]\right)=\left(\left[\begin{array}{rr}0& -2\\ 2& 0\end{array}\right]\right)\\ \left(\left[\begin{array}{cc}-2{}I& 0\\ 0& 2{}I\end{array}\right]\right)=\left(\left[\begin{array}{cc}-2{}I& 0\\ 0& 2{}I\end{array}\right]\right)& \left(\left[\begin{array}{rr}0& 0\\ 0& 0\end{array}\right]\right)=\left(\left[\begin{array}{rr}0& 0\\ 0& 0\end{array}\right]\right)& \left(\left[\begin{array}{cc}0& 2{}I\\ 2{}I& 0\end{array}\right]\right)=\left(\left[\begin{array}{cc}0& 2{}I\\ 2{}I& 0\end{array}\right]\right)\\ \left(\left[\begin{array}{rr}0& 2\\ -2& 0\end{array}\right]\right)=\left(\left[\begin{array}{rr}0& 2\\ -2& 0\end{array}\right]\right)& \left(\left[\begin{array}{cc}0& -2{}I\\ -2{}I& 0\end{array}\right]\right)=\left(\left[\begin{array}{cc}0& -2{}I\\ -2{}I& 0\end{array}\right]\right)& \left(\left[\begin{array}{rr}0& 0\\ 0& 0\end{array}\right]\right)=\left(\left[\begin{array}{rr}0& 0\\ 0& 0\end{array}\right]\right)\end{array}\right]$ (24)
 > 

References

 Landau, L.D., and Lifshitz, E.M. The Classical Theory of Fields, Course of Theoretical Physics Volume 2, fourth revised English edition. Elsevier, 1975.

Compatibility

 • The Physics[TensorArray] command was introduced in Maple 16.