i,j can be symbols, strings or numbers,
apart from 0,1 and 2 which are reserved respectively
for commuting, anticommuting tensors and tensors not commuting
with any other group apart with the commuting tensors.
For the remaining cases, use this method to set the commutation rules;
by default c=None.

The group commutation number c is assigned in correspondence
to the group commutation symbols; it can be

0 commuting

1 anticommuting

None no commutation property

Examples

G and GH do not commute with themselves and commute with
each other; A is commuting.

In the case of antisymmetric metric, the following raising and
lowering conventions will be adopted:

psi(a)=g(a,b)*psi(-b);chi(-a)=chi(b)*g(-b,-a)

g(-a,b)=delta(-a,b);g(b,-a)=-delta(a,-b)

where delta(-a,b)=delta(b,-a) is the Kroneckerdelta
(see TensorIndex for the conventions on indices).

If there is no metric it is not possible to raise or lower indices;
e.g. the index of the defining representation of SU(N)
is ‘covariant’ and the conjugate representation is
‘contravariant’; for N>2 they are linearly independent.

eps_dim is by default equal to dim, if the latter is an integer;
else it can be assigned (for use in naive dimensional regularization);
if eps_dim is not an integer epsilon is None.

If you want the index name to be automatically assigned, just put True
in the name field, it will be generated using the reserved character
_ in front of its name, in order to avoid conflicts with possible
existing indices:

Notice that with the shape [2,2] we associate only the monoterm
symmetries of the Riemann tensor; this is an abuse of notation,
since the shape [2,2] corresponds usually to the irreducible
representation characterized by the monoterm symmetries and by the
cyclic symmetry.

A TensorHead belongs to a commutation group, defined by a
symbol on number comm (see _TensorManager.set_comm);
tensors in a commutation group have the same commutation properties;
by default comm is 0, the group of the commuting tensors.

Examples with ndarray values, the components data assigned to the
TensorHead object are assumed to be in a fully-contravariant
representation. In case it is necessary to assign components data which
represents the values of a non-fully covariant tensor, see the other
examples.

When all indices are contracted and components data are added to the tensor,
accessing the data will return a scalar, no array object. In fact, arrays
are dropped to scalars if they contain only one element.

>>> A(i0,-i0)A(L_0, -L_0)>>> A(i0,-i0).data-18

It is also possible to assign components data to an indexed tensor, i.e. a
tensor with specified covariant and contravariant components. In this
example, the covariant components data of the Electromagnetic tensor are
injected into \(A\):

A tensor expression is an expression formed by tensors;
currently the sums of tensors are distributed.

A TensExpr can be a TensAdd or a TensMul.

TensAdd objects are put in canonical form using the Butler-Portugal
algorithm for canonicalization under monoterm symmetries.

TensMul objects are formed by products of component tensors,
and include a coefficient, which is a SymPy expression.

In the internal representation contracted indices are represented
by (ipos1,ipos2,icomp1,icomp2), where icomp1 is the position
of the component tensor with contravariant index, ipos1 is the
slot which the index occupies in that component tensor.

Contracted indices are therefore nameless in the internal representation.

The tensor A is symmetric in its indices, as can be deduced by the
[1,1] Young tableau when constructing \(sym2\). One has to be
careful to assign symmetric component data to A, as the symmetry
properties of data are currently not checked to be compatible with the
defined tensor symmetry.

args[1] list of (ind,ipos,icomp)
where ind is a free index, ipos is the slot position
of ind in the icomp-th component tensor.

args[2] list of tuples representing dummy indices.
(ipos1,ipos2,icomp1,icomp2) indicates that the contravariant
dummy index is the ipos1-th slot position in the icomp1-th
component tensor; the corresponding covariant index is
in the ipos2 slot position in the icomp2-th component tensor.