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

In my recent study, I encounter the following problem:

ex:=A B (a-b)+B A (b-a)+A C (a-c)+C A (c-a)+B C (b-c)+C B (c-b);

How to simplify the expression above? i.e. get the result $$ (AB-BA)(a-b)+(AC-CA)(a-c)+(BC-CB)(b-c) $$

in General questions by (2.1k points)
edited by

1 Answer

0 votes

Remember that you need to write either a space or a * character to indicate products. Also, NonCommuting is spelled with a single t.

What do you want to do with this? You can distribute(_) this, but there isn't much else you can simplify given that the capital symbols do not commute with each other.

by (82.0k points)

Sorry for my typo. I want to extract the scalars in the following expression (the matrices outside the brackets are noncommuting)


I have written following code

substitute(_,$A?? (B??)+ C?? (D??)|B??+D??=0->(A??-C??) B??$);

but it's useless.

I don't understand what you want to do. Can you write down the expression that you would like to end up with?

I have known how to solve it. Only need to combine multiply_through ,zoom and factor_out.

Hi @Eureka, Could you please port your answer? So we can all benefit from it. Thx.

For example:

ex:=A B (a-b)+B A (b-a);
import cdb.core.manip as manip
zoom(_,$B A A??$);

But I have no ideas how to solve my practical problem simply. .