The theory of electromagnetism