Processing math: 100%
Cadabra
a field-theory motivated approach to computer algebra

collect_factors

Collect identical factors in a product.
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. AmAm does not get reduced to (Am)2).
ex:=A A B A B A;
AABABA
collect_factors(_);
A4B2
Arbitrary powers can be collected this way,
ex:=X X**(-1) X**(-4);
XX1X4
collect_factors(_);
X4
The exponent notation can be expanded again using expand_power.
ex:=X**4; expand_power(_);
X4
XXXX
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science