Analysis and computation of electric and magnetic field problems