\cdbalgorithm{collect\_factors}{}

Collect factors in a product that differ only by their exponent. Note
that factors containing sub- or superscripted indices do not get
collected (i.e.~$A_m A^m$ does not get reduced to $(A_m)^2$).
\begin{screen}{1,2}
A A B A B A;
@collect_factors!(%);
A**4 B**2;
\end{screen}
Arbitrary powers can be collected this way,
\begin{screen}{1,2}
X X**(-1) X**(-4);
@collect_factors!(%);
X**(-3);
\end{screen}
The exponent notation can be expanded again 
using \subscommand{expand\_power}.

~

\cdbseealgo{expand_power}
\cdbseealgo{collect_terms}
