what is the purpose of a electrical capacitor and how is it wired