1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
\cdbalgorithm{factor\_in}{}
Given a list of symbols, this algorithm collects terms in a sum that
only differ by pre-factors consisting of these given symbols. As an
example,
\begin{screen}{1,2}
a b + a c + a d:
@factor_in!(%){b,c};
(b + c) a + a d;
\end{screen}
The name is perhaps most easily understood by thinking of it as a
complement to {\tt factor\_out}. Or in case you are familiar with
FORM, {\tt factor\_in} is like its {\tt antibracket} statement.
The algorithm of course also works with indexed objects, as in
\begin{screen}{1,2}
A_{m} B_{m} + C_{m} A_{m};
@factor_in!(%){B_{n},C_{n}};
(B_{m} + C_{m}) A_{m};
\end{screen}
(this is still work in progress).
\cdbseealgo{factor_out}
|