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.
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
- 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?”
- Omitting an \(=\) so they don't have an equation. “That doesn't mean anything. It can't be true or false.”
Write a python function that returns the electrostatic potential from your discretized charge distribution at an arbitrary point in space.
- Many students will need to be told to write down the integral on paper first.
- 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.- 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.
- 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” (orfloat
) works well.
On the same figures, plot the potential due to a point charge located at the center of the square, with the same charge as the square (in total). This potential should very closely match your computed potential at distances which are not all that far from your square.
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.
keyboard Computational Activity
120 min.
electrostatic potential python
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 usingnumpy
and matplotlib
.
keyboard Computational Activity
120 min.
probability density particle in a box wave function quantum mechanics
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.keyboard Computational Activity
120 min.
assignment Homework
A particle in an infinite square well potential has an initial state vector \[\left|{\Psi(0)}\right\rangle = A\big(\left|{\phi_1}\right\rangle -\left|{\phi_2}\right\rangle +i\left|{\phi_3}\right\rangle \big)\]
where \(|\phi_n\rangle\) are the energy eigenstates. You have previously found \(\left|{\Psi(t)}\right\rangle \) for this state.
Use a computer to graph the wave function \(\Psi(x,t)\) and probability density \(\rho(x,t)\). Choose a few interesting values of \(t\) to include in your submission.
Use a computer to calculate the probability of measuring the particle to be near the middle of the well (within 1% on either side) as a function of time. Include both your symbolic result and a graph in your submission.
Choose another location in the well, different from the location above. Use a computer to calculate the probability of measuring the particle to be near your chosen location (within 1% on either side) as a function of time. Include both your symbolic result and a graph in your submission.
Are there any locations in the well where the probability is independent of time? Explain how you determined your answer.
keyboard Computational Activity
120 min.
inner product wave function quantum mechanics particle in a box
Students compute inner products to expand a wave function in a sinusoidal basis set. This activity introduces the inner product for wave functions, and the idea of approximating a wave function using a finite set of basis functions.group Small Group Activity
120 min.
assignment Homework
Set up the integrals for the Fourier series for this state.
Which terms will have the largest coefficients? Explain briefly.
Are there any coefficients that you know will be zero? Explain briefly.
Using the technology of your choice or by hand, calculate the four largest coefficients. With screen shots or otherwise, show your work.
assignment Homework
Consider the following wave functions (over all space - not the infinite square well!):
\(\psi_a(x) = A e^{-x^2/3}\)
\(\psi_b(x) = B \frac{1}{x^2+2} \)
\(\psi_c(x) = C \;\mbox{sech}\left(\frac{x}{5}\right)\) (“sech” is the hyperbolic secant function.)
In each case:
keyboard Computational Activity
120 min.
quantum mechanics operator matrix element particle in a box eigenfunction
Students find matrix elements of the position operator \(\hat x\) in a sinusoidal basis. This allows them to express this operator as a matrix, which they can then numerically diagonalize and visualize the eigenfunctions.assignment Homework