Charging a capacitor stores energy in its electric field. The energy model must agree whether it is computed from capacitance and voltage or from derived charge and voltage. Energy is a ledger value derived from compatible state, not an extra independent control beside Q, V, and C.
0.5 * C * V ** 2, validate its inputs, and derive alternative representations from the same compatible state. Test algebraically equivalent APIs against the canonical result. During a transient, compare the change in stored energy with integrated source and dissipated power; an attractive gauge is not evidence of energy accounting.The expressions are equal only when Q = CV describes the same state. At fixed C, changing voltage from V to 2V changes energy from U to 4U. At fixed Q, increasing C reduces energy; these different trends are not a contradiction—they are different constraints. State the source condition before interpreting a capacitance change as “more stored energy.”
An RC charging model gives a useful ledger: source work is the integral of source power, capacitor energy is ½CV², and the difference is heat in the resistor under ideal assumptions. Use sampled time values and a named numerical integration method; do not expect each individual discrete step to balance exactly without considering update order and time resolution.
Prediction: Doubling voltage quadruples capacitor energy at fixed capacitance; compatible Q/V forms return exactly the same ideal value.
SetC = 2 F, compare V = 3 V and 6 V, then derive Q for each. Calculate U using ½CV² and Q²/(2C), and write an equality-with-tolerance test. Next list source work, stored energy, and resistor heat as three separate ledger entries during an RC charge.Use one source of truth for capacitor energy, derive compatible state first, and test equivalent forms. In dynamic circuits, make source work, dissipation, stored energy, and numerical residual separate entries in the ledger.
Treat the lesson as a small function before treating it as a fact to memorize. Give every value a unit, keep only the state needed for the next step, and make the output easy to inspect.
\[\text{observable output} = f(\text{inputs},\,\text{state})\]For Energy Storage, write down the quantities you can control, the values your program must retain, and the result a reader could inspect. In Electric Potential and Capacitance, the useful program is not the drawing: it is the smallest explicit model that makes a prediction you can test.
Prediction: changing one declared input while holding the others fixed should change only the outputs that the model connects to that input. Choose one input, predict the direction of change, then check a limiting case such as zero, a symmetric arrangement, or a familiar low-speed or small-change approximation.
This lesson is a teaching model, not a complete simulator. Before using it outside the stated question, check which interactions, scales, uncertainties, boundary conditions, and measurement limits it leaves out.
Treat Energy Storage as a contract: named inputs and units enter a rule, the rule produces an observable result, and a known limit or invariant checks whether the implementation deserves trust.
Compute capacitor energy from one tested source of truth across equivalent state representations.