Lectures on the electromagnet