Mathematical Foundations for Electromagnetic Theory