### The Maxima on-line user's manual

Algebra Calculator

#### Permutations

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.

See also `random_permutation`.

Examples:

```          (%i1) permutations ([a, a]);
(%o1)                       {[a, a]}
(%i2) permutations ([a, a, b]);
(%o2)           {[a, a, b], [a, b, a], [b, a, a]}```

```(%o1)                                true
(%i2) ```

### Related Examples

##### permutations

permutations ([1, 2,3...

Calculate

##### permutations

a:[1,2,3];

b:permutations(a);

c:b[1];

Calculate

##### permutations

permutations([a, c]);

Calculate

##### permutations

permutations ([2, 1]);

Calculate

##### permutations-powerset

permutations ([1, 2]);

powerset ({1, 2, 3},...

Calculate

##### permutations

permutations([a,b,c]);

Calculate

##### permutations

permutations([1,2,3]);

Calculate

##### permutations

permutations([a, c]);

Calculate

##### permutations

p1:[[3],[4],[2],[1],[...

p2:[[2],[4]];

permutations ([p1, p2]);

Calculate

##### permutations-print

a:[1,2,3];

b:permutations(a);

print(b[1]);

Calculate