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

sort_sum

Sort terms in a sum.
Sort terms in a sum, taking into account any SortOrder properties, or else sorting lexographically.
ex:=E+D+A+C+B;
E+D+A+C+B
sort_sum(_);
A+B+C+D+E
This is often useful in case sums appear as exponents; in this case it is necessary to first sort the sums before terms can be collected, as the following example shows.
ex:=a**(-1+d) - a**(d-1);
a(1+d)a(d1)
sort_sum(_);
0
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science