Theory and Computation of Electromagnetic Fields