Load the Physics package.
Set an alias for to represent , , , , and set the default differentiation coordinates for d_ and dAlembertian to be ; 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
Query about the default differentiation variables for
Note the display of the association between and the sequence . Because of the alias', if you now enter X you do not see its contents
The variables are however there:
After having set as a coordinate system and default differentiation variables, d_ and dAlembertian can be used omitting the second argument that would specify the differentiation variables
Set more systems of spacetime coordinates.
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 or , 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.
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.
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.
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:
Or using `.` instead of `*` to shortcut the call to Simplify
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 is contravariant)
Physics:-SpaceTimeVector[~mu](X)
| |
Display the current spacetime metric g_ matrix
The 1st contravariant and covariant components are respectively represented by indexing SpaceTimeVector with the numbers ~1 and 1
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 , that is . Recalling, contravariant differentiation coordinates are the ones entering the covariant differentiation operator . For illustration purposes use the inert form of d_ and diff, prefixing the commands with % and perform the computation using value
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
and in general,
Compute now the contravariant derivative, that is, the derivative with respect to the covariant
Set five more systems of coordinates, using the different forms of setting them
Query about the coordinate systems currently set
Change the default differentiation variables for d_ and the other differentiation commands
So now
All these refer to the same variable