transform the coordinates in a tensorial expression - Maple Programming Help

Physics[TransformCoordinates] - transform the coordinates in a tensorial expression

 Calling Sequence TransformCoordinates(tr, expression, X_new, X_old, ...)

Parameters

 tr - the transformation equations with the old variables on the left-hand-sides and algebraic expressions involving the new variables X_new on the right-hand-sides, or the other way around expression - any algebraic expression that can also tensorial, having free indices X_new - optional, an ordered list with the new coordinates, it is however required when they are not related to a system of coordinates set with Coordinates or there is ambiguity regarding the transformation being from old to new or the other way around X_old - optional, same as X_new; if given, then X_new must also be given before output = line_element - optional, to request the output to be the spacetime line element when expression is the spacetime metric performsumoverrepeatedindices - optional, can be true (default) or false, to perform the sum over repeated tensor indices in the returned result setcoordinates = ... - optional - can be true or false (default), to automatically set the X_new as a coordinate system and also as the differentiation variables for d_, D_ and others setmetric = ... - optional - can be true or false (default), when expression is the metric, to automatically set the transformed metric as the new metric simplifier = ... - optional - indicates the simplifier to be used instead of the default $\mathrm{simplify/size}@\mathrm{simplify}$

Description

 • The TransformCoordinates, performs a transformation of coordinates in an algebraic expression that is also tensorial, i.e. one that has free and/or repeated spacetime indices that are either covariant or contravariant (see Check to determine the indices).
 • The transformation performed with TransformCoordinates is the standard one for tensors. Consider for instance a transformation from one coordinate system, ${x}_{}^{0},{x}_{}^{1},{x}_{}^{2},{x}_{}^{3}$ to another ${y}_{}^{0},{y}_{}^{1},{y}_{}^{2},{y}_{}^{3}$

${x}_{}^{\mathrm{\mu }}={f}_{}^{\mathrm{\mu }}\left({y}_{}^{0},{y}_{}^{1},{y}_{}^{2},{y}_{}^{3}\right)$

 where the ${f}_{}^{\mathrm{\mu }}$ are certain functions. When you transform the coordinates, every contravariant tensor of one index, say ${A}_{}^{\mathrm{\mu }}\left(x\right)$, a vector, transforms into a contravariant ${A}_{}^{\mathrm{\mu }}\left(y\right)$ in the new system of coordinates according to

${A}_{}^{\mathrm{\mu }}\left(y\right)=\frac{\partial {y}_{}^{\mathrm{\mu }}}{\partial {x}_{}^{\mathrm{\nu }}}{A}_{}^{\mathrm{\nu }}\left(x\right)$

 and every covariant vector transforms according to

${A}_{\mathrm{\mu }}\left(y\right)=\frac{\partial {x}_{}^{\mathrm{\nu }}}{\partial {y}_{}^{\mathrm{\mu }}}{A}_{\mathrm{\nu }}\left(x\right)$

 and in the case of more than one index, for each contravariant or covariant index there is a factor as in the corresponding right-hand-sides of these formulas.
 • CAVEAT: in curvilinear coordinates, none of the Christoffel symbols, the noncovariant d_ operator and the SpaceTimeVector ${X}^{\mathrm{\mu }}$ are tensors, even when the algebraic manipulation of their indices is done as if they were. This version of TransformCoordinates does not transform coordinates on these objects.
 • When the given tr is from the old variables - say ${x}_{}^{\mathrm{\mu }}$ - on the left-hand-sides of the transformation equations to the new variables - say ${y}_{}^{\mathrm{\mu }}$ - on the right-hand-sides, as in the previous item, the output is entirely expressed in terms of the new coordinates ${y}_{}^{\mathrm{\mu }}$. This is accomplished in two steps:
 1 in the given expression, change variables from the old ones $x$ to the new ones $y$ to get everything expressed in terms of $y$ (see dchange)
 2 transform the resulting tensorial expression expressed in terms of $y$ regarding each of its free indices (i.e.: multiply by the appropriate factors mentioned, $\frac{\partial {y}_{}^{\mathrm{\mu }}}{\partial {x}_{}^{\mathrm{\nu }}}$ or $\frac{\partial {x}_{}^{\mathrm{\nu }}}{\partial {y}_{}^{\mathrm{\mu }}}$ and sum over the corresponding repeated indices)
 The result represents the tensorial expression in the new coordinate system, expressed in terms of the new coordinates.
 • It frequently happens, however, that the transformation can only be expressed in simple form if it is from the new variables on the left-hand-sides to the old variables on the right-hand-sides. You can pass the transformation tr in this way too, in which case you need to also pass the two lists X_new and X_old respectively as third and fourth arguments. The result will then be the tensor in the new coordinate system, entirely expressed in terms of the coordinates ${x}_{}^{\mathrm{\mu }}$ of the old system, .
 • The output of TransformCoordinates is an Array with dimension equal to the number of free indices of expression. In the special cases where the number of indices is 2 or 1, instead of an Array, the result is respectively expressed as a Matrix or a column Vector. In all cases, giving values to these indices you retrieve each of the components of the tensorial expression in the new coordinate system, entirely expressed in terms of the new coordinates X_new whenever the given transformation is from the old to the new variables (see the two previous paragraphs).
 • The transformation can be given as an equation or a set or list of them, and does not need to include equations for all the coordinates - for instance: some may not be changing. Also, because the transformation of coordinates is equivalent to a change of the system of reference, it is possible to continue using the same geometrical coordinates (same names representing the coordinates in both systems) so that the right-hand-sides of the transformation equations can involve the list of X_new variables, even if they are the same as the old ones, for instance as in transforming [t = -t], performed by TransformCoordinates in two steps: transform $t=-\mathrm{\tau }$ then evaluate at $\mathrm{\tau }=t$.
 • You can retrieve all the nonzero components of the transformed expression at once by passing the output of TransformCoordinates to the ArrayElems command.
 • When expression is the spacetime metric g_[mu,nu], you can optionally request the output to be the corresponding line element passing output = line_element instead of a Matrix.
 • By default, when change variables in the metric (i.e. expression is the metric itself), the transformed metric is not automatically set as the new metric. To change this behavior, pass the optional argument setmetric, in which case a call to Setup with metric = ... transformed metric ..., coordinates = ... new coordinates ... will be automatically performed before returning the result.
 • By default, the new variables are not set as a coordinate system (when they are not already) nor they are set as the differentiation variables. To change this behavior, pass the optional argument setcoordinates. If not given, the default value of this option is false, unless you pass the option setmetric in which case the new variables are set as a coordinate system and as new differentiation variables together with the metric g_. When the new variables are not already set as a coordinate system, the label used for the new variables will always be the label originally used for the old variables.
 • 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.
 • By default, all the components of the returned result are simplified as in u -> simplify(simplify(u), size). This frequently results in a desired form. You can change the simplifier to be any other one by indicating it on the right-hand-side of the optional argument simplifier = ....

Examples

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

Consider the general form of a transformation of coordinates tr, from $X$ to $Y$, and its inverse itr from $Y$ to $X$, expressed in terms of 8 arbitrary functions $\mathrm{X1}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right),\mathrm{...},\mathrm{Y4}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)$

 > $\mathrm{Coordinates}\left(X,Y\right)$
 ${}\mathrm{Default differentiation variables for d_, D_ and dAlembertian are:}{}\left\{X=\left(\mathrm{x1}{,}\mathrm{x2}{,}\mathrm{x3}{,}\mathrm{x4}\right)\right\}$
 ${}\mathrm{Systems of spacetime coordinates are:}{}\left\{X=\left(\mathrm{x1}{,}\mathrm{x2}{,}\mathrm{x3}{,}\mathrm{x4}\right){,}Y=\left(\mathrm{y1}{,}\mathrm{y2}{,}\mathrm{y3}{,}\mathrm{y4}\right)\right\}$
 $\left\{{X}{,}{Y}\right\}$ (2)
 > $\mathrm{tr}≔\left[\mathrm{x1}=\mathrm{X1}\left(Y\right),\mathrm{x2}=\mathrm{X2}\left(Y\right),\mathrm{x3}=\mathrm{X3}\left(Y\right),\mathrm{x4}=\mathrm{X4}\left(Y\right)\right]$
 ${\mathrm{tr}}{≔}\left[{\mathrm{x1}}{=}{\mathrm{X1}}{}\left({Y}\right){,}{\mathrm{x2}}{=}{\mathrm{X2}}{}\left({Y}\right){,}{\mathrm{x3}}{=}{\mathrm{X3}}{}\left({Y}\right){,}{\mathrm{x4}}{=}{\mathrm{X4}}{}\left({Y}\right)\right]$ (3)
 > $\mathrm{itr}≔\left[\mathrm{y1}=\mathrm{Y1}\left(X\right),\mathrm{y2}=\mathrm{Y2}\left(X\right),\mathrm{y3}=\mathrm{Y3}\left(X\right),\mathrm{y4}=\mathrm{Y4}\left(X\right)\right]$
 ${\mathrm{itr}}{≔}\left[{\mathrm{y1}}{=}{\mathrm{Y1}}{}\left({X}\right){,}{\mathrm{y2}}{=}{\mathrm{Y2}}{}\left({X}\right){,}{\mathrm{y3}}{=}{\mathrm{Y3}}{}\left({X}\right){,}{\mathrm{y4}}{=}{\mathrm{Y4}}{}\left({X}\right)\right]$ (4)

For readability, suppress the display of functionality in these 8 functions

 > $\mathrm{Typesetting}:-\mathrm{Suppress}\left(\mathrm{map}\left(\mathrm{rhs},\mathrm{tr}\right)\right)$
 > $\mathrm{Typesetting}:-\mathrm{Suppress}\left(\mathrm{map}\left(\mathrm{rhs},\mathrm{itr}\right)\right)$

The covariant components of a vector $A$ transform  according to

 > $\mathrm{Define}\left(A\right)$
 $\mathrm{Defined objects with tensor properties}$
 $\left\{{A}{,}{{\mathrm{\gamma }}}_{{\mathrm{\mu }}}{,}{{\mathrm{\sigma }}}_{{\mathrm{\mu }}}{,}{{\partial }}_{{\mathrm{\mu }}}{,}{{g}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{,}{{X}}_{{\mathrm{\mu }}}{,}{{Y}}_{{\mathrm{\mu }}}\right\}$ (5)
 > $A\left[\mathrm{\mu }\right]$
 ${{A}}_{{\mathrm{\mu }}}$ (6)
 > $\mathrm{TransformCoordinates}\left(\mathrm{tr},\right)$
 $\left[\begin{array}{c}\left(\frac{\partial }{\partial \mathrm{y1}}{}\mathrm{X1}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{1}+\left(\frac{\partial }{\partial \mathrm{y1}}{}\mathrm{X2}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{2}+\left(\frac{\partial }{\partial \mathrm{y1}}{}\mathrm{X3}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{3}+\left(\frac{\partial }{\partial \mathrm{y1}}{}\mathrm{X4}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{4}\\ \left(\frac{\partial }{\partial \mathrm{y2}}{}\mathrm{X1}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{1}+\left(\frac{\partial }{\partial \mathrm{y2}}{}\mathrm{X2}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{2}+\left(\frac{\partial }{\partial \mathrm{y2}}{}\mathrm{X3}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{3}+\left(\frac{\partial }{\partial \mathrm{y2}}{}\mathrm{X4}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{4}\\ \left(\frac{\partial }{\partial \mathrm{y3}}{}\mathrm{X1}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{1}+\left(\frac{\partial }{\partial \mathrm{y3}}{}\mathrm{X2}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{2}+\left(\frac{\partial }{\partial \mathrm{y3}}{}\mathrm{X3}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{3}+\left(\frac{\partial }{\partial \mathrm{y3}}{}\mathrm{X4}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{4}\\ \left(\frac{\partial }{\partial \mathrm{y4}}{}\mathrm{X1}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{1}+\left(\frac{\partial }{\partial \mathrm{y4}}{}\mathrm{X2}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{2}+\left(\frac{\partial }{\partial \mathrm{y4}}{}\mathrm{X3}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{3}+\left(\frac{\partial }{\partial \mathrm{y4}}{}\mathrm{X4}{}\left(\mathrm{y1},\mathrm{y2},\mathrm{y3},\mathrm{y4}\right)\right){}{A}_{4}\end{array}\right]$ (7)

For the contravariant components of $A$ one can replace A[mu] by A[~mu] in the above. In that way, however, the new components will involve the inverse of the Jacobian of the transformation, resulting in a correct but rather large algebraic expression, due to the generality of the transformation tr. In such a case it is more convenient to use a transformation from the new to the old variables, as itr:

 > $A\left[\mathrm{~mu}\right]$
 ${{A}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}$ (8)
 > $\mathrm{TransformCoordinates}\left(\mathrm{itr},\right)$
 $\left[\begin{array}{c}\left(\frac{\partial }{\partial \mathrm{x1}}{}\mathrm{Y1}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~1}}+\left(\frac{\partial }{\partial \mathrm{x2}}{}\mathrm{Y1}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~2}}+\left(\frac{\partial }{\partial \mathrm{x3}}{}\mathrm{Y1}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~3}}+\left(\frac{\partial }{\partial \mathrm{x4}}{}\mathrm{Y1}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~4}}\\ \left(\frac{\partial }{\partial \mathrm{x1}}{}\mathrm{Y2}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~1}}+\left(\frac{\partial }{\partial \mathrm{x2}}{}\mathrm{Y2}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~2}}+\left(\frac{\partial }{\partial \mathrm{x3}}{}\mathrm{Y2}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~3}}+\left(\frac{\partial }{\partial \mathrm{x4}}{}\mathrm{Y2}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~4}}\\ \left(\frac{\partial }{\partial \mathrm{x1}}{}\mathrm{Y3}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~1}}+\left(\frac{\partial }{\partial \mathrm{x2}}{}\mathrm{Y3}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~2}}+\left(\frac{\partial }{\partial \mathrm{x3}}{}\mathrm{Y3}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~3}}+\left(\frac{\partial }{\partial \mathrm{x4}}{}\mathrm{Y3}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~4}}\\ \left(\frac{\partial }{\partial \mathrm{x1}}{}\mathrm{Y4}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~1}}+\left(\frac{\partial }{\partial \mathrm{x2}}{}\mathrm{Y4}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~2}}+\left(\frac{\partial }{\partial \mathrm{x3}}{}\mathrm{Y4}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~3}}+\left(\frac{\partial }{\partial \mathrm{x4}}{}\mathrm{Y4}{}\left(\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}\right)\right){}{A}_{\mathrm{~4}}\end{array}\right]$ (9)

Verify that the transformation

 > $\mathrm{TR}≔r={\left(1+\frac{m}{2\mathrm{\rho }}\right)}^{2}\mathrm{\rho }$
 ${\mathrm{TR}}{≔}{r}{=}{\left({1}{+}\frac{{m}}{{2}{}{\mathrm{\rho }}}\right)}^{{2}}{}{\mathrm{\rho }}$ (10)

transforms the line element of the Schwarzschild metric into one where the line element of spatial distance has conformal euclidean form, i.e.: it is proportional to the euclidean spatial line element in spherical coordinates, ${\partial \left(\mathrm{\rho }\right)}^{2}+{\mathrm{\rho }}^{2}\left({\partial \left(\mathrm{\theta }\right)}^{2}+{\mathrm{sin}\left(\mathrm{\theta }\right)}^{2}{\partial \left(\mathrm{\phi }\right)}^{2}\right)$.

Set first the metric to be the Schwarzschild metric and the coordinates to be spherical. For that purpose you can use Setup, Coordinates or because Schwarzschild's metric is known to the system you can directly pass the keyword or an abbreviation of it to the metric g_ itself to do all in one step

 > $\mathrm{g_}\left[\mathrm{sc}\right]$
 ${}\mathrm{_______________________________________________________}$
 ${}\mathrm{Systems of spacetime coordinates are:}{}\left\{X=\left(r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right){,}Y=\left(\mathrm{y1}{,}\mathrm{y2}{,}\mathrm{y3}{,}\mathrm{y4}\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)$ (11)

Transform the coordinates in this metric using the transformation TR. Because the new variables were not set using Coordinates, indicate them as $\left[\mathrm{\rho },\mathrm{\theta },\mathrm{\phi },t\right]$; request the output to be the corresponding line element:

 > $\mathrm{TransformCoordinates}\left(\mathrm{TR},\mathrm{g_}\left[\mathrm{\mu },\mathrm{\nu }\right],\left[\mathrm{\rho },\mathrm{\theta },\mathrm{\phi },t\right],\mathrm{output}=\mathrm{lineelement}\right)$
 ${-}\frac{{1}}{{16}}{}\frac{{\left({2}{}{\mathrm{ρ}}{+}{m}\right)}^{{4}}{}\left({{\mathrm{%d_}}{}\left({\mathrm{ρ}}\right)}^{{2}}{+}\left({{\mathrm{sin}}{}\left({\mathrm{θ}}\right)}^{{2}}{}{{\mathrm{%d_}}{}\left({\mathrm{φ}}\right)}^{{2}}{+}{{\mathrm{%d_}}{}\left({\mathrm{θ}}\right)}^{{2}}\right){}{{\mathrm{ρ}}}^{{2}}\right)}{{{\mathrm{ρ}}}^{{4}}}{+}\frac{{\left({m}{-}{2}{}{\mathrm{ρ}}\right)}^{{2}}{}{{\mathrm{%d_}}{}\left({t}\right)}^{{2}}}{{\left({2}{}{\mathrm{ρ}}{+}{m}\right)}^{{2}}}$ (12)

By inspection, the spatial part of this result is proportional to the euclidean spatial line element mentioned. Compare with the line element of the Schwarzschild metric,

 > $\mathrm{g_}\left[\mathrm{line_element}\right]$
 $\frac{{r}{}{{\mathbf{ⅆ}}{}\left({r}\right)}^{{2}}}{{-}{r}{+}{2}{}{m}}{-}{{r}}^{{2}}{}{{\mathbf{ⅆ}}{}\left({\mathrm{\theta }}\right)}^{{2}}{-}{{r}}^{{2}}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{{\mathbf{ⅆ}}{}\left({\mathrm{\phi }}\right)}^{{2}}{+}\frac{\left({r}{-}{2}{}{m}\right){}{{\mathbf{ⅆ}}{}\left({t}\right)}^{{2}}}{{r}}$ (13)

Remark: this transformed metric (12) is not automatically set as the metric. It is for that reason that the line above shows the line element of the original metric, not the changed metric. To set the new metric use $\mathrm{Setup}\left(\mathrm{g_}=\left(12\right)\right)$, or use the optional argument setmetric, in which case both the metric and the new coordinates will be set. For example, adding the keyword setmetric to the input that resulted in (12),

 > $\mathrm{TransformCoordinates}\left(\mathrm{TR},\mathrm{g_}\left[\mathrm{\mu },\mathrm{\nu }\right],\left[\mathrm{\rho },\mathrm{\theta },\mathrm{\phi },t\right],\mathrm{output}=\mathrm{lineelement},\mathrm{setmetric}\right)$
 ${\mathbit{Changing the differentiation variables used to compute the Christoffel symbols from}}\left[{\mathbit{r}}{,}{\mathbf{\theta }}{,}{\mathbf{\phi }}{,}{\mathbit{t}}\right]{\mathbit{to}}\left[{\mathbf{\rho }}{,}{\mathbf{\theta }}{,}{\mathbf{\phi }}{,}{\mathbit{t}}\right]{\mathbit{while the spacetime metric depends on}}\left[{\mathbf{\rho }}{,}{\mathbf{\theta }}{,}{\mathbit{m}}\right]$
 ${}\mathrm{Default differentiation variables for d_, D_ and dAlembertian are:}{}\left\{X=\left(\mathrm{\rho }{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right)\right\}$
 ${}\mathrm{Systems of spacetime coordinates are:}{}\left\{X=\left(\mathrm{\rho }{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right){,}Y=\left(\mathrm{y1}{,}\mathrm{y2}{,}\mathrm{y3}{,}\mathrm{y4}\right)\right\}$
 ${}\mathrm{Default differentiation variables for d_, D_ and dAlembertian are:}{}\left\{X=\left(\mathrm{\rho }{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right)\right\}$
 ${-}\frac{{1}}{{16}}{}\frac{{\left({2}{}{\mathrm{ρ}}{+}{m}\right)}^{{4}}{}\left({{\mathrm{%d_}}{}\left({\mathrm{ρ}}\right)}^{{2}}{+}\left({{\mathrm{sin}}{}\left({\mathrm{θ}}\right)}^{{2}}{}{{\mathrm{%d_}}{}\left({\mathrm{φ}}\right)}^{{2}}{+}{{\mathrm{%d_}}{}\left({\mathrm{θ}}\right)}^{{2}}\right){}{{\mathrm{ρ}}}^{{2}}\right)}{{{\mathrm{ρ}}}^{{4}}}{+}\frac{{\left({m}{-}{2}{}{\mathrm{ρ}}\right)}^{{2}}{}{{\mathrm{%d_}}{}\left({t}\right)}^{{2}}}{{\left({2}{}{\mathrm{ρ}}{+}{m}\right)}^{{2}}}$ (14)

so that now you see $X$ as a label to the new coordinates $\left[\mathrm{\rho },\mathrm{\theta },\mathrm{\phi },t\right]$ and the line element as the new line element

 > $\mathrm{Coordinates}\left(\right)$
 ${}\mathrm{Systems of spacetime coordinates are:}{}\left\{X=\left(\mathrm{\rho }{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right){,}Y=\left(\mathrm{y1}{,}\mathrm{y2}{,}\mathrm{y3}{,}\mathrm{y4}\right)\right\}$
 $\left\{{X}{,}{Y}\right\}$ (15)
 > $\mathrm{g_}\left[\mathrm{line_element}\right]$
 ${-}\frac{{\left({2}{}{\mathrm{\rho }}{+}{m}\right)}^{{4}}{}\left({{\mathbf{ⅆ}}{}\left({\mathrm{\rho }}\right)}^{{2}}{+}\left({{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{{\mathbf{ⅆ}}{}\left({\mathrm{\phi }}\right)}^{{2}}{+}{{\mathbf{ⅆ}}{}\left({\mathrm{\theta }}\right)}^{{2}}\right){}{{\mathrm{\rho }}}^{{2}}\right)}{{16}{}{{\mathrm{\rho }}}^{{4}}}{+}\frac{{\left({m}{-}{2}{}{\mathrm{\rho }}\right)}^{{2}}{}{{\mathbf{ⅆ}}{}\left({t}\right)}^{{2}}}{{\left({2}{}{\mathrm{\rho }}{+}{m}\right)}^{{2}}}$ (16)

Set the metric and coordinates again to be Schwarzschild and spherical

 > $\mathrm{g_}\left[\mathrm{sc}\right]$
 ${}\mathrm{_______________________________________________________}$
 ${}\mathrm{Systems of spacetime coordinates are:}{}\left\{X=\left(r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right){,}Y=\left(\mathrm{y1}{,}\mathrm{y2}{,}\mathrm{y3}{,}\mathrm{y4}\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)$ (17)

Transform the Schwarzschild metric to Kruskal coordinates. The new coordinates are

 > $\mathrm{Coordinates}\left(K=\left[U,\mathrm{\theta },\mathrm{\phi },V\right]\right)$
 ${}\mathrm{Systems of spacetime coordinates are:}{}\left\{K=\left(U{,}\mathrm{\theta }{,}\mathrm{\phi }{,}V\right){,}X=\left(r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right){,}Y=\left(\mathrm{y1}{,}\mathrm{y2}{,}\mathrm{y3}{,}\mathrm{y4}\right)\right\}$
 $\left\{{K}{,}{X}{,}{Y}\right\}$ (18)

The transformation is

 > $\mathrm{tr}≔\left[V=\mathrm{exp}\left(\frac{v}{4m}\right),U=-\mathrm{exp}\left(-\frac{u}{4m}\right)\right]$
 ${\mathrm{tr}}{≔}\left[{V}{=}{{ⅇ}}^{\frac{{v}}{{4}{}{m}}}{,}{U}{=}{-}{{ⅇ}}^{{-}\frac{{u}}{{4}{}{m}}}\right]$ (19)
 > $v≔t+r+2m\mathrm{ln}\left(r-2m\right)$
 ${v}{≔}{t}{+}{r}{+}{2}{}{m}{}{\mathrm{ln}}{}\left({r}{-}{2}{}{m}\right)$ (20)
 > $u≔t-r-2m\mathrm{ln}\left(r-2m\right)$
 ${u}{≔}{t}{-}{r}{-}{2}{}{m}{}{\mathrm{ln}}{}\left({r}{-}{2}{}{m}\right)$ (21)

Note this is a transformation from new to old variables. The line element of the transformed metric is

 > $\mathrm{TransformCoordinates}\left(\mathrm{tr},\mathrm{g_}\left[i,j\right],\mathrm{output}=\mathrm{lineelement}\right)$
 ${-}{{r}}^{{2}}{}{{\mathbf{ⅆ}}{}\left({\mathrm{\theta }}\right)}^{{2}}{-}{{r}}^{{2}}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{{\mathbf{ⅆ}}{}\left({\mathrm{\phi }}\right)}^{{2}}{-}\frac{{32}{}{{m}}^{{2}}{}{\mathbf{ⅆ}}{}\left({U}\right){}\left({-}\frac{{r}}{{2}}{+}{m}\right){}{{ⅇ}}^{{-}\frac{{2}{}{m}{}{\mathrm{ln}}{}\left({r}{-}{2}{}{m}\right){+}{r}}{{2}{}{m}}}{}{\mathbf{ⅆ}}{}\left({V}\right)}{{r}}$ (22)
 > $\mathrm{collect}\left(\mathrm{expand}\left(\right),\mathrm{d_},\mathrm{simplify}\right)$
 $\frac{{16}{}{{m}}^{{2}}{}{{ⅇ}}^{{-}\frac{{r}}{{2}{}{m}}}{}{\mathbf{ⅆ}}{}\left({V}\right){}{\mathbf{ⅆ}}{}\left({U}\right)}{{r}}{-}{{r}}^{{2}}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{{\mathbf{ⅆ}}{}\left({\mathrm{\phi }}\right)}^{{2}}{-}{{r}}^{{2}}{}{{\mathbf{ⅆ}}{}\left({\mathrm{\theta }}\right)}^{{2}}$ (23)

By default, repeated indices in expression are returned explicitly summed. For example, consider this expression with free indices $\mathrm{\mu }$ and $\mathrm{\nu }$

 > $\mathrm{g_}\left[\mathrm{\mu },\mathrm{\rho }\right]A\left[\mathrm{~rho}\right]A\left[\mathrm{\nu }\right]$
 ${{g}}_{{\mathrm{\mu }}{,}{\mathrm{\rho }}}{}{{A}}_{\phantom{{}}\phantom{{\mathrm{\rho }}}}^{\phantom{{}}{\mathrm{\rho }}}{}{{A}}_{{\mathrm{\nu }}}$ (24)

To perceive the difference with and without the option performsumoverrepeatedindices, perform an identity transformation on (24)

 > $M≔\mathrm{TransformCoordinates}\left(r=r,\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{\left(r-2{}m\right){}{A}_{1}{}{A}_{\mathrm{~4}}}{r}& \frac{\left(r-2{}m\right){}{A}_{2}{}{A}_{\mathrm{~4}}}{r}& \frac{\left(r-2{}m\right){}{A}_{3}{}{A}_{\mathrm{~4}}}{r}& \frac{\left(r-2{}m\right){}{A}_{4}{}{A}_{\mathrm{~4}}}{r}\end{array}\right]$ (25)

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

 > $\mathrm{TransformCoordinates}\left(r=r,,\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]$ (26)

Note that the Matrix $M$ assigned in (25) can effectively be used to retrieve the value of (24) for given values of its free indices $\mathrm{\mu }$ and $\mathrm{\nu }$. Similar functionality is available using TensorArray.

 > $M\left[1,1\right]$
 $\frac{{{A}}_{{1}}{}{{A}}_{\phantom{{}}\phantom{{1}}}^{\phantom{{}}{1}}{}{r}}{{-}{r}{+}{2}{}{m}}$ (27)
 > $M\left[4,1\right]$
 $\frac{\left({r}{-}{2}{}{m}\right){}{{A}}_{{1}}{}{{A}}_{\phantom{{}}\phantom{{4}}}^{\phantom{{}}{4}}}{{r}}$ (28)
 > 

You can as well transform tensorial expressions that have no free indices; in that case only a change of variables in the scalar expression using PDEtools:-dchange is performed, although in the returned result the repeated indices will appear explicitly summed. To perform only the summation use SumOverRepeatedIndices.

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[TransformCoordinates] command was introduced in Maple 16.