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)$?

in General questions by (1.5k 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__()).

by (76.6k points)