Text this: Generalized theory of electrical machines