construct an Array that can be indexed to return the values of a tensorial expression - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Physics : Physics/TensorArray

Physics[TensorArray] - construct an Array that can be indexed to return the values of a tensorial expression

Calling Sequence

TensorArray(expression, ...)

Parameters

expression

-

any algebraic tensorial expression having spacetime free indices possibly having also repeated indices implying summation

freeindices = [...]

-

optional, the right-hand side is a list indicating the ordering of the free indices in the returned output - relevant when expression involves products and sums of tensors with free indices.

performmatrixoperations

-

optional, can be true or false (default), to perform the matrix operations involved in a tensorial expression, for instance when it involves the Pauli or Dirac matrices, represented as 4-vectors

performsumoverrepeatedindices

-

optional, can be true (default) or false, to perform the sum over repeated tensor indices in the returned result

simplifier = ...

-

optional - indicates the simplifier to be used instead; default is none

Description

• 

The TensorArray receives a tensorial expression having n free indices, typically involving sums and products, and returns a corresponding n dimensional Array, which can be indexed as a single object to return the values of the tensorial expression for given values of its free indices.

• 

To check and determine the free and repeated indices of an expression use Check.

• 

The returned Array is constructed taking into account the covariant and contravariant character of each free index in expression. To compute the values of expression you index this array giving values between 1 and the spacetime dimension to the indices.

• 

By default, in the returned result, summation is explicitly performed over all the repeated indices found in expression, taking into account the covariant/contravariant character of each index. To avoid performing this summation and keep repeated indices not summed pass the optional argument performsumoverrepeatedindices = false.

• 

Both Pauli and Dirac Matrices, respectively represented by the Psigma and Dgamma commands, are implemented as 4-vectors, where each component represents a matrix. Thus, when computing tensor arrays of components, one can optionally visualize the matrices behind these 4-vector representations and perform the matrix operations if any. For this purpose, pass the optional argument performmatrixoperations

• 

By default, the Array is constructed without simplifying its components; to have them simplified indicate the simplifier on the right-hand-side of the optional argument simplifier = .... A frequently convenient simplification is achieved with simplifier = simplify.

• 

When expression involves sums and products of tensors having free indices, the ordering of the free indices in the returned Array is arbitrary. To indicated a desired ordering of these free indices, use the option freeindices = [...] where the list [...] indicates the desired ordering.

Examples

withPhysics:

Setupmathematicalnotation=true

mathematicalnotation=true

(1)

Set the spacetime metric to be the Schwarzschild metric and construct an Array for the product of the metric tensor g_ contracted and multiplied with an arbitrary tensor A  as in gμ,ρAρAν For this purpose, set first the metric and the coordinates -you can use Setup for that, or because the Schwarzschild metric is known to the system you can directly pass the keyword or an abbreviation of it to the metric g_ to do all in one step

g_sc

_______________________________________________________

Systems of spacetime coordinates are:X=r,θ,φ,t

Default differentiation variables for d_, D_ and dAlembertian are:X=r,θ,φ,t

The Schwarzschild metric in coordinates r,θ,φ,t

Parameters: m

_______________________________________________________

g_μ,ν=rr+2m0000r20000r2sinθ20000r2mr

(2)

Define now an arbitrary tensor A

DefineA

Defined objects with tensor properties

A,μ,γμ,σμ,Rμ,ν,Rμ,ν,α,β,Cμ,ν,α,β,Xμ,μ,gμ,ν,Γμ,ν,α,Gμ,ν,εα,β,μ,ν

(3)

Construct now the tensorial expression mentioned

g_μ,ρA`~rho`Aν

gμ,ρAρρAν

(4)

Check the indices

Check,all

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

ρ,μ,ν

(5)

Construct now the tensor-array

TTensorArray

A1A~1rr+2mA2A~1rr+2mA3A~1rr+2mA4A~1rr+2mA1r2A~2A2r2A~2A3r2A~2A4r2A~2A1A~3r2sinθ2A2A~3r2sinθ2A3A~3r2sinθ2A4A~3r2sinθ2A1A~4r+2mrA2A~4r+2mrA3A~4r+2mrA4A~4r+2mr

(6)

In the above, the sum over ρ is performed. With performsumoverrepeatedindices = false the sum is not performed:

TensorArray,performsumoverrepeatedindices=false

g_1,ρA~rhoA1g_1,ρA~rhoA2g_1,ρA~rhoA3g_1,ρA~rhoA4g_2,ρA~rhoA1g_2,ρA~rhoA2g_2,ρA~rhoA3g_2,ρA~rhoA4g_3,ρA~rhoA1g_3,ρA~rhoA2g_3,ρA~rhoA3g_3,ρA~rhoA4g_4,ρA~rhoA1g_4,ρA~rhoA2g_4,ρA~rhoA3g_4,ρA~rhoA4

(7)

Also, in (6) the ordering of the free indices μ,ν is not defined. In the computations above, TensorArray choose the ordering μ,ν but one may prefer, for instance, ν,μ, resulting in the transpose of the matrix (8). To indicate any desired ordering you can use the optional argument freeindices = [...]

TTensorArray,freeindices=ν,μ

A1A~1rr+2mA1r2A~2A1A~3r2sinθ2A1A~4r+2mrA2A~1rr+2mA2r2A~2A2A~3r2sinθ2A2A~4r+2mrA3A~1rr+2mA3r2A~2A3A~3r2sinθ2A3A~4r+2mrA4A~1rr+2mA4r2A~2A4A~3r2sinθ2A4A~4r+2mr

(8)

Rewrite the Riemann tensor with all its indices covariant in terms of Christoffel symbols and their derivatives and construct a tensor-array for the resulting tensorial expression; in view of the presence of trigonometric functions, use the simplifier option

Riemannμ,ν,α,β

Rα,β,μ,ν

(9)

convert,Christoffel

gα,λμΓλβ,νλβ,ννΓλβ,μλβ,μ+Γλμ,υλμ,υΓυβ,νυβ,νΓλν,υλν,υΓυβ,μυβ,μ

(10)

RTensorArray,simplifier=simplify

_rtable18446884251904522710

(11)

Verify the result comparing R, constructed with the definition of Riemann in terms of Christoffel symbols, with the Riemann tensor itself

R1,3,1,3

sinθ2mr+2m

(12)

Riemann1,3,1,3

sinθ2mr+2m

(13)

Compare all the nonzero values of the two arrays: for Riemann, pass the option nonzero, for R use ArrayElems; all the nonzero components are same:

Riemannnonzero

Rα,β,μ,ν=1,2,1,2=mr+2m,1,2,2,1=mr+2m,1,3,1,3=sinθ2mr+2m,1,3,3,1=sinθ2mr+2m,1,4,1,4=2mr3,1,4,4,1=2mr3,2,1,1,2=mr+2m,2,1,2,1=mr+2m,2,3,2,3=2rmsinθ2,2,3,3,2=2rmsinθ2,2,4,2,4=r+2mmr2,2,4,4,2=2m2+mrr2,3,1,1,3=sinθ2mr+2m,3,1,3,1=sinθ2mr+2m,3,2,2,3=2rmsinθ2,3,2,3,2=2rmsinθ2,3,4,3,4=sinθ2r+2mmr2,3,4,4,3=sinθ2r+2mmr2,4,1,1,4=2mr3,4,1,4,1=2mr3,4,2,2,4=2m2+mrr2,4,2,4,2=r+2mmr2,4,3,3,4=sinθ2r+2mmr2,4,3,4,3=sinθ2r+2mmr2

(14)

ArrayElemsR

1,2,1,2=mr+2m,1,2,2,1=mr+2m,1,3,1,3=sinθ2mr+2m,1,3,3,1=sinθ2mr+2m,1,4,1,4=2mr3,1,4,4,1=2mr3,2,1,1,2=mr+2m,2,1,2,1=mr+2m,2,3,2,3=2rmsinθ2,2,3,3,2=2rmsinθ2,2,4,2,4=r+2mmr2,2,4,4,2=2m2+mrr2,3,1,1,3=sinθ2mr+2m,3,1,3,1=sinθ2mr+2m,3,2,2,3=2rmsinθ2,3,2,3,2=2rmsinθ2,3,4,3,4=sinθ2r+2mmr2,3,4,4,3=sinθ2r+2mmr2,4,1,1,4=2mr3,4,1,4,1=2mr3,4,2,2,4=2m2+mrr2,4,2,4,2=r+2mmr2,4,3,3,4=sinθ2r+2mmr2,4,3,4,3=sinθ2r+2mmr2

(15)

evalbsimplifyrhs=

true

(16)

A contraction of the Riemann tensor over two of its indices

Riemannα,β,μ,νRiemann`~alpha`,`~beta`,`~nu`,`~sigma`

Rα,β,μ,νRα,β,ν,σα,β,ν,σ

(17)

Check,all

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

α,β,ν,μ,~sigma

(18)

TensorArray,simplifier=simplify

12m2r6000012m2r6000012m2r6000012m2r6

(19)

When Physics is loaded, the standard representation of the Dirac matrices is automatically set. These matrices, as Pauli matrices, are implemented as 4-vectors in a Minkowski spacetime

Setupcoordinates=cartesian,metric=minkowski,spaceindices=lowercaselatin

Default differentiation variables for d_, D_ and dAlembertian are:X=x,y,z,t

Systems of spacetime coordinates are:X=x,y,z,t

_______________________________________________________

The Minkowski metric in coordinates x,y,z,t

_______________________________________________________

_______________________________________________________

coordinatesystems=X,metric=1,1=−1,2,2=−1,3,3=−1,4,4=1,spaceindices=lowercaselatin

(20)

g_[]

g_μ,ν=1000010000100001

(21)

Psigmadefinition

%CommutatorPsigmaa,Psigmab=2Iεa,bca,bcσc,%AntiCommutatorPsigmaa,Psigmab=2ga,b

(22)

The components of the first of these equations are

TensorArray1

%CommutatorPsigma1,Psigma1=0%CommutatorPsigma1,Psigma2=2IPsigma3%CommutatorPsigma1,Psigma3=2IPsigma2%CommutatorPsigma2,Psigma1=2IPsigma3%CommutatorPsigma2,Psigma2=0%CommutatorPsigma2,Psigma3=2IPsigma1%CommutatorPsigma3,Psigma1=2IPsigma2%CommutatorPsigma3,Psigma2=2IPsigma1%CommutatorPsigma3,Psigma3=0

(23)

In the above the commutators are expressed in inert form. To perform the matrix operations involved in these components you can use performmatrixoperations together with value to activate the inert commutators.

valueTensorArray1,performmatrixoperations

0000=00002I002I=2I002I0220=02202I002I=2I002I0000=000002I2I0=02I2I00220=022002I2I0=02I2I00000=0000

(24)

See Also

Check, Coordinates, Define, g_, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Setup

References

  

Landau, L.D., and Lifshitz, E.M. The Classical Theory of Fields, Course of Theoretical Physics Volume 2, fourth revised English edition. Elsevier, 1975.

Compatibility

• 

The Physics[TensorArray] command was introduced in Maple 16.

• 

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

• 

The Physics[TensorArray] command was updated in Maple 2019.