Cadabra
a field-theory motivated approach to computer algebra

meld

Combine terms when allowed by symmetries.
In a sum of terms, combine terms using mono-term and multi-term symmetries such that the expression does not use an overcomplete basis. The meld algorithm does not rewrite the expression to a canonical form, but it instead combines terms such that no terms remain which are a linear combination of the other terms. It can hence be used to prove equivalency of expressions under both mono-term and multi-term symmetries.
A typical use cases where meld is preferable over e.g. canonicalise is when the expression contains tensors with multi-term symmetries:
R_{a b c d}::RiemannTensor; ex:=R_{a b c d}R_{a b c d} + R_{a b c d}R_{a c b d}; meld(ex);
\(\displaystyle{}\text{Attached property TableauSymmetry to }R_{a b c d}.\)
\(\displaystyle{}R_{a b c d} R_{a b c d}+R_{a b c d} R_{a c b d}\)
R_{a b c d} R_{a b c d} + R_{a b c d} R_{a c b d}
\(\displaystyle{}3R_{a b c d} R_{a c b d}\)
3R_{a b c d} R_{a c b d}
What has happened here is that the algorithm figured out that the first term is expressible in terms of the second, and has combined the two. If you write the terms in the opposite order, meld still combines them, but now in the form of the other term:
ex:=R_{a b c d}R_{a c b d}+ R_{a b c d}R_{a b c d}; meld(ex);
\(\displaystyle{}R_{a b c d} R_{a c b d}+R_{a b c d} R_{a b c d}\)
R_{a b c d} R_{a c b d} + R_{a b c d} R_{a b c d}
\(\displaystyle{}\frac{3}{2}R_{a b c d} R_{a b c d}\)
3/2 R_{a b c d} R_{a b c d}
So meld does not canonicalise, but rather writes the expression such that there remain no linear dependencies between terms.
This algorithm can of course be used for simpler situations, e.g. one which uses mono-term symmetries only:
A_{m n}::AntiSymmetric; ex:=A_{m n} - A_{n m}; meld(ex);
\(\displaystyle{}\text{Attached property AntiSymmetric to }A_{m n}.\)
\(\displaystyle{}A_{m n}-A_{n m}\)
A_{m n}-A_{n m}
\(\displaystyle{}-2A_{n m}\)
-2A_{n m}
The algorithm also handles cyclic symmetries of traces:
{\mu,\nu}::Indices(vector). u^{\mu}::ImplicitIndex. u^{\mu}::SelfNonCommuting. tr{#}::Trace. ex := tr{u^{\mu} u^{\mu} u^{\nu} u^{\nu}} - tr{u^{\mu} u^{\nu} u^{\nu} u^{\mu}}; meld(ex);
\(\displaystyle{}tr\left(u^{\mu} u^{\mu} u^{\nu} u^{\nu}\right)-tr\left(u^{\mu} u^{\nu} u^{\nu} u^{\mu}\right)\)
tr(u^{\mu} u^{\mu} u^{\nu} u^{\nu})-tr(u^{\mu} u^{\nu} u^{\nu} u^{\mu})
\(\displaystyle{}0\)
0
Copyright © 2001-2020 Kasper Peeters
Questions? info@cadabra.science