# Indices

Declare names to be used as indices.

Declare index names to be usable for dummy index
purposes. Typical usage is of the form{r,s,t}::Indices(vector);
{a,b,c,d}::Indices(spinor);

\(\displaystyle{}\text{Attached property Indices(position=free) to }(r, s, t).\)

\(\displaystyle{}\text{Attached property Indices(position=free) to }(a, b, c, d).\)

This indicates the name of the index set ("vector" resp. "spinor"
in the example above).

Indices can occur as subscripts or superscripts, and you may use this
to indicate e.g. covariant and contravariant transformation
behaviour. In this case, use the additional
argument

`position=fixed`

to indicate that the position carries
meaning. If you do not want cadabra to automatically raise or lower
indices when canonicalising expressions, or if upper and lower indices
are not related at all, use `position=independent`

. The default is
`position=free`

, which means that indices in a pair can be positioned anywhere and
their position carries no meaning. Be aware that this is not what you want if there
is a metric involved!When you work with vector spaces which are subspaces of larger spaces,
it is possible to indicate that a given set of indices take values in
a subset of values of a larger set. An example makes this more
clear. Suppose we have one set of indices $A,B,C$ which take values in
a four-dimensional space, and another set of indices $a,b,c$ which
take values in a three-dimensional subspace. This is declared as

{A,B,C}::Indices(fourD);
{a,b,c}::Indices(threeD, parent=fourD);

\(\displaystyle{}\text{Attached property Indices(position=free) to }(A, B, C).\)

\(\displaystyle{}\text{Attached property Indices(position=free) to }(a, b, c).\)

This will allow Cadabra to canonicalise expressions which contain mixed
index types, as in

{A,B,C}::Indices(fourD);
{a,b,c}::Indices(name=threeD, parent=fourD);
M_{q? r?}::AntiSymmetric;
ex:=M_{a A} + M_{A a};

\(\displaystyle{}\text{Attached property Indices(position=free) to }(A, B, C).\)

\(\displaystyle{}\text{Attached property Indices(position=free) to }(a, b, c).\)

\(\displaystyle{}\text{Attached property AntiSymmetric to }{M}_(q?r?).\)

\(\displaystyle{}M_{a A}+M_{A a}\)

canonicalise(_);

\(\displaystyle{}0\)

Note the way in which the symmetry of the $M$ tensor was declared here.