Energy formula of the electric field in a capacitor