a field-theory motivated approach to computer algebra

## factor_out

Isolate common factors in a sum of products
Given a list of symbols, this algorithm tries to factor those symbols out of terms. As an example,
ex:= a b + a c e + a d;
$$\displaystyle{}a b% +a c e% +a d$$
factor_out(_, $a$);
$$\displaystyle{}a \left(b% +c e% +d\right)$$
In case you are familiar with FORM, factor_out is like its bracket statement. If you add more factors to factor out, it works as in the following example.
ex:= a b + a c e + a c + c e + c d + a d;
$$\displaystyle{}a b% +a c e% +a c% +c e% +c d% +a d$$
factor_out(_, $a, c$);
$$\displaystyle{}a \left(b% +d\right)% +a c \left(e% +1\right)% +c \left(e% +d\right)$$
That is, separate terms will be generated for terms which differ by powers of the factors to be factored out. The algorithm of course also works with indexed objects, as in
ex:= A_{m} B_{m} + C_{m} A_{m};
$$\displaystyle{}A_{m} B_{m}% +C_{m} A_{m}$$
factor_out(_, $A_{m}$);
$$\displaystyle{}A_{m} \left(B_{m}% +C_{m}\right)$$