# Permutation calculator

This program deals with permutations of finite sets, that is, bijective functions from a finite set to itself. (This is something I've mostly encountered in group theory, in the form of the symmetric and alternating groups.) (Note: this is not for calculating the number of permutations of a set.)

You can enter a permutation in cycle notation, and see it as a product of disjoint cycles, a product of transpositions, and two-line notation. Supported notation includes:

• `(1 2 3)` (generally, `(elem1 elem2...)`): a cycle where 1 goes to 2, 2 goes to 3, and 3 goes to 1. Cycles can be any length, and the elements can be anything as long as they don't include spaces or parentheses.
• `(1 2 3)(2 3)` (generally, `expression1 expression2`): composition of cycles. By default, this applies `(2 3)` first, then `(1 2 3)` (similar to how, for functions, fg applies g first and then f), but that can be changed in the options.
• `(1 2 3)^2` (generally, `expression1 ^ integer`): composes a cycle with itself 2 times. 2 can be replaced with any integer n to compose with itself n times. `(1 2 3)^-1` gives the inverse of a cycle. To compose a larger expression with itself n times, enclose it in parentheses (e.g., `((1 2 3)(2 3))^2`).
• `e` or `id`: the identity permutation (takes every element to itself)

When entering cycles, the program will infer what the set is from what elements were included in the cycles. (This is why it shows the number of non–fixed points, rather than the number of fixed points, since the set you wanted might be bigger than what it inferred.)

You can also enter in two-line notation, and see them in cycle notation. Use Tab to move between fields left to right, and Return/Enter to move from the top row to the bottom row and then up to the top of the next column.

## Options

Apply cycles: Right to left (like function composition); Left to right 1-cycle (spaces required); 2-cycle (spaces optional if everything's a single characters)

## Modify

a = current permutation, g = , n =

Replace current permutation with: