Visualizing 1D complex-valued wavefunctions

Visualizing wavefunctions is essential in quantum mechanics (or wave physics, in general).

For starters, let’s start with the eigenmode of the wave produced by the transverse displacement y of a string of length L (like that of a guitar) with fixed endpoints. The modes of these vibrations is given by y(x,t)=y_0 \sin(n \pi x/L)\cos(\omega_n t), where y_0 is the maximum displacement, x is the position, n is the mode number, and \omega_n is the mode frequency. Shown below is wavefunction for n=3 plotted as a single image for different snapshots in time.

String displacement for mode n=3. Source

Plotting this is straightforward since it is a real-valued function. The time evolution changes the absolute value of the wavefunction. This true in most cases in classical mechanics.

In quantum mechanics, however, we cannot get away with complex values. For eigenfunctions, like the one shown above, the time evolution doesn’t change the absolute value, it only changes the phase. This makes the plot similar above to be insufficient.

Consider the energy eigenfunctions of the quantum version system above, a particle in an infinite box with length L which is given by \psi_n(x,t) = A\sin(n\pi x/L)e^{i\omega_n t}. Here, A is the normalization constant. At time t=0, these are real-valued wavefunctions and plotting them is straightforward. However, time evolution will unavoidably make them complex-valued. Time evolution of an energy eigenfunction will not change most observables, but, once a state is a linear combination, we need to consider plotting in complex space.

A naive, at least in Quantum Mechanics, way to plot wavefunctions is to deal with the real and imaginary parts separately. This is shown below for equal superposition of the first 2 excited states at some instant in time of the form \psi(x,t=t_0) = \sin(3\pi x/L)+i\sin(2\pi x/L).

Plotting real and imaginary parts. Source

Plotting either of them does not give much intuition on the possible observables like position. A better way is to plot two direct observables from the wavefunction, i.e. probability density |\psi|^2 and the phase Arg(\psi). This is shown below.

Separate plot of probability density and phase. Source

This gives us directly the probability density and the phase which are essential physical quantities, unlike the real and imaginary parts. If we let this wavefunction evolve, we will see the beauty of these oscillations in the density.

Having two curves in a single plot is not ideal. Good news is we can incorporate the phase in the density plot by using a colormap. This method was used in the book Visual Quantum Mechanics by Bernd Thaller. The trick is to map the phase to hue (or commonly called color) which is also cyclic, e.g. 0 is mapped to red, 2π/3 to green, π to cyan, 4π/3 to blue, and so on. We then use it color the fill under the probability density curve as shown below for the same wavefunction.

Probability and phase (colormap) distribution of a wavefunction. Source

To do this plot in Python, I first created the colored image, i.e. plot (imshow) an image (2D array) which has intensity values equal to the phase of the wavefunction using the ‘hsv’ colormap. The second step is to plot a filled function (fill_between) with a white background to cover the upper part of the curve.

There you have it. A plot of a complex-valued wavefunction which shows both the probability density and phase. This can be also extended to 2D wavefunctions. Have fun!


One thought on “Visualizing 1D complex-valued wavefunctions”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s