Energy derivation of capacitor