Computational Activity: Electric field for a waffle cone of charge

Computational Physics Lab II 2022
Students integrate numerically to find the electric field due to a cone of surface charge, and then visualize the result. This integral can be done in either spherical or cylindrical coordinates, giving students a chance to reason about which coordinate system would be more convenient.
  • Media
    • 2399/waffle-cone.svg
Consider a cone of surface charge that is open at the top.
  1. Write down on paper three integrals for the three components of the electric field, \(E_x(\vec r)\), \(E_y(\vec r)\), and \(E_z(\vec r)\).
    It is very common for students to want to create one function that returns the entire vector. This can actually work well, but most often does not. It often results in code that is inordinately slow (as it computes all three components, and then throws two out). Students also tend tend to struggle as in practice it requires returning a tuple of values, which is a data structure that students don't know about. So please try hard to get students to write three separate functions! Students frequently have difficulties taking components of the electric field. A surprisingly common mistake is to just “take the \(x\) stuff”, resulting in something like \begin{align} E_x(x,y,z) &= k\sigma\int \frac{x-x'}{\Big((x-x')^2\Big)^{\frac32}}dA' \end{align} When I encounter this, I try to talk with students about the meaning of taking a component. It is either the thing in front of \(\hat x\), or \(E_x = \vec E\cdot \hat x\).
  2. Find the first non-zero term in a power series for the electric field far from the origin.
  3. Write three functions to compute these three components of the electric field at any point in space. Write another three functions to compute the three components of the electric field as predicted by the first nonzero term in the power series.
  4. Visualize \(\vec E\) on the three Cartesian axes. On the same plots, visualize your lowest-order prediction for the field at large differences.
  5. Visualize the electric field in at least two different ways. Here "different" means more than just changing the orientation or direction of a plot, it needs to be an entirely different way of visualizing the electric field.
Extra fun
See what happens if you make your cone entirely flat, so it becomes a disk. In particular, what does the electric field look like just above and below the disk? Use Gauss's Law to predict the electric field near the center of the disk, and add that value to the plot.
Visualizing fun
Try creating other visualizations for the electric field.

electric field cone
Learning Outcomes