B3 · Lesson 14 · Potential and capacitance lab
Computing potentials and capacitance when there's no formula
Formulas exist for spheres, cylinders and infinite plates. A real electrode is a square pad, a trace, an odd-shaped housing, and its capacitance is an integral nobody can do by hand. Field solvers do it numerically, in two ways you'll write in this lab: relaxation, which makes every point of a grid the average of its neighbors until the potential settles, and the method of moments, which splits a conductor into small patches and solves for the charge on each. Along the way you'll add potentials, measure where a field's energy sits, and find the energy that disappears when two capacitors share charge.
- A square box has its top held at 1 V and the other three sides at 0. The curve is the potential along a vertical line through the box, from the exact series solution.
- Move the line across the box: the potential always rises from 0 at the bottom to near 1 at the top, fastest near the middle of the box.
- The readout gives the potential halfway up. Through the center it's exactly 0.25, which you'll reproduce by relaxation in step 2.
Predict
A square metal box has its lid held at 100 V and its other three sides at 0 V, insulated from the lid. What is the potential at the center?
25 V, by superposition. Put four such boxes on top of each other, each with a different side at 100 V: adding their potentials gives a box with every side at 100 V, where the potential is 100 V everywhere. By symmetry each box contributes the same at the center, so each gives 25 V.
Name it
Relaxation
In a charge-free region, the potential satisfies Laplace's equation, and on a grid that means each point is the average of its four neighbors. Start with any guess, hold the conductors at their voltages, and replace every interior point by its neighbors' average, over and over (Jacobi iteration). The error shrinks by a fixed factor each sweep, close to 1 for fine grids: for a grid 32 cells across, , so 477 sweeps per factor of ten.
The method of moments
Split a conductor's surface into N small patches with unknown charges . The potential at patch i is , where for distant patches and, for a square patch of side s acting on its own center, . Setting every patch to 1 V gives a linear system , and the capacitance is the total charge, .
Convergence and extrapolation
Charge crowds toward edges and corners, where uniform patches describe it poorly, so the error falls only about as with N patches along a side. If , two solutions combine to cancel the leading error: (Richardson extrapolation).
Energy checks
The field of a charged sphere of radius R stores in total, and the fraction within radius r is : half of it lies within 2R. When a charged capacitor is joined to an uncharged one, charge is conserved but energy isn't: a fraction of it is lost in the connection, whatever the resistance.
Worked example
Using superposition, what is the potential at the center of a square box with its top at 100 V and its left side at 40 V, the other two sides grounded?
Show the solution
- One side at a time. Each side held at alone contributes at the center.
- Add the two sides. That's the same superposition that solves the predict question, applied with two different voltages.
- Test a solver. A relaxation solver with both sides set gives 35 V at the center to within its convergence tolerance, which is a quick test for one you've just written.
Answer the center sits at 35 V.
Worked example
A flat square plate 1 m on a side has a capacitance of about 40.8 pF. How does that compare with a disk and a sphere of the same surface area?
Show the solution
- Disk. A disk of area 1 m² has radius 0.564 m, and an isolated disk has
- Sphere. A sphere of area 1 m² has radius 0.282 m, and
- Flat shapes against the sphere. The flat shapes hold about 30% more charge per volt than the sphere with the same area, because their charge can spread farther apart.
- Square against disk. The square edges out the disk slightly by reaching its corners farther from the center.
Answer the square's 40.8 pF is a little more than the disk's 40.0 pF and about 30% more than the sphere's 31.4 pF.
Worked example
A 10 µF capacitor at 12 V is connected to an uncharged 10 µF capacitor. What happens to the charge and the energy?
Show the solution
- Charge is conserved. 120 µC spreads over 20 µF, so both end at 6 V.
- Energy before.
- Energy after.
- Where it went. Half the energy is gone, turned into heat in the wires (and a little radiation).
- The resistance doesn't matter. The amount doesn't depend on the wires' resistance: less resistance makes a larger current for a shorter time, with the same loss.
- Switched-capacitor circuits. They pay this loss on every transfer, which is why they move charge in small steps.
Answer both capacitors end at 6 V, sharing the 120 µC, and the energy falls from 0.72 mJ to 0.36 mJ: half is lost as heat.
Check
Step 1. Write potential(q, src, pts) that returns the potential at each point in pts (an M × 3 array) from point charges q (length N) at positions src (N × 3), using k = 8.988 × 10⁹.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 2. Write relax(n, V_top, sweeps) that solves for the potential in a square box with n × n interior points (plus a boundary row on each side), the top row held at V_top and the other sides at 0, by Jacobi iteration with NumPy slices. Return the whole (n + 2) × (n + 2) array.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 3. Write plate_C(a, N) for a flat square plate of side a split into N × N patches: build the matrix P (point-charge terms off the diagonal, on it), solve , and return the capacitance. Then write plate_C_extrapolated(a, N) returning . Use ε₀ = 8.854 × 10⁻¹².
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 4. Write energy_within(Q, R, r_out, n) that integrates the field energy density of a charged sphere (charge Q, radius R) over spherical shells from R out to r_out, using n steps evenly spaced in ln r with the midpoint rule.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 5. Write share(C1, V1, C2, V2) for two capacitors joined plate to plate: return the common final voltage and the energy lost.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
A 1 µF capacitor at 12 V is joined to an uncharged 2 µF capacitor.
(a)
What voltage do they share?
Write units the way you normally would: 1.5 V, 1500 mV and 0.0015 kV are the same answer.
(b)
What percentage of the energy is lost?
Check
Jacobi iteration on a grid n = 32 cells across shrinks the error by about per sweep. How many sweeps reduce it by a factor of ten?
Explain why
Why does the energy lost when two capacitors share charge not depend on the resistance of the wire joining them?
The final state is fixed by charge conservation alone: the charge spreads until both capacitors are at the same voltage, and that common voltage, and so the final stored energy, doesn't involve the wire at all. The energy lost is the difference between the starting and final stored energies, so it's fixed too. The resistance only decides how the loss happens: a small resistance gives a large current for a short time, a large resistance a small current for a long time, and comes out the same either way. With almost no resistance, the energy leaves as radiation and sparks instead of heat.
Practice
Keep practicing
4 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.