Physics[SubstituteTensor] - substitute tensor, sums or products of them, in tensorial expression, matching free indices and automatically taking care of possible collisions between repeated indices
SubstituteTensor(EQ, ..., ee, evaluateexpression, repeatedindicescovariant)
a substitution equation, a list or set of them, or a sequence of any of these, typically involving tensors, or sums or products of them, on the left-hand sides, and corresponding tensorial expressions (same free indices) on the right-hand sides
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 where subs and eval are able to perform substitutions
optional, when given, the substitutions in ee are performed using eval instead of subs
optional, default value is true when the spacetime is Euclidean and false otherwise. When true, all repeated (contracted) indices in the result are returned covariant instead of one covariant and the other contravariant.
SubstituteTensor substitutes the equation(s) EQ into ee, taking care of free and repeated indices such that: 1) equations in EQ are interpreted as mappings having the free indices as parameters, so for example substituting A[j] = G[j] into A[k] results in G[k]; 2) repeated indices in EQ do not clash with repeated indices in ee, so for example substituting A[j] = G[j]*F[k,k] into A[i]*G[k]*G[k] or into A[k]*A[k] respectively results in G[i]*F[m,m]*G[k]*G[k], and G[k]*F[j,j] * G[k]*F[m,m]. SubstituteTensor can also substitute sub-expressions of type product or sum, similar to what algsubs does, so for example substituting A[j] * B[k] = F[j, k] into A[i] * B[i] * F[j, k] and into A[i] * B[j] * A[k] * B[m] respectively results in F[i, i] * F[j, k] and F[i, j] * F[k, m]. Note: when the left-hand-side of a substitution equation is a tensor function (of type Library:-PhysicsType:-Tensor and also of type function), say T[j,k](X), then not just the indices j,k but also the functionality X is considered a parameter, so for example substituting T[j, k](X) = F[j, k](X) into T[i, i](Y) results in F[i, i](Y). The functionality is not considered a parameter when the left-hand-side is an algebraic expression.
Defined objects with tensor properties
EQ ≔ Aμ=Gν,α⁢Aα⁢Fμ,ν
The repeated and free indices of the lhs and rhs of this substitution equation eq
The repeated indices per term are: ...,...,..., the free indices are: ...
The easy case
Now the free index in the target expression is now not mu but nu
Distinction between covariant and contravariant indices
The index nu found repeated in the rhs of the substitution equation eq also appears repeated in the following target expression
ee ≔ Aν⁢Aν
res ≔ SubstituteTensor⁡EQ,ee
The repeated and free indices of this result
Functionality is also taken as parameters (only when the lhs is a Tensor function)
Substituting in sub-expressions like algsubs
EQ2 ≔ Aμ⁡X⁢Bν⁡Y=Gμ,ν⁡X
ee2 ≔ Aα⁡X⁢Bβ⁡Y⁢Aρ⁡X⁢Bρ⁡Y
When substituting EQ2 into ee2, the sub-expression A . B appears twice, and not in the indets (indeterminates) of ee2:
algsubs, Check, eval, indets, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, subs, SubstituteTensorIndices
The Physics[SubstituteTensor] command was introduced in Maple 2015.
For more information on Maple 2015 changes, see Updates in Maple 2015.
Download Help Document
What kind of issue would you like to report? (Optional)