Transformations, also known as endofunctions, are superset of permutations where repeated elements in the codomain are allowed. Composing transformations can be done with the same algorithm as permutations.

My particiular interest in transformations is their application in sofware testing, but they are a ubiquitous concept in mathematics and sofware engineering.

As we play with transformations it will be nice to have the following enumerator that generates natural numbers starting at zero.

Now if we want to print all transformations of size k we can use an enumerator.

A first question we should ask ourselves, “Since transformations are a superset of permutations, do they have any analogues?”

The answer is a resounding yes!

As we explore transformations and related mathematical structures many will be crossreferenced with their OEIS sequence. I have a few dozen queued up so this should take a few posts :)