TransformCoordinates - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Physics : TransformCoordinates

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

Calling Sequence

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




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



any algebraic expression that can also be tensorial, having free indices



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



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



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



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



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



and every covariant vector transforms according to



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 = ....






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 X1y1,y2,y3,y4,...,Y4x1,x2,x3,x4


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









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



The covariant components of a vector A transform  according to


Defined objects with tensor properties









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:







Verify that the transformation




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



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: - - - +




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:




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,




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 Setupg=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),



Coordinates: ρ,θ,φ,t. Signature: - - - +






so that now you see X as a label to the new coordinates ρ,θ,φ,t and the line element as the new line element


Systems of spacetime coordinates are:X=ρ,θ,φ,t,Y=y1,y2,y3,y4






Set the metric and coordinates again to be Schwarzschild and spherical



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

The Schwarzschild metric in coordinates r,θ,φ,t

Parameters: m

Signature: - - - +




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


Systems of spacetime coordinates are:K=U,θ,φ,V,X=r,θ,φ,t,Y=y1,y2,y3,y4



The transformation is










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




By default, repeated indices in expression are returned explicitly summed. For example, consider this expression with free indices μ and ν




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




In the above, the sum over ρ is performed. With performsumoverrepeatedindices = false the sum is not performed:




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.







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



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