The simplest way of varying the flux produced by an electromagnet smoothly in an electrical device is by :