Cadabra
a field-theory motivated approach to computer algebra

einsteinify

Raise or lower indices of pairs which are both upper or lower.
In an expression containing dummy indices at the same position (i.e. either both subscripts or both superscripts), raise or lower one of the indices.
ex:= A_{m} A_{m}; einsteinify(_);
\(\displaystyle{}A_{m} A_{m}\)
A_{m} A_{m}
\(\displaystyle{}A^{m} A_{m}\)
A^{m} A_{m}
ex:= A^{m} A^{m}; einsteinify(_);
\(\displaystyle{}A^{m} A^{m}\)
A^{m} A^{m}
\(\displaystyle{}A_{m} A^{m}\)
A_{m} A^{m}
If an additional argument is given to this algorithm, it instead inserts "inverse metric" objects, with the name as indicated by the additional argument.
{m,n}::Indices. ex:= A_{m} A_{m}; einsteinify(_, $\eta$);
\(\displaystyle{}A_{m} A_{m}\)
A_{m} A_{m}
\(\displaystyle{}A_{m} A_{n} \eta^{m n}\)
A_{m} A_{n} \eta^{m n}
ex:= A^{m} A^{m}; einsteinify(_, $\eta$);
\(\displaystyle{}A^{m} A^{m}\)
A^{m} A^{m}
\(\displaystyle{}A_{m} A_{n} \eta^{m n}\)
A_{m} A_{n} \eta^{m n}
Note that the second form requires that there are enough dummy indices defined through the use of Indices.
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science