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 be 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 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, x0,x1,x2,x3 to another y0,y1,y2,y3
xμ=fμ⁡y0,y1,y2,y3
where the fμ are certain functions. When you transform the coordinates, every contravariant tensor of one index, say Aμ⁡x, a vector, transforms into a contravariant Aμ⁡y in the new system of coordinates according to
Aμ⁡y=∂yμ∂xν⁢⁢Aνx
and every covariant vector transforms according to
Aμ⁡y=∂xν∂yμ⁢⁢Aνx
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μ 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μ - on the left-hand sides of the transformation equations to the new variables - say yμ - on the right-hand sides, as in the previous item, the output is entirely expressed in terms of the new coordinates yμ. This is accomplished in two steps:
In the given expression, change variables from the old ones x to the new ones y to get everything expressed in terms of y. (If options known = ... and unknown = ... are received by TransformCoordinates, they are forwarded to dchange. See dchange for info on the use of those options.)
Transform the resulting tensorial expression expressed in terms of y regarding each of its free indices (i.e.: multiply by the appropriate factors mentioned, ∂yμ∂xν or ∂xν∂yμ 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μ 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=−τ then evaluate at τ=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 by passing output = line_element instead of a Matrix.
By default, when changing 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 using simplify. 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
with⁡Physics:
Setup⁡mathematicalnotation=true
mathematicalnotation=true
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 X1⁡y1,y2,y3,y4,...,Y4⁡x1,x2,x3,x4
Coordinates⁡X,Y
⁢Default differentiation variables for d_, D_ and dAlembertian are:⁢X=x1,x2,x3,x4
⁢Systems of spacetime coordinates are:⁢X=x1,x2,x3,x4,Y=y1,y2,y3,y4
X,Y
tr≔x1=X1⁡Y,x2=X2⁡Y,x3=X3⁡Y,x4=X4⁡Y
itr≔y1=Y1⁡X,y2=Y2⁡X,y3=Y3⁡X,y4=Y4⁡X
For readability, suppress the display of functionality in these 8 functions
Typesetting:-Suppress⁡map⁡rhs,tr
Typesetting:-Suppress⁡map⁡rhs,itr
The covariant components of a vector A transform according to
Define⁡A
Defined objects with tensor properties
A,γμ,σμ,∂μ,gμ,ν,εα,β,μ,ν,Xμ,Yμ
Aμ
TransformCoordinates⁡tr,
∂X1∂y1⁢A1+∂X2∂y1⁢A2+∂X3∂y1⁢A3+∂X4∂y1⁢A4∂X1∂y2⁢A1+∂X2∂y2⁢A2+∂X3∂y2⁢A3+∂X4∂y2⁢A4∂X1∂y3⁢A1+∂X2∂y3⁢A2+∂X3∂y3⁢A3+∂X4∂y3⁢A4∂X1∂y4⁢A1+∂X2∂y4⁢A2+∂X3∂y4⁢A3+∂X4∂y4⁢A4
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~mu
A⁢μ⁢μ
TransformCoordinates⁡itr,
∂Y1∂x1⁢A⁢1⁢1+∂Y1∂x2⁢A⁢2⁢2+∂Y1∂x3⁢A⁢3⁢3+∂Y1∂x4⁢A⁢4⁢4∂Y2∂x1⁢A⁢1⁢1+∂Y2∂x2⁢A⁢2⁢2+∂Y2∂x3⁢A⁢3⁢3+∂Y2∂x4⁢A⁢4⁢4∂Y3∂x1⁢A⁢1⁢1+∂Y3∂x2⁢A⁢2⁢2+∂Y3∂x3⁢A⁢3⁢3+∂Y3∂x4⁢A⁢4⁢4∂Y4∂x1⁢A⁢1⁢1+∂Y4∂x2⁢A⁢2⁢2+∂Y4∂x3⁢A⁢3⁢3+∂Y4∂x4⁢A⁢4⁢4
Verify that the transformation
TR≔r=1+m2⁢ρ2⁢ρ
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, ∂⁡ρ2+ρ2⁢∂⁡θ2+sin⁡θ2⁢∂⁡φ2.
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
g_sc
⁢_______________________________________________________
⁢Systems of spacetime coordinates are:⁢X=r,θ,φ,t,Y=y1,y2,y3,y4
⁢Default differentiation variables for d_, D_ and dAlembertian are:⁢X=r,θ,φ,t
Setting lowercaselatin_is letters to represent space indices
⁢The Schwarzschild metric in coordinates ⁢r,θ,φ,t
Parameters: m
Signature: - - - +
gμ,ν=r2⁢m−r0000−r20000−r2⁢sin⁡θ20000r−2⁢mr
Transform the coordinates in this metric using the transformation TR. Because the new variables were not set using Coordinates, indicate them as ρ,θ,φ,t; request the output to be the corresponding line element:
TransformCoordinates⁡TR,g_μ,ν,ρ,θ,φ,t,output=lineelement
−2⁢ρ+m4⁢ⅆ⁡ρ2+sin⁡θ2⁢ⅆ⁡φ2+ⅆ⁡θ2⁢ρ216⁢ρ4+m−2⁢ρ2⁢ⅆ⁡t22⁢ρ+m2
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,
g_line_element
r⁢ⅆ⁡r22⁢m−r−r2⁢ⅆ⁡θ2−r2⁢sin⁡θ2⁢ⅆ⁡φ2+r−2⁢m⁢ⅆ⁡t2r
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 Setup⁡g=12, 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),
TransformCoordinates⁡TR,g_μ,ν,ρ,θ,φ,t,output=lineelement,setmetric
Coordinates: ρ,θ,φ,t. Signature: - - - +
gμ,ν=−2⁢ρ+m416⁢ρ40000−2⁢ρ+m416⁢ρ20000−2⁢ρ+m4⁢sin⁡θ216⁢ρ20000m−2⁢ρ22⁢ρ+m2
so that now you see X as a label to the new coordinates ρ,θ,φ,t and the line element as the new line element
Coordinates⁡
⁢Systems of spacetime coordinates are:⁢X=ρ,θ,φ,t,Y=y1,y2,y3,y4
Set the metric and coordinates again to be Schwarzschild and spherical
Transform the Schwarzschild metric to Kruskal coordinates. The new coordinates are
Coordinates⁡K=U,θ,φ,V
⁢Systems of spacetime coordinates are:⁢K=U,θ,φ,V,X=r,θ,φ,t,Y=y1,y2,y3,y4
K,X,Y
The transformation is
tr≔V=exp⁡v4⁢m,U=−exp⁡−u4⁢m
tr≔V=ⅇv4⁢m,U=−ⅇ−u4⁢m
v≔t+r+2⁢m⁢ln⁡r−2⁢m
u≔t−r−2⁢m⁢ln⁡r−2⁢m
Note this is a transformation from new to old variables. The line element of the transformed metric is
TransformCoordinates⁡tr,g_i,j,output=lineelement
−r2⁢ⅆ⁡θ2−r2⁢sin⁡θ2⁢ⅆ⁡φ2+16⁢ⅆ⁡U⁢m2⁢ⅇ−r2⁢m⁢ⅆ⁡Vr
By default, repeated indices in expression are returned explicitly summed. For example, consider this expression with free indices μ and ν
g_μ,ρ⁢A~rho⁢Aν
gμ,ρ⁢A⁢ρ⁢ρ⁢Aν
To perceive the difference with and without the option performsumoverrepeatedindices, perform an identity transformation on (24)
M≔TransformCoordinates⁡r=r,
M≔A1⁢A⁢1⁢1⁢r2⁢m−rA2⁢A⁢1⁢1⁢r2⁢m−rA3⁢A⁢1⁢1⁢r2⁢m−rA4⁢A⁢1⁢1⁢r2⁢m−r−A1⁢r2⁢A⁢2⁢2−A2⁢r2⁢A⁢2⁢2−A3⁢r2⁢A⁢2⁢2−A4⁢r2⁢A⁢2⁢2−A1⁢A⁢3⁢3⁢r2⁢sin⁡θ2−A2⁢A⁢3⁢3⁢r2⁢sin⁡θ2−A3⁢A⁢3⁢3⁢r2⁢sin⁡θ2−A4⁢A⁢3⁢3⁢r2⁢sin⁡θ2A1⁢A⁢4⁢4⁢r−2⁢mrA2⁢A⁢4⁢4⁢r−2⁢mrA3⁢A⁢4⁢4⁢r−2⁢mrA4⁢A⁢4⁢4⁢r−2⁢mr
In the above, the sum over ρ is performed. With performsumoverrepeatedindices = false the sum is not performed:
TransformCoordinates⁡r=r,,performsumoverrepeatedindices=false
g1,ρ⁢A⁢ρ⁢ρ⁢A1g1,ρ⁢A⁢ρ⁢ρ⁢A2g1,ρ⁢A⁢ρ⁢ρ⁢A3g1,ρ⁢A⁢ρ⁢ρ⁢A4g2,ρ⁢A⁢ρ⁢ρ⁢A1g2,ρ⁢A⁢ρ⁢ρ⁢A2g2,ρ⁢A⁢ρ⁢ρ⁢A3g2,ρ⁢A⁢ρ⁢ρ⁢A4g3,ρ⁢A⁢ρ⁢ρ⁢A1g3,ρ⁢A⁢ρ⁢ρ⁢A2g3,ρ⁢A⁢ρ⁢ρ⁢A3g3,ρ⁢A⁢ρ⁢ρ⁢A4g4,ρ⁢A⁢ρ⁢ρ⁢A1g4,ρ⁢A⁢ρ⁢ρ⁢A2g4,ρ⁢A⁢ρ⁢ρ⁢A3g4,ρ⁢A⁢ρ⁢ρ⁢A4
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 μ and ν. Similar functionality is available using TensorArray.
M1,1
A1⁢A⁢1⁢1⁢r2⁢m−r
M4,1
A1⁢A⁢4⁢4⁢r−2⁢mr
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.
See Also
Array, ArrayElems, Check, Coordinates, d_, dchange, Define, DifferentialGeometry[Tensor][PushPullTensor], g_, Matrix, PDEtools:-dchange, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Setup, SumOverRepeatedIndices, TensorArray
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.
For more information on Maple 16 changes, see Updates in Maple 16.
The Physics[TransformCoordinates] command was updated in Maple 2024.
Download Help Document