Cadabra
a field-theory motivated approach to computer algebra

untrace

Take objects out of traces
When a trace contains objects which do not carry any implicit indices on which the trace acts, the untrace algorithm can be used to take them out of the trace. This is similar to the way in which unwrap takes objects out of derivatives when they do not depend on the object with respect to which the derivative is taken.
Unless you declare objects to have a ImplicitIndex property, they will be taken out. The minimal example does not specify these indices, e.g.
{A,B}::ImplicitIndex. tr{#}::Trace. ex:= tr( q A B ); untrace(_);
\(\displaystyle{}tr\left(q A B\right)\)
tr(q A B)
\(\displaystyle{}q tr\left(A B\right)\)
q tr(A B)
In the declaration of a trace, it is possible to indicate over which indices the trace is being taken.
{a,b,c}::Indices(spinor). {m,n,p}::Indices(vector). C::ImplicitIndex(C_{a b}). D::ImplicitIndex(D_{a b}). E::ImplicitIndex(E^{m n}). Tr{#}::Trace(indices=spinor).
ex:= Tr( C D E );
\(\displaystyle{}Tr\left(C D E\right)\)
Tr(C D E)
untrace(_);
\(\displaystyle{}E Tr\left(C D\right)\)
E Tr(C D)
Note how, even though $E$ has implicit indices, it has been moved out of the trace, as the latter is declared to be a trace over spinor indices, not vector indices.
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science