This is another shot from the quantum superposition viewer. It’s neat as op art, but I’m still trying to fully grasp the realization I made that this represents an unchanging distribution of a unit of rotational motion. The state is fixed, but it contains within it an orbiting particle.

## Current project

I’m playing around with quantum mechanical superposition and hydrogen wave functions again. This time with really simple 2 dimensional renderings. I’ve been trying to get a grip on some of the basic principles and this is what I’ve got up so far.

I’m learning a lot, and there is quite a bit to be gained from playing around with something as simple as this. My end goal for this is to bring back some of the simple demos from the genesis of this blog, and build more of a directed walk through of some of the principles and features of the system. Up to this point, the demos have left it completely up to the user to figure out what to do with them. Ideally I’d like it to be so inviting and obvious that viewers just give it a go, but that’s probably too ambitious for the topics.

At work I strive to build systems that leave the simple stuff simple and make the complicated stuff manageable. Trying to eliminate the complexity from something that is naturally complicated is just going to end up covering it up and frustrating the user.

## All things must pass

This article reminded me of one of the strange features of the standard wave equation from basic physics. The wave equation describes an infinitely long vibrating string. Like point masses from Newtonian physics each bit of string has a position and velocity. If you know the position and velocity of the entire string at one moment of time, you can predict the position and momentum of any bit of string at any time in the past or present. It seems natural to think in those terms because we predict the motion of things around us all the time.

The reason this works is that the wave equation lets us solve for the time evolution of the system based on the current state. For the case of a string, the time and position variables are symmetric, and knowing the position and velocity of the string at one point for all time is just as good as knowing about all space at one time. Philosophically this is a nice feature. It means that nothing in this world can escape you, all you have to do is sit in one place and everything either has passed you by or will pass you by, nothing can avoid you forever.

In higher dimensions things are similar, but just a little different. For a 3 dimensional space time (2 spacial dimensions and 1 time) knowing the position and velocity for all space at an instant of time is what you need to make predictions. Instead of sitting in 1 place and being able to keep track of everything, you need to monitor a single line that divides the world in half. Knowing everything that crosses that line for all time lets you know everything in that space. In our 3 dimensional spacial world, you have to monitor an entire infinite plane.

That works because signals on this string travel in one direction with one speed, they never turn around or stop. That is completely unlike particle dynamics where things move independently. This would be just an interesting feature of these wave equations, but basic quantum mechanics is a wave theory, and the same rules apply.

## I never knew it looked like that

These are all images of the same electron orbital. The doughnut or torus shows the electron rotating around the central point in the orbital plane. In the standard terminology this has principal quantum number 2, which represents the energy level of the electron.

The azimuthal quantum number is 1. This represents how much of the energy of the electron is stored in rotating around the atom; in other words, it’s angular momentum.

The magnetic quantum number is 1 as well. This represents an electron spinning as fast as it possibly can given the momentum it has in a circular orbit.

The next image shows a standing wave mode of this orbital. This is where things get kinda weird. This mode is formed by two rotating waves moving in opposite directions. the (2,1,-1) and (2,1,1) modes.

This is where things get interesting. These wavefunctions are complex functions spread out through space. One of the basic assumptions of quantum mechanics is that the square of this wavefunction represents the probability that the particle will be found at that location. The 3 pictures above represent the same probability distributions sampled at different levels of detail.

Because these are probabilities there isn’t any fixed way to map them to a particular shape. The level set for finding an electron within a region 50% of the time can look much different than that for 80% or 99%. For the simple spherical distributions, they do look the same, but for higher energy wavefunctions the shapes get more complicated.

My first attempt to view these functions was a simple addition of probabilities, which produced images like the one to the left. This image corresponds to the 4th image up top. As you can see this looks flat, and you can’t make out the links between the red blobs, the connections between them or the shape of anything. This is a somewhat more accurate rendering of the function, but it lacks all the features like shading, and solid form that our brain uses to give us clues about depth and shape.

On the other hand, the solid rendering hides the blurriness of these methods. Looking at the 3 pictures up top, you can’t tell by just looking at an individual picture how they are connected and what probability cutoff they represent. Looking at just static pictures is even harder.

So now that I’m no longer limited to the static shots on the web, or in a book, I’m seeing how these functions fit together. While the azimuthal part of the wave function is just a scaled cosine function, the interaction with the other dimensions of the wave function produce two different kinds of nodes. The first are the blue nodes that keep the simple blob shape even at very low thresholds. The other is the red nodes that have a dimple in them when they try to connect across the center of the torus at low thresholds. None of this helps me with calculations, but I feel like I have a much clearer view of what’s going on.

None of these pictures holds the whole story. Each one just shows a different part of the puzzle, and I’m sure there are many other ways to highlight many of the other features of these functions.

## Release often

The atomic orbital viewer is now on it’s third release. The first one was just the basic blurry transparent renderer, using just the rotating basis from the standard derivation from undergraduate physics classes. The second release added an option to view standing wave functions instead of the rotating as the standing wave functions are the ones most commonly shown in physics and chemistry textbooks, as well as Wikipedia.

This new and much improved version has a new solid renderer. It shows images with the closest fidelity to those seen elsewhere. Some of the things I learned from this version:

- It is hard to picture transparent ethereal glowing clouds. In order to get the rotation of the cloud version looking the way I thought it should, I ended up reversing the x rotations and the way points receded into the background.
- I wasn’t able to picture the shape of these constant surfaces from the glowing versions at all. There is a lot more going on with these shapes then I imagined.
- Static pictures from text books have not done these things justice. There is no definitive shape for each of these wave functions. As you scale the threshold value, the surfaces bend and warp into new interlocking shapes.
- WebGL is new and isn’t documented that well. It took me a while to understand why my shaders weren’t working the way I thought they should. Loops in WebGL are all fixed length and you can’t exit from them early. Putting a return function in a loop compiles, but it doesn’t work. I had to go old school with my shaders and use extra flag variables to simulate the exits.
- I thought old school printf/alert debugging was hard. The only output from a fragment shader is the color of the dot on the screen. I had been outputing a range of values in what I thought was the 0 to 1 range. However most of the results were > 1 so it just showed flat regions. I finally figured out doing sin(x)*sin(x) would give me bands I could work with. Fract(x) is another option for that as well.
- WebGL is crazy fast for this stuff. I put together an initial implementation of this in javascript and 2d canvas, but it had a noticeable render time even on chrome. Switching over to the WebGL version, and it renders smoothly in the blink of an eye with very little optimization or thought about it.

I’ll be adding some more overview posts soon. The new renderer is generating new insights. I’ll also be adding more models like the harmonic oscillator, and start demoing some superpositions.

## Static images

## Electron sausages?

I just paused writing an article where I tried to give a quick overview of quantum mechanics.

Ha Ha

It ended up being a few paragraphs, a few images, and a crap load of links to Wikipedia. I’m not going to write anything like that anytime soon, and definitely not in a single blog post. I’m going to stick with summaries of the projects I develop and slowly work my way up to wordier subjects. Writing is the hardest part for me, so if you don’t have a bit of background in quantum mechanics, this is going to go over your head a little bit.

Like I’ve said many times in the past, I’ve looked at and derived these equations many times. Writing these apps has helped me understand them better. Here is what I’ve learned from the orbital viewer.

The wavefunctions with m=0 have a phase which is constant in space. This is pretty common in one dimensional bound states like the infinite square well or the harmonic oscillator. Because of that, I didn’t realize how weird that is. These states correspond to electrons that are frozen in space. It’s like the quantum uncertainty of the electron is completely balanced out by the compressive electrostatic force almost like little electron sausages. There is no classical correspondence to these states. There are no stationary planetary orbits.

The states with positive or negative m values are closer to classical circular orbits. The complex exponential factor adds a constant velocity around the axis. For a given energy slower electrons lie closer to the axis and are more spread out along it. As the rotation increases, the electron moves further out and becomes more concentrated on the plane orthogonal to the axis. This creates a series of stacked doughnuts.

As the energy increases for the same angular momentum, inner currents are added with alternating phases. There are a number of different ways to see this. In the full view these are added as nested doughnuts. In the slice view with the intensity cranked up, these show up as inner circles, and the nested doughnuts show up as pie shaped wedges.

This only shows up in rotational mode. The standing mode has nodes around the axis of rotation, which makes the situation visually complicated. Unfortunately many images of these orbitals show the standing waves. Using the complex exponential factor for the rotation instead of the individual elements has been a boon.

I’d never really considered what went into that factor. The complex exponential represents a completely spread out constant velocity motion. I’d thought about it a little as that’s the basic description of a quantum plane wave solution, but I think that’s a post for another day.