## Activity: Electrostatic potential of a square of charge

Computational Physics Lab II 2022
Students write python programs to compute the potential due to a square of surface charge, and then to visualize the result. This activity can be used to introduce students to the process of integrating numerically.
Now consider a square sheet of charge with side $L$ and uniform charge density $\sigma$.

Be aware that pairs may take an hour or more to simply write down the integral that they need to solve. When this happens, remember that it means that the students are getting valuable practice at a skill that is most necessary for them to learn as a physicist!

##### Issues on paper
1. We want students to always write $V(x,y,z)$ or $V(\vec r)$ or similar on the left side of an equation like $V=\int\cdots$. Ask students “$V$ of what?” or “where is that potential?”
2. Omitting an $=$ so they don't have an equation. “That doesn't mean anything. It can't be true or false.”

1. Write a python function that returns the electrostatic potential at an arbitrary point in space.
1. Many students will need to be told to write down the integral on paper first.
2. We also want to proactively look for students using scipy quadrature (i.e. numerical integration) functions, and ask them to not use those functions, but instead to program the computation by hand.
3. When students are confused as to how to do an integral numerically, ask then what an integral really is, and after a few statements they may get to either Riemann sums or chopping and adding, and either way works well. One can also think of it as treating the sheet as if it were a whole bunch of point charges.
4. Another common student challenge here is wanting to use the range function with non-integer inputs. You can point out this error, and ask what they might google to find a better function. Something like “python range non-integer” (or float) works well.
2. Once you have written the above function, use it to plot the electrostatic potential versus position in the three cartesian directions.
3. Label your axes.
4. On the same figures, plot the potential due to a point charge located at the center of your square, with the same charge as your square (in total). This potential should very closely match your computed potential at distances which are not all that far from your square.

Note that this is the first term in a power series expansion far from the origin. I just didn't bother forcing you to work it out yourself.

The most frequent bug is to omit the dx in the integral, and this reveals itself when they do this comparison, but often students don't even notice. They think it agrees because both curves approach zero. So you need to actually look and inform them that there is a problem.

5. Try constructing other visualizations.
Extra fun
What do you expect your potential to look like far from the square of charge? Verify this graphically!
More fun
What happens when you change the number of grid points used to perform the integral?
Subtle fun
What do you expect your potential to look like close to the center of the square of charge? See if you can make a prediction using Gauss's Law, if you can remember it from your introductory physics. With or without a prediction, you can examine the behavior close to the center of the square of charge.
• keyboard Electrostatic potential of four point charges

keyboard Computational Activity

120 min.

##### Electrostatic potential of four point charges
Computational Physics Lab II 2022

Students write python programs to compute and visualize the potential due to four point charges. For students with minimal programming ability and no python experience, this activity can be a good introduction to writing code in python using numpy and matplotlib.
• keyboard Electrostatic potential of spherical shell

keyboard Computational Activity

120 min.

##### Electrostatic potential of spherical shell
Computational Physics Lab II 2022

Students solve numerically for the potential due to a spherical shell of charge. Although this potential is straightforward to compute using Gauss's Law, it serves as a nice example for numerically integrating in spherical coordinates because the correct answer is easy to recognize.
• assignment Linear Quadrupole (w/o series)

assignment Homework

##### Linear Quadrupole (w/o series)
Static Fields 2022 (3 years) Consider a collection of three charges arranged in a line along the $z$-axis: charges $+Q$ at $z=\pm D$ and charge $-2Q$ at $z=0$.
1. Find the electrostatic potential at a point $\vec{r}$ on the $x$-axis at a distance $x$ from the center of the quadrupole.

2. A series of charges arranged in this way is called a linear quadrupole. Why?

• assignment_ind Electrostatic Potential Due to a Point Charge

assignment_ind Small White Board Question

10 min.

##### Electrostatic Potential Due to a Point Charge
Static Fields 2022

Warm-Up

• assignment Linear Quadrupole (w/ series)

assignment Homework

##### Linear Quadrupole (w/ series)

Power Series Sequence (E&M)

Static Fields 2022 (5 years)

Consider a collection of three charges arranged in a line along the $z$-axis: charges $+Q$ at $z=\pm D$ and charge $-2Q$ at $z=0$.

1. Find the electrostatic potential at a point $\vec{r}$ in the $xy$-plane at a distance $s$ from the center of the quadrupole. The formula for the electrostatic potential $V$ at a point $\vec{r}$ due to a charge $Q$ at the point $\vec{r'}$ is given by: $V(\vec{r})=\frac{1}{4\pi\epsilon_0} \frac{Q}{\vert \vec{r}-\vec{r'}\vert}$ Electrostatic potentials satisfy the superposition principle.
2. Assume $s\gg D$. Find the first two non-zero terms of a power series expansion to the electrostatic potential you found in the first part of this problem.

• keyboard Mean position

keyboard Computational Activity

120 min.

##### Mean position
Computational Physics Lab II 2022

Students compute probabilities and averages given a probability density in one dimension. This activity serves as a soft introduction to the particle in a box, introducing all the concepts that are needed.
• group Equipotential Surfaces

group Small Group Activity

120 min.

##### Equipotential Surfaces

Students are prompted to consider the scalar superposition of the electric potential due to multiple point charges. First a single point charge is discussed, then four positive charges, then an electric quadrupole. Students draw the equipotential curves in the plane of the charges, while also considering the 3D nature of equipotentials.
• computer Using Technology to Visualize Potentials

computer Mathematica Activity

30 min.

##### Using Technology to Visualize Potentials
Static Fields 2022 (5 years)

Begin by prompting the students to brainstorm different ways to represent a three dimensional scalar field on a 2-D surface (like their paper or a whiteboard). The students use a pre-made Sage code or a Mathematica worksheet to visualize the electrostatic potential of several distributions of charges. The computer algebra systems demonstrates several different ways of plotting the potential.
• group Electrostatic Potential Due to a Ring of Charge

group Small Group Activity

30 min.

##### Electrostatic Potential Due to a Ring of Charge
Static Fields 2022 (7 years)

Power Series Sequence (E&M)

Ring Cycle Sequence

Warm-Up

Students work in groups of three to use the superposition principle $V(\vec{r}) =\frac{1}{4\pi\epsilon_0}\int\frac{\rho(\vec{r}^{\,\prime})}{\vert \vec{r}-\vec{r}^{\,\prime}\vert} \, d\tau^{\prime}$ to find an integral expression for the electrostatic potential, $V(\vec{r})$, everywhere in space, due to a ring of charge.

In an optional extension, students find a series expansion for $V(\vec{r})$ either on the axis or in the plane of the ring, for either small or large values of the relevant geometric variable. Add an extra half hour or more to the time estimate for the optional extension.

• accessibility_new Acting Out Charge Densities

accessibility_new Kinesthetic

10 min.

##### Acting Out Charge Densities
Static Fields 2022 (5 years)

Ring Cycle Sequence

Integration Sequence

Students, pretending they are point charges, move around the room acting out various prompts from the instructor regarding charge densities, including linear $\lambda$, surface $\sigma$, and volume $\rho$ charge densities, both uniform and non-uniform. The instructor demonstrates what it means to measure these quantities. In a remote setting, we have students manipulate 10 coins to model the prompts in this activity and the we demonstrate the answers with coins under a doc cam.

Learning Outcomes
• ph366: 1) Write functions and entire programs in python
• ph366: 2) Apply the python programming language to solve scientific problems
• ph366: 3) Use the matplotlib and numpy packages
• ph366: 4) Model the physical systems studied in the course