Physics[Substitute] - substitute tensor indices, tensorial expressions, non-commutative products possibly involving tensors, combining into one command all of subs, algsubs, SubstituteTensor, SubstituteTensorIndices, Library:-SubstituteMatrix and Library:-SubstituteOperator
|
Calling Sequence
|
|
Substitute(EQ, ..., ee, evaluateexpression, <other options>)
|
|
Parameters
|
|
EQ
|
-
|
a substitution equation, a list or set of them, or a sequence of any of these, typically involving tensor indices or tensors, or noncommutative objects, or sums or products of them, on the left-hand sides
|
ee
|
-
|
the target where the substitutions EQ, ... are to be performed, it is the last argument after the substitution equations; ee can be any Maple object (expression, list, etc.) typically involving tensors or tensorial expressions with free and/or repeated tensor indices and/or noncommutative objects products or powers
|
evaluateexpression
|
-
|
optional, when given, the substitutions in ee are performed and the result fully evaluated
|
<other options>
|
-
|
optional, can be any of the options of the commands SubstituteTensor, SubstituteTensorIndices, Library:-SubstituteOperator or the indexing options of the subs command as in Substitute[subs_options](...)
|
|
|
|
|
Description
|
|
–
|
If Greek letters are tensor indices, and the target ee is a tensorial expression, the substitution is automatically forwarded to SubstituteTensorIndices and will substitute both covariant () and contravariant () indices, and perform the substitution only in tensor indices, not otherwise.
|
–
|
If is a tensorial equation, with or without free indices on the left and right hand sides, the task is automatically forwarded to SubstituteTensor.
|
–
|
If involves products, sums or powers, with or without non-commutative objects, the substitution task is automatically forwarded to Library:-SubstituteOperator which combines three different strategies involving algsubs that handles simple cases, simplify/siderels that uses a more thorough approach involving Groebner basis, and an algorithm dedicated to perform substitutions of sub-products of noncommutative products (say in ), as well as sub-sums (say in ).
|
•
|
All the optional arguments accepted by SubstituteTensor, SubstituteTensorIndices or Library:-SubstituteOperator can be passed, as such, to Substitute, and the indexing options of the subs command are also understood by Substitute provided you pass them indexing the command, as in Substitute[subs_options](...). Conflicting options - accepted by one command but not by another one - are not a problem: if an option passed is not accepted by the command actually performing the substitution, that option is ignored.
|
•
|
The special keyword is understood by all the commands used by Substitute; if that option is passed and the command used to perform the action is subs, then subs is used as in subs[eval].
|
|
|
Examples
|
|
>
|
|
| (1) |
|
Substitutions of matrices, sub-products and sub-sums, possibly involving noncommutative objects
|
|
|
Substitution of matrices and vectors taking mathematical equality into account
|
>
|
|
>
|
|
|
Although the target expression ee consists of a Matrix and the left hand side of eq is a matrix mathematically equal to ee, each Matrix is an independent object so syntactically they are not equal:
|
|
These cases are handled by Substitute as one would expect, by recognizing the left-hand side of eq as mathematically equal to ee
|
|
Substitute performs the substitution in the presence of Matrix or Vector constructions not just in the natural case above but in general, in all the cases it can handle
|
>
|
|
|
Setup some non-commutative operands
|
>
|
|
>
|
|
| (15) |
>
|
|
| (16) |
>
|
|
| (17) |
>
|
|
| (18) |
>
|
|
| (19) |
>
|
|
>
|
|
>
|
|
•
|
Clear quantum operators to proceed with examples in the next sections
|
>
|
|
| (23) |
|
|
Substituting tensorial sub-expressions
|
|
>
|
|
| (24) |
| (25) |
|
The repeated and free indices of the lhs and rhs of this substitution equation eq
|
| |
| (26) |
|
Now the free index in the target expression is now not but
|
|
Distinction between covariant and contravariant indices
|
>
|
|
| (29) |
|
The index found repeated in the rhs of the substitution equation eq also appears repeated in the following target expression
|
>
|
|
| (31) |
|
The repeated and free indices of this result
|
| |
| (32) |
|
Functionality is also taken as parameters (only when the lhs is a Tensor function)
|
>
|
|
|
Substituting in sub-expressions like algsubs
|
| (34) |
>
|
|
| (35) |
|
When substituting EQ2 into ee2, the sub-expression A . B appears twice, and not in the indets (indeterminates) of ee2:
|
| (36) |
>
|
|
|
Set a kind of letter to represent spinorindices and define a tensor with mixed spacetime and spinor indices
|
>
|
|
| (38) |
| |
| (39) |
|
Substitutions in doubly indexed Dirac matrices
|
>
|
|
|
When the free indices of left and right hand sides of a substitution equation are different, the substitution is halted and a related error message is displayed
|
>
|
|
| |
|
Substitutions of that kind could however be intentional; in those situations you can use the option disregardfreeindices
|
>
|
|
|
|
Substitutions of tensor indices
|
|
|
Define a couple of arbitrary spacetime tensors for exploration purposes
|
| (42) |
|
Enter, for example, this tensorial expression, with a contravariant free index
|
>
|
|
| (43) |
|
To check the repeated and free indices in an expression use Check
|
| |
| (44) |
|
So (3) has and the contravariant as free indices. Substitute now : the standard subs command will only substitute the covariant
|
| (45) |
|
Consequently, the resulting expression is not equivalent to (3): it now has four free indices
|
| |
| (46) |
|
To substitute both covariant and contravariant repeated indices obtaining an expression equivalent to original one use
|
| (47) |
| |
| (48) |
|
Substitute now the contravariant by ; the standard subs command will fail because contravariant indices are prefixed by ~, so this returns (3) as given
|
| (49) |
|
To make it work with subs you would need to substitute ~rho = ~beta instead. Using Substitute you get the desired result regardless of this subtlety
|
| (50) |
| |
| (51) |
|
To substitute several indices at once, enclosing or not the substitution equations in a set or a list
|
>
|
|
| (52) |
|
After substituting, tensors are re-evaluated; in this example, becomes 1 and the normalized form of g_ is presented with it in the first place, so switching places with
|
>
|
|
|
Note the result above is not fully evaluated; in that sense, Substitute, the same as SubstituteTensorIndices, follows the design of subs. To have results fully evaluated, pass the keyword evaluateexpression
|
>
|
|
|
|
|
See Also
|
|
algsubs, Check, eval, eval, g_, indets, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Physics:-Library, subs, SubstituteTensor, SubstituteTensorIndices
|
|
Compatibility
|
|
•
|
The Physics[Substitute] command was introduced in Maple 2023.
|
|
|