Coordinates - Maple Help

Physics[Coordinates] - set up aliases for the spacetime coordinates used by Physics commands

 Calling Sequence Coordinates( ) Coordinates(X, quiet, clear)

Parameters

 X - an unassigned capital letter, or an equation with it on the left-hand side and a list of coordinates or any of the keywords cartesian, cylindrical, spherical on the right-hand side quiet - (optional) proceed without displaying messages on the screen clear - (optional) to unset the specified system of coordinates previously set by Coordinates

Description

 • The Coordinates command is used to set the systems of coordinates used by the other commands of the Physics package, as for instance the differentiation operators d_, D_, dAlembertian, diff and Fundiff, and all the general relativity tensors.
 • The Coordinates command also sets an alias for a capital letter X to represent a list of coordinates as explained below. These simplified representations for the spacetime coordinates eliminate the redundancy of having to type all the coordinates and in the correct order (setting these aliases does not prevent you from doing so, however), when entering functions of spacetime or using the Physics differentiation commands d_, D_ or the dAlembertian.
 • After setting a coordinate system, the capital letter that labels it can also be used in algebraic computations to represent the corresponding SpaceTimeVector (tensor with 1 index) - see the Examples section.
 • When the Coordinates command is called with no arguments, it returns the capital letters currently set to represent coordinate systems.
 • When Coordinates is called with one argument, a capital letter - say X - an alias is set for X to represent the sequence of n (the spacetime dimension, say 4) coordinates conformed by: $\mathrm{x1},\mathrm{x2},\mathrm{x3},\mathrm{x4}$. Also $\mathrm{x0}$ is assigned the value $\mathrm{x4}$. As a rule, this sequence of spacetime coordinates is built by using the corresponding lowercase letter as a root, concatenated with positive integers from 1 to n. The capital letters that can be used as labels for systems of coordinates are the letters from A to Z, excluding D, E, G, I, O and R.
 • When the spacetime dimension is changed in the middle of a Maple session, the systems of coordinates previously set are automatically redefined to have the same number of coordinates as the new value for the dimension.
 • You can also call Coordinates with an equation, having any of the capital letters mentioned in the previous paragraph on the left-hand side, say Y, and a list of variables - all of type name- say [u, v, w, ...] on the right side, so that Y will be aliased to [u, v, w, ...]. In these cases, macros are also set as y1 = u, y2 = v, y3 = w, ... so that you can continue using concatenated lowercase letters y1, y2, ... to refer to each of the individual coordinates, apart from referring to them via Y[1], Y[2], ... or directly as u, v, ...
 • Coordinates also understands three keywords: cartesian, representing $\left[x,y,z,t\right]$, cylindrical, representing $\left[\mathrm{\rho },\mathrm{\phi },z,t\right]$, and spherical, representing $\left[r,\mathrm{\theta },\mathrm{\phi },t\right]$, that can be on the right-hand side of the equation X = ... passed as first argument, so that the capital letter on the left-hand side will be aliased these coordinates.
 • The first time Coordinates is called to set a system of coordinates, this system is also set as the default differentiation variables for all of d_, D_ and the dAlembertian as explained in the corresponding help pages.
 • You can set many systems of coordinates to work with at the same time. This is particularly useful, for instance, when working with functional derivatives or coordinate transformations. To change the default differentiation variables from one system of coordinates to another one use Setup
 • You can also view the systems of coordinates already set, or set new ones, by launching the setup maplet (enter Setup() at the Maple prompt).

Examples

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

Set an alias for $X$ to represent $\mathrm{x1}$, $\mathrm{x2}$, $\mathrm{x3}$, $\mathrm{x4}$, and set the default differentiation coordinates for d_ and dAlembertian to be $X$; this can be done in a single command line by using the Setup command as in Setup(differentiationvariables = X) - that automatically sets the coordinates - or using Coordinates - the first time it is called it automatically sets the differentiation variables

 > $\mathrm{Coordinates}\left(X\right)$
 ${}{}\mathrm{Systems of spacetime coordinates are:}{}{}{}\left\{X=\left(\mathrm{x1}{,}\mathrm{x2}{,}\mathrm{x3}{,}\mathrm{x4}\right)\right\}$
 $\left\{{X}\right\}$ (2)

Query about the default differentiation variables for

 > $\mathrm{Setup}\left(\mathrm{diff}\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{_______________________________________________________}$
 $\left[{\mathrm{differentiationvariables}}{=}\left[{X}\right]\right]$ (3)

Note the display of the association between $X$ and the sequence $X$. Because of the alias', if you now enter X you do not see its contents

 > $X$
 ${X}$ (4)

The variables are however there:

 > $X\left[1\right]$
 ${\mathrm{x1}}$ (5)
 > $X\left[4\right]$
 ${\mathrm{x4}}$ (6)

After having set $X$ as a coordinate system and default differentiation variables, d_ and dAlembertian can be used omitting the second argument that would specify the differentiation variables

 > $f\left(X\right)$
 ${f}{}\left({X}\right)$ (7)
 > $\mathrm{d_}\left[\mathrm{\mu }\right]\left(\right)$
 ${{\partial }}_{{\mathrm{\mu }}}{}\left({f}{}\left({X}\right)\right)$ (8)
 > $\mathrm{dAlembertian}\left(\right)$
 ${\mathrm{\square }}{}\left({f}{}\left({X}\right)\right)$ (9)

Set more systems of spacetime coordinates.

 > $\mathrm{Coordinates}\left(Y,Z\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){,}Z=\left(\mathrm{z1}{,}\mathrm{z2}{,}\mathrm{z3}{,}\mathrm{z4}\right)\right\}$
 $\left\{{X}{,}{Y}{,}{Z}\right\}$ (10)

This is useful, for example, when you want to represent objects evaluated at different points in spacetime. If you want to use d_ or dAlembertian with $Y$ or $Z$, which in this example are not the default differentiation variables, you need to specify them as the second argument, and they will be displayed on the screen.

 > $\mathrm{d_}\left[\mathrm{\mu }\right]\left(f\left(Y\right),\left[Y\right]\right)$
 ${{\partial }}_{{\mathrm{\mu }}}{}\left({f}{}\left({Y}\right){,}\left[{Y}\right]\right)$ (11)
 > $\mathrm{dAlembertian}\left(f\left(Y\right),\left[Y\right]\right)$
 ${\mathrm{\square }}{}\left({f}{}\left({Y}\right){,}\left[{Y}\right]\right)$ (12)

An example where more than one system of coordinates is intrinsically required: functional differentiation. Use 'delay evaluation quotes' to first display the expression, then evaluate.

 > $f\left(X\right)$
 ${f}{}\left({X}\right)$ (13)
 > $'\mathrm{Fundiff}'\left(,f\left(Y\right)\right)$
 ${\mathrm{Fundiff}}{}\left({f}{}\left({X}\right){,}{f}{}\left({Y}\right)\right)$ (14)
 > 
 ${\mathrm{Dirac}}{}\left(\left[{\mathrm{x1}}{-}{\mathrm{y1}}{,}{\mathrm{x2}}{-}{\mathrm{y2}}{,}{\mathrm{x3}}{-}{\mathrm{y3}}{,}{\mathrm{x4}}{-}{\mathrm{y4}}\right]\right)$ (15)

You see above a four dimensional Dirac delta function as a result of the functional differentiation. Alternatively, instead of using 'delay evaluation quotes,' you can use the inert form %Fundiff, and then evaluate by using the value command.

 > $\mathrm{%Fundiff}\left(f\left(Y\right),f\left(Z\right)\right)$
 ${\mathrm{%Fundiff}}{}\left({f}{}\left({Y}\right){,}{f}{}\left({Z}\right)\right)$ (16)
 > $\mathrm{value}\left(\right)$
 ${\mathrm{Dirac}}{}\left(\left[{\mathrm{y1}}{-}{\mathrm{z1}}{,}{\mathrm{y2}}{-}{\mathrm{z2}}{,}{\mathrm{y3}}{-}{\mathrm{z3}}{,}{\mathrm{y4}}{-}{\mathrm{z4}}\right]\right)$ (17)

Coordinates systems and the "SpaceTimeVector"

After setting a coordinate system, the capital letter that labels it can also be use in algebraic computations to represent the corresponding SpaceTimeVector (tensor with 1 index). For example:

 > $X\left[\mathrm{~alpha}\right]X\left[\mathrm{~beta}\right]$
 ${{X}}_{\phantom{{}}\phantom{{\mathrm{\alpha }}}}^{\phantom{{}}{\mathrm{\alpha }}}{}{{X}}_{\phantom{{}}\phantom{{\mathrm{\beta }}}}^{\phantom{{}}{\mathrm{\beta }}}$ (18)
 > $\mathrm{d_}\left[\mathrm{\mu }\right]\left(\right)$
 ${{X}}_{\phantom{{}}\phantom{{\mathrm{\alpha }}}}^{\phantom{{}}{\mathrm{\alpha }}}{}{{\mathrm{g_}}}_{{\mathrm{\mu }}\phantom{{\mathrm{\beta }}}}^{\phantom{{\mathrm{\mu }}}{\mathrm{\beta }}}{+}{{\mathrm{g_}}}_{{\mathrm{\mu }}\phantom{{\mathrm{\alpha }}}}^{\phantom{{\mathrm{\mu }}}{\mathrm{\alpha }}}{}{{X}}_{\phantom{{}}\phantom{{\mathrm{\beta }}}}^{\phantom{{}}{\mathrm{\beta }}}$ (19)
 > $\mathrm{dAlembertian}\left(\right)$
 ${2}{}{{g}}_{\phantom{{}}\phantom{{\mathrm{\alpha }}}\phantom{{,}}\phantom{{\mathrm{\beta }}}}^{\phantom{{}}{\mathrm{\alpha }}{,}{\mathrm{\beta }}}$ (20)
 > $\mathrm{LeviCivita}\left[\mathrm{\alpha },\mathrm{\beta },\mathrm{\mu },\mathrm{\nu }\right]$
 ${{\mathrm{\epsilon }}}_{{\mathrm{\alpha }}{,}{\mathrm{\beta }}{,}{\mathrm{\mu }}{,}{\mathrm{\nu }}}{}{{X}}_{\phantom{{}}\phantom{{\mathrm{\alpha }}}}^{\phantom{{}}{\mathrm{\alpha }}}{}{{X}}_{\phantom{{}}\phantom{{\mathrm{\beta }}}}^{\phantom{{}}{\mathrm{\beta }}}$ (21)
 > $\mathrm{Simplify}\left(\right)$
 ${0}$ (22)

Or using . instead of * to shortcut the call to Simplify

 > $\mathrm{LeviCivita}\left[\mathrm{\alpha },\mathrm{\beta },\mathrm{\mu },\mathrm{\nu }\right]·$
 ${0}$ (23)
 > $\mathrm{g_}\left[\mathrm{\alpha },\mathrm{\beta }\right]·$
 ${{X}}_{\phantom{{}}\phantom{{\mathrm{\beta }}}}^{\phantom{{}}{\mathrm{\beta }}}{}{{X}}_{{\mathrm{\beta }}}$ (24)

Remark: in tensor computations, the distinction between covariant and contravariant indices is important when the spacetime is not Euclidean and the indices assume numerical values. The label of a system of coordinates set with Coordinates represent the contravariant components of the corresponding SpaceTimeVector. To indicate than an index is contravariant you prefix it with ~. On the other hand, in Maple, the selection operation is also performed through indexation. Hence, if X is a label for a system of coordinates, entering X[1] returns x1, the contravariant component of the corresponding SpaceTimeVector, even when the index used is the number 1, the covariant version of the contravariant ~1. So in a context where covariant and contravariant indexation is relevant and where you are going to assign numerical values to the indices, it is recommended to represent the spacetime vector with the SpaceTimeVector function, as in SpaceTimeVector[mu](X), instead of directly using X[mu]. In all other cases it is safe and simpler to use X[mu] and all the Physics commands understand both representations as equivalent.

Due to the equivalence between SpaceTimeVector[~mu] and X[~mu], they are both displayed X[~mu] (note the prefix ~ to indicate that $\mathrm{\mu }$ is contravariant)

 > $\mathrm{SpaceTimeVector}\left[\mathrm{~mu}\right]\left(X\right)$
 ${{X}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}$ (25)
 > $\mathrm{lprint}\left(\right)$
 Physics:-SpaceTimeVector[~mu](X)

Display the current spacetime metric g_ matrix

 > $\mathrm{g_}\left[\right]$
 ${{\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)$ (26)

The 1st contravariant and covariant components are respectively represented by indexing SpaceTimeVector with the numbers ~1 and 1

 > $\mathrm{SpaceTimeVector}\left[\mathrm{~1}\right]\left(X\right)$
 ${\mathrm{x1}}$ (27)
 > $\mathrm{SpaceTimeVector}\left[1\right]\left(X\right)=\mathrm{g_}\left[1,\mathrm{\mu }\right]X\left[\mathrm{\mu }\right]$
 ${-}{\mathrm{x1}}{=}{{X}}_{{\mathrm{\mu }}}{}{{\mathrm{g_}}}_{{1}\phantom{{\mathrm{\mu }}}}^{\phantom{{1}}{\mathrm{\mu }}}$ (28)
 > $\mathrm{Simplify}\left(\right)$
 ${-}{\mathrm{x1}}{=}{-}{\mathrm{x1}}$ (29)

Once you have set a system of coordinates, you can differentiate the corresponding SpaceTimeVector, using diff, d_ or any of the differentiation operators of Physics. In the following input, compute the derivative with respect to the 1st contravariant component of $X$, that is $\mathrm{x1}$. Recalling, contravariant differentiation coordinates are the ones entering the covariant differentiation operator ${\partial }_{\mathrm{\mu }}=\frac{\partial }{\partial {x}^{\mathrm{\mu }}}$. For illustration purposes use the inert form of d_ and diff, prefixing the commands with % and perform the computation using value

 > $\mathrm{SpaceTimeVector}\left[\mathrm{~mu}\right]\left(X\right)$
 ${{X}}_{\phantom{{}}\phantom{{\mathrm{\mu }}}}^{\phantom{{}}{\mathrm{\mu }}}$ (30)
 > $\mathrm{%d_}\left[1\right]\left(\right)=\mathrm{%diff}\left(,\mathrm{x1}\right)$
 ${{\mathrm{%d_}}}_{{1}}{}\left({{\mathrm{SpaceTimeVector}}}_{{\mathrm{~mu}}}{}\left({X}\right)\right){=}{\mathrm{%diff}}{}\left({{\mathrm{SpaceTimeVector}}}_{{\mathrm{~mu}}}{}\left({X}\right){,}{\mathrm{x1}}\right)$ (31)
 > $\mathrm{value}\left(\right)$
 ${{\mathrm{g_}}}_{{1}\phantom{{\mathrm{\mu }}}}^{\phantom{{1}}{\mathrm{\mu }}}{=}{{\mathrm{g_}}}_{{1}\phantom{{\mathrm{\mu }}}}^{\phantom{{1}}{\mathrm{\mu }}}$ (32)

You can also represent x1 with SpaceTimeVector[~1](X), and when differentiate with respect to contravariant components of the spacetime vector you can also represent them directly with X[~mu] because ~1, ~2, etc. are viewed by the system as symbols (in this context, contravariant indices) not selecting numbers

 > $\mathrm{%diff}\left(,X\left[\mathrm{~1}\right]\right)=\mathrm{%diff}\left(,\mathrm{%SpaceTimeVector}\left[\mathrm{~1}\right]\left(X\right)\right)$
 ${\mathrm{%diff}}{}\left({{\mathrm{SpaceTimeVector}}}_{{\mathrm{~mu}}}{}\left({X}\right){,}{\left({X}\right)}_{{\mathrm{~1}}}\right){=}{\mathrm{%diff}}{}\left({{\mathrm{SpaceTimeVector}}}_{{\mathrm{~mu}}}{}\left({X}\right){,}{{\mathrm{%SpaceTimeVector}}}_{{\mathrm{~1}}}{}\left({X}\right)\right)$ (33)
 > $\mathrm{value}\left(\right)$
 ${{\mathrm{g_}}}_{{1}\phantom{{\mathrm{\mu }}}}^{\phantom{{1}}{\mathrm{\mu }}}{=}{{\mathrm{g_}}}_{{1}\phantom{{\mathrm{\mu }}}}^{\phantom{{1}}{\mathrm{\mu }}}$ (34)

and in general,

 > $\mathrm{%d_}\left[\mathrm{\mu }\right]\left(X\left[\mathrm{~nu}\right]\right)=\mathrm{d_}\left[\mathrm{\mu }\right]\left(X\left[\mathrm{~nu}\right]\right)$
 ${{\mathrm{%d_}}}_{{\mathrm{μ}}}{}\left({\left({X}\right)}_{{\mathrm{~nu}}}\right){=}{{\mathrm{g_}}}_{{\mathrm{μ}}{,}{\mathrm{~nu}}}$ (35)

Compute now the contravariant derivative, that is, the derivative with respect to the covariant ${X}_{\mathrm{\mu }}$

 > $\mathrm{%d_}\left[\mathrm{~mu}\right]\left(X\left[\mathrm{~nu}\right]\right)=\mathrm{d_}\left[\mathrm{~mu}\right]\left(X\left[\mathrm{~nu}\right]\right)$
 ${{\mathrm{%d_}}}_{{\mathrm{~mu}}}{}\left({\left({X}\right)}_{{\mathrm{~nu}}}\right){=}{{\mathrm{g_}}}_{{\mathrm{~mu}}{,}{\mathrm{~nu}}}$ (36)

Set five more systems of coordinates, using the different forms of setting them

 > $\mathrm{Coordinates}\left(Y,Z=\left[a,b,c,d\right],A=\mathrm{cartesian},B=\mathrm{cylindrical},C=\mathrm{spherical}\right)$
 ${}{}\mathrm{Systems of spacetime coordinates are:}{}{}{}\left\{A=\left(x{,}y{,}z{,}t\right){,}B=\left(\mathrm{\rho }{,}\mathrm{\phi }{,}z{,}t\right){,}C=\left(r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right){,}X=\left(\mathrm{x1}{,}\mathrm{x2}{,}\mathrm{x3}{,}\mathrm{x4}\right){,}Y=\left(\mathrm{y1}{,}\mathrm{y2}{,}\mathrm{y3}{,}\mathrm{y4}\right){,}Z=\left(a{,}b{,}c{,}d\right)\right\}$
 $\left\{{A}{,}{B}{,}{C}{,}{X}{,}{Y}{,}{Z}\right\}$ (37)

Query about the coordinate systems currently set

 > $\mathrm{Coordinates}\left(\right)$
 ${}{}\mathrm{Systems of spacetime coordinates are:}{}{}{}\left\{A=\left(x{,}y{,}z{,}t\right){,}B=\left(\mathrm{\rho }{,}\mathrm{\phi }{,}z{,}t\right){,}C=\left(r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right){,}X=\left(\mathrm{x1}{,}\mathrm{x2}{,}\mathrm{x3}{,}\mathrm{x4}\right){,}Y=\left(\mathrm{y1}{,}\mathrm{y2}{,}\mathrm{y3}{,}\mathrm{y4}\right){,}Z=\left(a{,}b{,}c{,}d\right)\right\}$
 $\left\{{A}{,}{B}{,}{C}{,}{X}{,}{Y}{,}{Z}\right\}$ (38)

Change the default differentiation variables for d_ and the other differentiation commands

 > $\mathrm{Setup}\left(\mathrm{diff}=C\right)$
 ${}{}\mathrm{Default differentiation variables for d_, D_ and dAlembertian are:}{}{}{}\left\{C=\left(r{,}\mathrm{\theta }{,}\mathrm{\phi }{,}t\right)\right\}$
 $\mathrm{_______________________________________________________}$
 $\left[{\mathrm{differentiationvariables}}{=}\left[{C}\right]\right]$ (39)

So now

 > $\mathrm{d_}\left[\mathrm{\mu }\right]\left(X\left[\mathrm{\nu }\right]\right)$
 ${0}$ (40)
 > $\mathrm{d_}\left[\mathrm{\mu }\right]\left(C\left[\mathrm{\nu }\right]\right)$
 ${{g}}_{{\mathrm{\mu }}{,}{\mathrm{\nu }}}$ (41)
 > $C\left[1\right],C\left[2\right],C\left[3\right]$
 ${r}{,}{\mathrm{\theta }}{,}{\mathrm{\phi }}$ (42)

All these refer to the same variable $t$

 > $C\left[4\right],\mathrm{c4},\mathrm{c0},t$
 ${t}{,}{t}{,}{t}{,}{t}$ (43)
 >