# Question about meld

The following codes seem to have encountered some problems when using algorithm 'meld':

{\mu,\nu}::Indices(vector).
tr{#}::Trace.
u^{\mu}::SelfNonCommuting.
u^{\mu}::ImplicitIndex.
ex:=A tr{u^{\mu} u^{\nu} u^{\mu} u^{\nu}}+B tr{ u^{\mu} u^{\mu} u^{\nu} u^{\nu}};
meld(_);
factor_in(_,$A,B$);

edited

Not sure what you expect here; meld leaves it untouched and so does factor_in.

I'm sorry for my carelessness. The right code is

{\mu,\nu}::Indices(vector).
tr{#}::Trace.
u^{\mu}::SelfNonCommuting.
u^{\mu}::ImplicitIndex.
ex:=A tr{u^{\nu} u^{\mu} u^{\mu} u^{\nu}}+B tr{ u^{\mu} u^{\mu} u^{\nu} u^{\nu}};
meld(_);
factor_in(_,$A,B$);

I want to use meld & factor_in to get the following result: $$(A+B) tr(u^\mu u^\mu u^\nu u^\nu)$$ but I failed, is this a bug? I find the algorithm meld seems to be unsound, the following code is another example:

{\mu,\nu,\rho}::Indices(vector).
A^{\mu\nu}::AntiSymmetric.
B^{\mu\nu}::Symmetric.
C^{\mu\nu}::AntiSymmetric.
tr{#}::Trace.
{A^{\mu\nu},B^{\mu\nu},C^{\mu\nu}}::NonCommuting.
{A^{\mu\nu},B^{\mu\nu},C^{\mu\nu}}::SelfNonCommuting.
{A^{\mu\nu},B^{\mu\nu},C^{\mu\nu}}::ImplicitIndex.
ex:=a tr{A^{\mu\nu} B^{\mu\rho} B^{\nu\rho}}+b tr{C^{\mu\nu} A^{\mu\rho} B^{\nu\rho}}+c tr{C^{\mu\nu} B^{\mu\rho} A^{\nu\rho}};
meld(_);

The result is $$\left(a+b+c\right) tr\left(A^{\mu \nu} B^{\mu \rho} B^{\nu \rho}\right).$$ This is very strange.

Hi, I can confirm that using version 2.3.9.4 the result of your first expression is not the expected.

Please note, however, that the second expression in the comment right above mine is not right: one of the traces contains ABB while the others have ABC, so I couldn't obtain the expected result either.