Processing math: 100%
Cadabra
a field-theory motivated approach to computer algebra

Index brackets

Indices can be associated to tensors, as in Tμν, 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 (A+B+C)αβ,or(ψΓmnΓp)β. Here the objects A, B, C and Γ are matrices, while ψ is a vector. Their explicit components are labelled with α and β indices, but the notation above keeps most of these vector indices implicit.
Cadabra can deal with such expressions through a construction which is called the "indexbracket". It is possible to convert from one form to the other by using the combine and expand algorithms. Combining terms goes like this:
ex:= (\Gamma_r)_{\alpha\beta} (\Gamma_{s t u})_{\beta\gamma}; combine(_);
(Γr)αβ(Γstu)βγ
\indexbracket(\Gamma_{r})_{\alpha \beta} \indexbracket(\Gamma_{s t u})_{\beta \gamma}
(ΓrΓstu)αγ
\indexbracket(\Gamma_{r} \Gamma_{s t u})_{\alpha \gamma}
ex:= (\Gamma_r)_{\alpha\beta} Q_\beta; combine(_);
(Γr)αβQβ
\indexbracket(\Gamma_{r})_{\alpha \beta} Q_{\beta}
(ΓrQ)α
\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(_);
(AB)m
\indexbracket(A B)_{m}
(AB)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(_);
(AB)mn
\indexbracket(A B)_{m n}
AmpBpn
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).
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science