An introduction to electromagnetic theory