Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+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}$)

in General questions by (2.2k points)
edited by

1 Answer

+3 votes
 
Best answer

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)).

by (82.5k points)
selected by

Thanks, it works.

...