Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
0 votes

I want to achieve following rule

...a b c d...->c d... ...a b

I have tried function substitute, but I have no idea how to achieve it. My recent work need this operation. Are there any suggestions about it?

For example, everything is NonCommuting and depends \partial{#} in following formula $$ a b \partial_{\mu} c d $$

I must exchange $a b$ with $ \partial_{\mu} c d $ to get

$$ \partial_{\mu} {c} d a b $$

then use substitute or integrate_by_parts to get


  • c \partial_{\mu}(d a b) $$

I am trapped in this point now.

in General questions by (1.3k points)
edited by

I know you want this for cyclicity of the trace, am adding that directly (will be much more convenient that substitution by hand). Give me a day or two.

Yes, I want this now, but I also want to konw how to implement above operation by substiute (or other functions) directly. It is a very general problem, and I probably meet it in other situations, not only in trace.(After all, we often need to change Part1 Part2 into Part2 Part1.) If there are any simple solutions, please let me konw, and I need to konw.

I have updated my question with adding a concrete example.

Please log in or register to answer this question.