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

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

Calling Sequence

SubstituteTensor(EQ, ..., ee, evaluateexpression, repeatedindicescovariant)

Parameters

EQ

-

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

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 where subs and eval are able to perform substitutions

disregardfreeindices

-

optional, when given, the substitutions are performed even if the free indices of the left-hand sides are not equal to the free indices of the right-hand sides

evaluateexpression

-

optional, when given, the substitutions in ee are performed using eval instead of subs

repeatedindicescovariant

-

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.

Description

• 

SubstituteTensor substitutes the equation(s) EQ into ee, taking care of free and repeated indices such that:

– 

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];

– 

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.

• 

By default, it is expected that the free indices of the left and right hand sides of the substitution equation(s) are the same, and SubstituteTensor will interrupt with an error message when that doesn't check. When the free indices on both sides of a substitution equation are intentionally different, to avoid that interruption you can use the option disregardfreeindices.

Examples

withPhysics:

Setupmathematicalnotation=true

mathematicalnotation=true

(1)

DefineA,B,C,F,G:

Defined objects with tensor properties

(2)

EQAμ=Gν,αAαFμ,ν

EQAμ=Gν,αAααFμνμν

(3)

The repeated and free indices of the lhs and rhs of this substitution equation eq

CheckEQ,all

The repeated indices per term are: ...,...,..., the free indices are: ...

,μ=α,ν,μ

(4)

The easy case

SubstituteTensorEQ,Aμ

Gν,αAααFμνμν

(5)

Now the free index in the target expression is now not mu but nu

SubstituteTensorEQ,Aν

Gβ,αAααFνβνβ

(6)

Distinction between covariant and contravariant indices

SubstituteTensorEQ,A~nu

Gβ,αAααFν,βν,β

(7)

The index nu found repeated in the rhs of the substitution equation eq also appears repeated in the following target expression

eeAνAν

eeAνAνν

(8)

resSubstituteTensorEQ,ee

resGλ,κAκκFνλνλGβ,αAααFν,βν,β

(9)

The repeated and free indices of this result

Checkres,all

The repeated indices per term are: ...,...,..., the free indices are: ...

α,β,κ,λ,ν,

(10)

Functionality is also taken as parameters (only when the lhs is a Tensor function)

SubstituteTensorAμX=BμX,AνY

BνY

(11)

Substituting in sub-expressions like algsubs

EQ2AμXBνY=Gμ,νX

EQ2AμXBνY=Gμ,νX

(12)

ee2AαXBβYAρXBρY

ee2AαXBβYAρXBρρY

(13)

When substituting EQ2 into ee2, the sub-expression A . B appears twice, and not in the indets (indeterminates) of ee2:

indetsee2

X,Y,AαX,AρX,BβY,BρρY

(14)

SubstituteTensorEQ2,ee2

Gα,βXGρρρρX

(15)

Set a kind of letter to represent spinorindices and define a tensor with mixed spacetime and spinor indices

Setupspinorindices=lowercaselatin_is

spinorindices=lowercaselatin_is

(16)

DefineTμ,i,j

Defined objects with tensor properties

B,C,Aμ,γμ,Fμνμν,Gν,α,σμ,Tμ,i,j,μ,gμ,ν,εα,β,μ,ν

(17)

Substitutions in doubly indexed Dirac matrices

SubstituteTensorDgammaμi,j=Tμ,i,j,Dgamma~alpha~k,m

Tα,kmα,km

(18)

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

SubstituteTensorDgammaμi,j=1,Dgamma~alpha~k,m

Free indices on both sides of the equation are different: found i,j,μ on the left-hand side and on the right-hand side

Error, (in Physics:-SubstituteTensor) free indices on both sides of the equation are different

Substitutions of that kind could however be intentional; in those situations you can use the option disregardfreeindices

SubstituteTensorDgammaμi,j=1,Dgamma~alpha~k,m,disregardfreeindices

1

(19)

See Also

algsubs, Check, eval, indets, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, subs, SubstituteTensorIndices

Compatibility

• 

The Physics[SubstituteTensor] command was introduced in Maple 2015.

• 

For more information on Maple 2015 changes, see Updates in Maple 2015.

• 

The Physics[SubstituteTensor] command was updated in Maple 2020.