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, changes in permittivity, and a ring charge. 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. By changing the permittivity constant epsilon, we can make the electric field weaker or stronger based off of what quantity it is.

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.

Charged Ring

\[ \mathbf{E}(\mathbf{r}) = \frac{1}{4\pi\varepsilon_0} \frac{Qx}{(R^2+x^2)^{3/2}} \hat{\mathbf{r}} \]

The charged ring function computes the charge of a vector field on the z-axis that emerges from a ring of charge. Rather than computing it as an integral of constant charge we instead create a number of point charges and sum them all up.

Home *Physics* Guide Gallery Simulate