Index brackets
Indices can be associated to tensors, as in $T_{\mu\nu}$, but it often also happens that we want to associate indices to a sum or product of tensors, without writing all indices out explicitly. Examples are \begin{equation*} (A + B + C)_{\alpha\beta}\,,\quad\text{or}\quad (\psi \Gamma_{m n} \Gamma_{p})_{\beta}\,. \end{equation*} Here the objects $A$, $B$, $C$ and $\Gamma$ are matrices, while $\psi$ is a vector. Their explicit components are labelled with $\alpha$ and $\beta$ indices, but the notation above keeps most of these vector indices implicit.ex:= (\Gamma_r)_{\alpha\beta} (\Gamma_{s t u})_{\beta\gamma};
combine(_);
\(\displaystyle{}\left(\Gamma_{r}\right)\,_{\alpha \beta} \left(\Gamma_{s t u}\right)\,_{\beta \gamma}\)
\indexbracket(\Gamma_{r})_{\alpha \beta} \indexbracket(\Gamma_{s t u})_{\beta \gamma}
\(\displaystyle{}\left(\Gamma_{r} \Gamma_{s t u}\right)\,_{\alpha \gamma}\)
\indexbracket(\Gamma_{r} \Gamma_{s t u})_{\alpha \gamma}
ex:= (\Gamma_r)_{\alpha\beta} Q_\beta;
combine(_);
\(\displaystyle{}\left(\Gamma_{r}\right)\,_{\alpha \beta} Q_{\beta}\)
\indexbracket(\Gamma_{r})_{\alpha \beta} Q_{\beta}
\(\displaystyle{}\left(\Gamma_{r} Q\right)\,_{\alpha}\)
\indexbracket(\Gamma_{r} Q)_{\alpha}
If the index bracket has only one index, either the first or the last
argument should be a matrix, but not both:
A::Matrix.
{m,n,p}::Indices(vector).
ex:= (A B)_{m};
expand(_);
\(\displaystyle{}\left(A B\right)\,_{m}\)
\indexbracket(A B)_{m}
\(\displaystyle{}\left(A B\right)\,_{m}\)
\indexbracket(A B)_{m}
If the index bracket has two indices, all arguments should be matrices,
{A,B}::Matrix.
{m,n,p}::Indices(vector).
ex:= (A B)_{m n};
expand(_);
\(\displaystyle{}\left(A B\right)\,_{m n}\)
\indexbracket(A B)_{m n}
\(\displaystyle{}A_{m p} B_{p n}\)
A_{m p} B_{p n}
If there are more arguments inside the bracket, these of course all
need to be matrices (and are assumed to be so by default).