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;
factor_in(_,$A,B$);

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

in General questions by (2.2k points)

1 Answer

0 votes
 
Best answer

You can use sympy.factor, e.g.

ex:= A C + B C - A D -  B D;
ex=Ex(sympy.factor(ex).__str__())

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

by (82.6k points)
selected by
...