Initially, I intended to model capacitors of various shapes, including more realistic configurations like rolled-up plates or variable (i.e. adjustable) capacitors. Though these configurations were not ultimately simulated, the information gathered, looking only at square parallel plate capacitors, was illuminating, and the foundational programs I wrote could, with some manipulation, be extended to more complicated arrangements.
The method I ended up using, detailed extensively in the data post, was relatively efficient but still took a non-trivial amount of time (see below) to simulate the electric fields that dictate the properties of a capacitor. The size of grid I used (averaged over two grids: one with 211^2 = 44521 points, the other with 212^2 = 44944 points) was chosen so that the simulated electric fields were at least 99.9% accurate over the distances examined and so that the simulations took no more than 10 minutes each to run (6 plate simulations were run in total, resulting in an hour of pure computation; note that by taking advantage of plate symmetry, this was actually 1/4 the time one might have expected, as it took about 2.4 seconds to find the E-field at any point).
Accuracy of the method at calculating the E-field was checked at a few points against the computationally inefficient but presumably 100% accurate theoretical model, which is based on fundamental physics (integral Coulomb’s law). This method took up to 10 minutes to calculate the E-field at an arbitrary point near the capacitor, though it was much faster far away from the capacitor (where we are naturally not interested).
Splitting a shape into thousands of manageable quantized points charges (each producing a field in accordance with Coulomb’s law for point charges) proved to be an effective tool, even for the relative simple square plates studied here. This method could be expanded in the future to much more complicated surfaces or even volumes to accurately model the electric field of complex shapes that would otherwise be hopeless to analyze analytically. Of course, a real charged object is charged with a finite number of charge carriers, so this method is not physically unsound (on the other hand, a plate charged to 10^-6 C like mine would need 6.25 x 10^12 electrons spread over it rather than a mere 44,000)
It should be noted that I did not examine the effects of dielectrics placed between plates. Though this was originally planned, I omitted doing this not out of time constraints, but rather because it would not have proved particularly illuminating. Linear dielectrics (the only kind extensively analyzed in 341) have very straightforward effects on energy storage and capacitance, which do not seem to depend on capacitor dimensions. Equation 4.58 and an unlabeled equation on page 197 make this clear (Griffiths, 4th ed.):
Overall, this project was an excellent exercise in computation and matrix manipulation (the data for the electric field at a set of points above a plate was stored in a 3 by 1024 matrix, for example). It was also very useful for practicing using approximation methods based on fundamental physics to solve an otherwise complicated problem. In the end, the ideal model of a capacitor was shown to be insufficient for extremely accurate capacitor parameters at all but the closets plate separations. Of course, real capacitors have by their design very close plates to maximize capacitance, so the choice of method depends on one’s needs and situation.
Perhaps the most useful “next step” would be to take the data for more plate separations and fit a curve to the points, resulting in a function for capacitance or energy as a function of plate separation. Based on the few points I took (see the animation), such a function is approximately a straight line for very small separations (i.e. the ideal approximation) but diminishes with distance like a square root function.
The code used to run these simulations could be expanded upon to use for visualizing electric or potential fields, or for any other application where an arbitrarily complicated electric field (or possibly a gravitational field) needs to be modeled. I tried to keep a neat, albeit very lengthy, notebook file, though I could have labeled my graphics and the computation times more clearly (I used the Timing function on almost every computation, but the way Mathematica returns the timing value is not extremely conspicuous).