# usage of canonicalise

+1 vote

Hi,
this is my code

{\mu,\nu}::Indices(vector).
f^{\mu?\nu?}::AntiSymmetric.
h^{\mu?\nu?}::Symmetric.
{u^{\mu?},f^{\mu?\nu?},h^{\mu?\nu?}}::NonCommuting.
ex:=u^{\mu}u^{\nu}f^{\nu\mu}+f^{\mu\nu}h^{\mu\nu};
canonicalise(_);


the result is $0$, it's wrong. How to get the correct result?(i.e. $-u^{\mu}u^{\nu}f^{\mu\nu}$)

edited

The NonCommuting property only relates different objects; your line says that $u^{\mu}$ does not commute with $f^{\mu\nu}$, but it says nothing about how $u^{\mu}$ commutes with $u^{\nu}$. To impose what you want, use SelfNonCommuting, as in:

{\mu,\nu}::Indices(vector).
f^{\mu\nu}::AntiSymmetric.
h^{\mu\nu}::Symmetric.
u^{\mu}::SelfNonCommuting.
ex:=u^{\mu}u^{\nu}f^{\nu\mu}+f^{\mu\nu}h^{\mu\nu};
canonicalise(_);


which then gives $-u^{\mu} u^{\nu} f^{\mu\nu}$.

(I have taken the liberty of removing the question marks on the indices (you don't need them)).