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
|
|
•
|
With the first calling sequence, ContractIndices(T, Indices) will contract from T each pair of indices in the list Indices1 = [[i1, i2], [ i3, i4], ...]. Each index pair must refer to indices of different valance, for example, if i1 is a contravariant index, then i2 must be a covariant index. If T is of type [r, s] (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 [r - k, s - k].
|
•
|
With the second calling sequence, ContractIndices(T, S, Indices) 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 valance. If T is of type [r, s] (contravariant rank r and covariant rank s), S of type [p, q], and if the list Indices2 contains k index pairs, then ContractIndices(T, Indices2) will return a tensor of type [r + p - k, s + q - k].
|
•
|
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
|
|
>
|
|
Example 1.
First create a 4 dimensional manifold M and define a type (2, 3) tensor T on M.
>
|
|
M >
|
|
| (2.1) |
Contract the 1st and 4th indices of T.
M >
|
|
| (2.2) |
Contract the 1st and 4th indices and the 2nd and 3rd indices of T.
M >
|
|
| (2.3) |
Example 2.
Define two rank 3 tensors T and S.
M >
|
|
| (2.4) |
M >
|
|
| (2.5) |
Form the tensor product of T and S and contract the 1st index of T against the 1st index of S.
M >
|
|
| (2.6) |
Form the tensor product of T and S 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 >
|
|
| (2.7) |
Example 3.
Define a type (1, 3) tensor T and evaluate it on the1-form alpha and the vectors X, Y, Z.
M >
|
|
| (2.8) |
M >
|
|
| (2.9) |
M >
|
|
| (2.10) |
|
|