Energy stored in capacitor derivation