## Activity: 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.
What students learn

1. Probability density is the norm square of the wave function
2. An average is a weighted sum

##### Possible extra learning goals:
1. Normalizing wave functions, normalizing probability density.

## Probabilities and probability densities

Much of quantum mechanics is probabilistic. The most that we can predict is the probability of any given outcome of a measurement. Thus you will be spending a lot of time in the next five weeks talking about probabilities. Before we get to writing any code, we're going to spend some time talking about probabilities and probability densities.

As an example, let's consider the disribution of student residences in Corvallis. We are going to begin by collecting some data from which we can draw conclusions about probabilities.

I'll start by creating a table to find out how common different commutes are. I'd like you to figure out (or make up) the distance from where you sleep to Weniger Hall. I'll call out distances and ask you to raise your hand if your home is closer to Weniger than that distance (and you haven't yet raised your hand).

We will now discuss this distribution and how to represent it.

 commute number of people 0.25 miles 1 0.5 miles 4

Will someone volunteer to come forward and create on the whiteboard a visualization of this data?

What are the units of this visualization? The vertical axis is "number of people in this room with a commute in that range."

There are a couple of problems with this histogram that I'd like to draw out of students. If I want to tell people the probability distribution of commutes, in what way is this representation suboptimal? It might help to imagine that we have a whole lot more data.

1. The answer depends on the total number of people in the room. We can address this by dividing each value by that number.
2. The answer depends on how we chose to round our commutes. This would make it hard to compare our results e.g. with a survey that someone else did using metric, or rounding to the nearest sixteenth of an inch. We can address this by dividing each number by one inch.
Taken together, these changes result in a curve that looks identical, but now has dimensions of inverse distance. This is what we call a probability density. Just as a charge density is the amount of charge per unit something else, a probability density is the amount of probability per something else.

##### How could we find the average commute?

There are three different approaches we could use here. One is to just add up all the commutes. Another is to add up commutes times probabilities. The final is to *integrate* the probability density times the commute. But I'm not sure we want to do this now...

## Particle in a box

Consider a particle that is located in a box with width $L$. An interesting question to ask is where the particle is likely to be, but this is complicated by the fact that there are an infinite number of positions the particle could have.

We will be working today with probability densities for a particle in one dimension. This is a linear probability density, which means that it is the probability per unit distance. You can think of the probability density $P(x)$ as being defined by \begin{align} \text{probability it's between $x_0$ and $x_0+\Delta x$} = \int_{x_0}^{x_0+\Delta x} P(x)dx \end{align} So if you imagine $\Delta x$ becoming small, then the probability density $P(x_0)$ is the meaningful answer to the (ill-posed) question, "How likely am I to find the particle at position $x_0$?"

##### What are the dimensions of $P(x)$?

The probability density of an electron being found at position $x$ is given by $|\psi(x)|^2$, where $\psi(x)$ is a complex-valued function called the wave function. You will learn more about wave functions in the coming weeks, but for today it is the function that you take the norm squared of to find the probability density.

##### What are the dimensions of $\psi(x)$?

Today you will be computing an average position of the electron, given $\psi(x)$. The electrons will be confined to a region $0<x<L$, so your function is invalid outside of that domain, and you don't have to worry about the electron escaping.

You will be given two wave functions from the following list: \begin{align} \psi_1(x) &= \frac{\sqrt{30}}{L^2\sqrt{L}}x(x-L) & \psi_2(x) &= \frac{x^6\sin(\pi x/L)}{0.07931977085 L^6\sqrt{L}} \\ \psi_3(x) &= \frac{\sqrt{105}}{L^3\sqrt{L}}x^2(x-L) & \psi_4(x) &= \sqrt{\frac{2}{L}}\sin(\pi x/L) \\ \psi_5(x) &= \frac{\sqrt{495}}{L^5\sqrt{L}}x(x-L)^4 & \psi_6(x) &= \sqrt{\frac{2}{L}}\sin(2\pi x/L) \end{align} Using your two wave functions:

1. Write python functions that given $x$ returns the value $\psi(x)$ for each of your $\psi_i(x)$.
2. Plot the wavefunctions, and then plot the corresponding probability density.
There are a couple of issues to look for here.
1. Many students will plot both $\psi(x)$ and $|\psi(x)|^2$ on the same plot (with the same axis). This is a problem because those two quantities have different dimensions, so they can't be compared with each other. I.e. it is a meaningless question to ask which is greater of the two. Students should put them on separate plots. It can be useful to put them on subplots, one over the other, so that you can easily compare the same $x$ values.
2. Many students will plot over some wide range of $x$, e.g. from $-10<x<10$. This is wrong, and there are two different ways to talk about how/why it is wrong. Both stem from the fact that we defined our particle to be in a box ranging from $x=0$ to $x=L$.

One explanation (preferred by Corinne) would be to say that the domain of $\psi(x)$ is from $0$ to $L$, so plotting the wavefunction outside of that range is meaningless.

The other explanation (preferred by Roundy) is to ask the probability that the particle is outside the box. Students will answer that it is zero. Then ask what the probability density is outside the box. Again, it is zero. Thus the wavefunction must be zero outside the box. The function we gave them is actually only valid inside the box, and it is implied by the statement that the particle is in the box.

3. Check that the total probability (i.e. the probability of the particle being anywhere at all) is 1 for each wavefunction.
4. Based on your plots, guess what the average value of $x$ will be, and plot this guess as a vertical line on your probability density plots. Do this step before the following step!
Each pair of wavefunctions (a row above) has one that is symmetric and one that is asymmetric, so students should have an easy guess ($L/2$) and a harder one.
5. Write a program to find the average value of $x$ that would be measured, and then plot this average $x$ as a vertical line on the same plot with the probability density (and the other vertical line). Does it look correct? Does it match what you guessed?
I fully expect students to struggle at this stage. We've got two class periods, so we can let them grapple for a while. Then we will talk them through the idea of a weighted average. At some point I'll need to talk with the whole class about this, but I want to do this *after* everyone has at least discussed with their partner how the could compute the average of an "independent variable."
Extra fun
Find the probability that your particle will be found to be in the right half of the box. Do the same for the left half. Check that the two numbers add up to one.
Mean fun
Find the probability that the particle is to the left of the vertical line giving the average value of $x$.
Other fun

Find the probability that your particle will be found to be in the center half of the box. Do the same for the outside half. Check that the two numbers add up to one.

Complex fun : Try using the following complex wave function: \begin{align} \psi_A(x) &= \sqrt{\frac{2}{L}}\sin(\pi x/L)e^{ikx} \end{align} where $k$ is a number you may choose with dimensions of inverse distance and as usual $i=\sqrt{-1}$. Make sure to visualize the complex wave function as well as the probability density. Try playing with the value of $k$ to see how it affects $\psi(x)$ and $P(x)$.

Crazy fun
Try using the following wave function: \begin{align} \psi_B(x) &= \frac{\left(1-e^{(1-10i)x/L}\right)\left(e^{(1+7i)(x-L)/L}-1\right)}{2.1335722875015692\sqrt{L}} \end{align} If you can sketch in advance what this wave function function looks like (or its corresponding probability density), I will be very surprised. I could not do that.

• group Time Evolution of a Spin-1/2 System

group Small Group Activity

30 min.

##### Time Evolution of a Spin-1/2 System
Quantum Fundamentals 2022 (3 years)

In this small group activity, students solve for the time dependence of two quantum spin 1/2 particles under the influence of a Hamiltonian. Students determine, given a Hamiltonian, which states are stationary and under what circumstances measurement probabilities do change with time.
• group Wavefunctions on a Quantum Ring

group Small Group Activity

30 min.

##### Wavefunctions on a Quantum Ring
Central Forces 2023 (2 years)
• face Review of Thermal Physics

face Lecture

30 min.

##### Review of Thermal Physics
Thermal and Statistical Physics 2020

These are notes, essentially the equation sheet, from the final review session for Thermal and Statistical Physics.
• computer Visualization of Quantum Probabilities for the Hydrogen Atom

computer Mathematica Activity

30 min.

##### Visualization of Quantum Probabilities for the Hydrogen Atom
Central Forces 2023 (3 years) Students use Mathematica to visualize the probability density distribution for the hydrogen atom orbitals with the option to vary the values of $n$, $\ell$, and $m$.
• group Time Dependence for a Quantum Particle on a Ring

group Small Group Activity

30 min.

##### Time Dependence for a Quantum Particle on a Ring
Theoretical Mechanics (6 years)

Quantum Ring Sequence

Students calculate probabilities for energy, angular momentum, and position as a function of time for an initial state that is a linear combination of energy/angular momentum eigenstates for a particle confined to a ring written in bra-ket notation. This activity helps students build an understanding of when they can expect a quantity to depend on time and to give them more practice moving between representations.
• group Expectation Values for a Particle on a Ring

group Small Group Activity

30 min.

##### Expectation Values for a Particle on a Ring
Central Forces 2023 (3 years)

Quantum Ring Sequence

Students calculate the expectation value of energy and angular momentum as a function of time for an initial state for a particle on a ring. This state is a linear combination of energy/angular momentum eigenstates written in bra-ket notation.
• face Boltzmann probabilities and Helmholtz

face Lecture

120 min.

##### Boltzmann probabilities and Helmholtz
Thermal and Statistical Physics 2020

These notes, from the third week of Thermal and Statistical Physics cover the canonical ensemble and Helmholtz free energy. They include a number of small group activities.
• face Chemical potential and Gibbs distribution

face Lecture

120 min.

##### Chemical potential and Gibbs distribution
Thermal and Statistical Physics 2020

These notes from the fifth week of Thermal and Statistical Physics cover the grand canonical ensemble. They include several small group activities.
• computer Visualizing Combinations of Spherical Harmonics

computer Mathematica Activity

30 min.

##### Visualizing Combinations of Spherical Harmonics
Central Forces 2023 (3 years) Students observe three different plots of linear combinations of spherical combinations with probability density represented by color on the sphere, distance from the origin (polar plot), and distance from the surface of the sphere.
• computer Visualization of Quantum Probabilities for a Particle Confined to a Ring

computer Mathematica Activity

30 min.

##### Visualization of Quantum Probabilities for a Particle Confined to a Ring
Central Forces 2023 (3 years)

Quantum Ring Sequence

Students see probability density for eigenstates and linear combinations of eigenstates for a particle on a ring. The three visual representations: standard position vs probability density plot, a ring with colormapping, and cylindrical plot with height and colormapping, are also animated to visualize time-evolution.

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