Physics/ToCovariant - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Physics/ToCovariant

Physics[ToCovariant] - rewrite in covariant form the indices of the tensors of a given expression

Physics[ToContravariant] - rewrite in covariant form the indices of the tensors of a given expression

Calling Sequence

ToCovariant(tensorial_expression, optional ...)

ToContravariant(tensorial_expression, optional ...)

Parameters

tensorial_expression

-

any tensorial expression, or a set, list, equation or matrix of them, onto which the operation is performed

Description

• 

When working with tensors in spaces where the covariant and contravariant tensors' components have a different value (the underlying metric is not Euclidean) one frequently wants to express formulations with some or all of the tensors's indices expressed either in covariant or contravariant form. In previous Maple releases, also in Maple 2021, you can raise or lower free indices multiplying by the metric and performing the contraction. That, however, involves a whole simplification process not always desired, and does not result in flipping the character of repeated indices. The SubstituteTensorIndices is also useful for that purpose but requires changing the indices one by one. Instead, to handle the whole manipulation operation, you can use ToCovariant and ToContravariant.

• 

Several options are available to adjust the operation in different ways, as explained in the Options section above. Perhaps two more relevant ones are changecharacteroffreeindices (default value is false), that can be used to receive an expression where you get all free indices flipping their character, and onlytheseindices = ... to restrict the operation to only some of the indices.

• 

Note that closely related to ToCovariant and ToContravariant, the Physics package includes a SubstituteTensorIndices command.

Examples

> 

with⁡Physics:

Set coordinates and a tensor for experimentation; avoid redundant display of functionality using CompactDisplay

> 

Setup⁡coordinates=Cartesian,tensors=Aμ

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

_______________________________________________________

coordinatesystems=X,tensors=Aμ,γμ,σμ,∂μ,gμ,ν,εα,β,μ,ν,Xμ

(1)
> 

CompactDisplay⁡A⁡X

A⁡x,y,z,t⁢will now be displayed as⁢A

(2)

Consider the following tensorial expression, define it as the components of a new tensor Fμ,ν

> 

Fμ,ν=d_μ⁡Aν⁡X−d_ν⁡Aμ⁡X

Fμ,ν=∂μ⁡Aν−∂ν⁡Aμ

(3)
> 

Define⁡

Defined objects with tensor properties

Aμ,γμ,Fμ,ν,σμ,∂μ,gμ,ν,εα,β,μ,ν,Xμ

(4)

The covariant components of Fμ,ν are

> 

F

Fμ,ν=0A2x−A1yA3x−A1zA4x−A.1A1y−A2x0A3y−A2zA4y−A.2A1z−A3xA2z−A3y0A4z−A.3A.1−A4xA.2−A4yA.3−A4z0

(5)

Related to the character of indices, note first that, since Maple 2021, when you request the contravariant components of a tensor definition as F⁢μ,ν, the output is already expressed using the contravariant components of the tensors involved, in this case Aμ

> 

F`~`

F⁢μ,ν⁢μ,ν=0−A⁢2⁢2x+A⁢1⁢1y−A⁢3⁢3x+A⁢1⁢1z−A⁢4⁢4x−A.⁢1⁢1−A⁢1⁢1y+A⁢2⁢2x0−A⁢3⁢3y+A⁢2⁢2z−A⁢4⁢4y−A.⁢2⁢2−A⁢1⁢1z+A⁢3⁢3x−A⁢2⁢2z+A⁢3⁢3y0−A⁢4⁢4z−A.⁢3⁢3A.⁢1⁢1+A⁢4⁢4xA.⁢2⁢2+A⁢4⁢4yA.⁢3⁢3+A⁢4⁢4z0

(6)

The definition of Fμ,ν involves only free and covariant indices; make all the tensors be expressed using covariant indices without changing the mathematical value of the expression

> 

ToContravariant⁡

gα,μ⁢gβ,ν⁢F⁢α,β⁢α,β=gα,μ⁢gβ,ν⁢∂⁢α⁢α⁡A⁢β⁢β−gα,ν⁢gβ,μ⁢∂⁢α⁢α⁡A⁢β⁢β

(7)
> 

indets⁡,Or⁡specindex⁡F,specfunc⁡A

F⁢α,β⁢α,β,A⁢β⁢β

(8)

Restrict that operation to only μ

> 

ToContravariant⁡,only=μ

* Partial match of 'only' against keyword 'onlytheseindices'

gα,μ⁢F⁢αν⁢αν=gα,μ⁢∂⁢α⁢α⁡Aν−gα,μ⁢∂ν⁡A⁢α⁢α

(9)
> 

indets⁡,Or⁡specindex⁡F,specfunc⁡A

Fνανα,Aν,A⁢α⁢α

(10)

In the above we see the tensors originally having μ covariant, now with the index in that position contravariant. To achieve the other possible meaning of to contravariant use the option changecharacteroffreeindices

> 

ToContravariant⁡,only=μ,changecharacter

* Partial match of 'only' against keyword 'onlytheseindices'

* Partial match of 'changecharacter' against keyword 'changecharacteroffreeindices'

F⁢μν⁢μν=∂⁢μ⁢μ⁡Aν−∂ν⁡A⁢μ⁢μ

(11)
> 

indets⁡,Or⁡specindex⁡F,specfunc⁡A

Fνμνμ,Aν,A⁢μ⁢μ

(12)

An expression that has free and repeated indices:

> 

Define⁡A,B,G

Defined objects with tensor properties

B,G,Aμ,γμ,Fμ,ν,σμ,∂μ,gμ,ν,εα,β,μ,ν,Xμ

(13)
> 

Aα⁢Bβ⁢Fμ,ν⁢Gν,α+Aβ⁢Bα⁢Fμ,ρ⁢Gρ,α

Aα⁢Bβ⁢Fμ,ν⁢Gν,α+Aβ⁢Bα⁢Fμ,ρ⁢Gρ,α

(14)

There are several tensors with covariant indices, and the free and repeated indices can be determined using Check

> 

Check⁡,all

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

α,ν,α,ρ,β,μ

(15)

We see the free indices are μ and β, both covariant. To have all the tensors of this expression (but for the metric) with all their indices contravariant, use

> 

ToContravariant⁡

A⁢κ⁢κ⁢gβ,λ⁢B⁢λ⁢λ⁢gμ,σ⁢F⁢σ,τ⁢σ,τ⁢G⁢υ,χ⁢υ,χ⁢gτ,υ⁢gκ,χ+gβ,ν⁢A⁢ν⁢ν⁢B⁢κ⁢κ⁢gλ,μ⁢F⁢λ,σ⁢λ,σ⁢G⁢τ,υ⁢τ,υ⁢gσ,τ⁢gκ,υ

(16)
> 

indets⁡,specindex⁡A,B,F,G

A⁢κ⁢κ,A⁢ν⁢ν,B⁢κ⁢κ,B⁢λ⁢λ,F⁢λ,σ⁢λ,σ,F⁢σ,τ⁢σ,τ,G⁢τ,υ⁢τ,υ,G⁢υ,χ⁢υ,χ

(17)

This result is mathematically equal to the starting expression - all that happened is that the covariant versions of the indices were replaced by the contravariant ones at the cost of adding metric factors, so

> 

Simplify⁡−

0

(18)

In addition to the onlytheseindices option, to perform these operations only on the free indices, you can also use changerepeatedindices = false

> 

ToContravariant⁡,changerepeatedindices=false

Aα⁢gβ,κ⁢B⁢κ⁢κ⁢gλ,μ⁢F⁢λν⁢λν⁢Gν,α+gβ,ν⁢A⁢ν⁢ν⁢Bα⁢gκ,μ⁢F⁢κρ⁢κρ⁢Gρ,α

(19)

See Also

`.`, CompactDisplay, Coordinates, g_, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Setup, SubstituteTensor, SubstituteTensorIndices, TensorArray

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.