contract the indices of a tensor - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : DifferentialGeometry : Tensor : DifferentialGeometry/Tensor/ContractIndices

Tensor[ContractIndices] - contract the indices of a tensor

Calling Sequences

     ContractIndices(T, Indices1)

     ContractIndices(T, S, Indices2)

Parameters

   T         - a tensor

   S         - (optional) a tensor

   Indices1  - a list of pairs of integers i1,i2,i3,i4,... referring to the arguments of T which are to be contracted

   Indices2  - a list of pairs of integers i1,i2,i3,i4,... referring to the arguments of T and S which are to be contracted

 

Description

Examples

Description

• 

With the first calling sequence, ContractIndices(T, Indices) will contract from T each pair of indices in the list Indices = i1,i2,i3,i4,.... Each index pair must refer to indices of different valence, for example, if i1 is a contravariant index, then i2 must be a covariant index. If T is of type rs (contravariant rank r and covariant rank s) and the list Indices1 contains k index pairs, then ContractIndices(T, Indices1) will return a tensor of type rksk.

• 

With the second calling sequence, ContractIndices(T, S, Indices), where Indices = i1,i2,i3,i4,..., will contract the i1 index of T with the i2 index S, the i3 index of T with the i4 index S and so on. Each index pair must refer to indices of different valence. If T is of type rs, S of type pq, and if the list Indices2 contains k index pairs, then ContractIndices(T, Indices2) will return a tensor of type r+pks+qk.

• 

This command is part of the DifferentialGeometry:-Tensor package, and so can be used in the form ContractIndices(...) only after executing the command with(DifferentialGeometry) and with(Tensor) in that order. It can always be used in the long form DifferentialGeometry:-Tensor:-ContractIndices.

Examples

withDifferentialGeometry:withTensor:

 

Example 1.

First create a 4 dimensional manifold M and define a type 23 tensor T on M.

DGsetupx,y,z,w,M:

M > 

TevalDGaD_x &t D_x &t dz &t dx &t dz+bD_x &t D_z &t dz &t dx &t dw

T:=aD_xD_xdzdxdz+bD_xD_zdzdxdw

(2.1)

 

Contract the 1st and 4th indices of T.

M > 

ContractIndicesT,1,4

aD_xdzdz+bD_zdzdw

(2.2)

 

Contract the 1st and 4th indices and the 2nd and 3rd indices of T.

M > 

ContractIndicesT,1,4,2,3

bdw

(2.3)

 

Example 2.

Define two rank 3 tensors T and S.

M > 

TevalDGadx &t D_z &t D_y+bdx &t D_x &t D_x+cdw &t D_w &t D_z

T:=bdxD_xD_x+adxD_zD_y+cdwD_wD_z

(2.4)
M > 

SevalDGdD_x &t D_z &t dy+eD_y &t D_x &t dz+fD_w &t D_w &t dw

S:=dD_xD_zdy+eD_yD_xdz+fD_wD_wdw

(2.5)

 

Form the tensor product TS and contract the 1st index of T against the 1st index of S.

M > 

ContractIndicesT,S,1,1

bdD_xD_xD_zdy+adD_zD_yD_zdy+cfD_wD_zD_wdw

(2.6)

 

Form the tensor product TS and contract the 1st index of T against the 1st index of S and the 2nd index of T against the 3rd index of S.

M > 

ContractIndicesT,S,1,1,2,3

cfD_zD_w

(2.7)

 

Example 3.

Define a type 13 tensor T and evaluate it on the1-form α and the vectors X,Y,Z.

M > 

TevalDGaD_x &t dx &t dz &t dy+bD_y &t dx &t dx &t dz+cD_w &t dx &t dy &t dz

T:=aD_xdxdzdy+bD_ydxdxdz+cD_wdxdydz

(2.8)
M > 

αevalDGdxdy+dz3dw

α:=dxdy+dz3dw

(2.9)
M > 

XD_x:YD_y:ZD_z:

M > 

ContractIndicesT,α &t X &t Y &t Z,1,1,2,2,3,3,4,4

3c

(2.10)

See Also

DifferentialGeometry

Tensor

RaiseLowerIndices

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam