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

I have a naive question. Is there a general method to use some codes like this

ex:=A C+B C-A D-B D;

to obtain $(A+B)(C-D)$?

asked in General questions by (840 points)

1 Answer

0 votes

You can use sympy.factor, e.g.

ex:= A C + B C - A D -  B D;

(I should probably add automatic conversion from sympy objects to Ex, so that you can avoid the __str__()).

answered by (57.2k points)