Mr. Electric!

Griffiths chapter 2 visualizer

This is a representation of just a few electrostatic functions from Griffiths Electrodynamics. It contains fields from point charges and a schematic delta cluster. This code was computed in Numpy, Scipy and Matplot.

Below is the math behind each function:

Point charge (Coulomb)

\[ \mathbf{E}(\mathbf{r}) = \frac{1}{4\pi\varepsilon_0} \frac{q}{r^2}\hat{\mathbf{r}} \]

This function was used to compute the vector field at each location in a grid. There is a masking element so that the function doesn't compute at or very near the origin. It was also used to compute in the two charge field, the charges are in superposition, and so the vector field is simply the sum of the two charge functions. .

Gaussian sphere

\[ \oint_S \mathbf{E}\cdot d\mathbf{a} = \frac{Q_{\mathrm{enc}}}{\varepsilon_0} \]

This function was used to compute the flux flowing through a gaussian sphere of radius r.

Dirac delta

\[ \rho(\mathbf{r}) = q\,\delta^3(\mathbf{r}-\mathbf{r}') \]

This function is purely cosmetic, graphically a dirac delta function would just be an infinitely tall and narrow spike, the code just represents a cluster of points.

Home *Physics* Guide Gallery Simulate