Maxima Function
permutations (a)
Returns a set of all distinct permutations of the members of the list or set a. Each permutation is a list, not a set.
When a is a list, duplicate members of a are included in the permutations.
permutations
complains if a is not a literal list or set.
Examples:
(%i1) permutations ([a, a]); (%o1) {[a, a]} (%i2) permutations ([a, a, b]); (%o2) {[a, a, b], [a, b, a], [b, a, a]}