Calculate the charge of a capacitor