Welcome to the Schrödinger Visualizer

Time for some quantum intuition!

This visualizer solves and plots the one-dimensional Schrödinger equation in various potentials. It also has fun exercises that don't require any math. The goal is to build your intuition about the quantum world in a way that easily relates to both pop QM and an undergraduate course.

Learn by exploration?  Click stuff to see what happens, then read on!

Learn by doing? Try the exercises

Like sightseeing? Take the tour

Know your QM? Read about our numerical method

Like software? See acknowledgements

What the heck am I looking at?

This is the quantum version of a ball on a spring. Stick an ordinary ball on a spring and give it a tug, and it will bounce back and forth. Same with a quantum ball (like an electron)!

The purple U shape represents the potential, the red horizontal line is the level(s) of energy, and the yellow rotating thing is the wavefunction.

The wavefunction is kinked because there are no solutions to the Schrödinger equation for that energy. Try to find an energy that eliminates the kink!

What is the Schrödinger Equation?

Quantum mechanics is a theory of Nature at the scale of individual particles, like electrons. Such particles cannot easily be described like a marble, with a position and a speed. Instead we describe them with something called a wavefunction, from which position and speed can be derived. The Schrödinger equation describes how the wavefunction of a system evolves over time.

In Newtonian mechanics, you are given some configuration of positions, velocities, masses, and forces, and by solving F=ma, you can determine the system's state at some future time.

In quantum mechanics, forces are instead described by a potential. By plugging that potential into the Schrödinger equation, you compute the wavefunction ψ (or more precisely, a set of allowed wavefunctions). The wavefunction, in turn, tells you what result you would actually measure - or their probabilities!

What is a potential?

A potential is a function that tells you how much potential energy you would have at each position.

Imagine a hill. When you ride a bike up the hill, you have to expend effort to lift yourself up, and your potential energy increases. At the top of the hill, your potential energy is maximized. Now, coast down the hill: your potential energy decreases as it is transferred to kinetic energy. Reach the bottom of the valley, and your potential energy is minimized. If you were to plot your potential energy according to your position, the graph would look like the hill itself! This function we just graphed, of energy according to position, is called the potential.

Now think about a spring attached to a wall. When you pull the spring away from the wall, it stretches and pulls back (Hooke's Law!) We can put the distance you pull the spring on the X axis, and the energy you need to impart on the Y axis. This is also a potential, and its graph will be a parabola.

Potentials arise often in quantum mechanics. For example, the nucleus of a hydrogen atom establishes a potential that affects the electron. We can calculate this potential simply, using Coulomb's Law. We then plug that potential into the Schrödinger equation and solve it; this establishes the wavefunction of the electron, from which we can predict all sorts of neat things, like the colors of light that hydrogen emits!

What is a wavefunction?

A wavefunction represents the state of a system, such as an electron. It is literally a function, whose inputs are time and position, and whose output is a complex number. When written this way, physicists use the Greek letter psi: ψ(x,t)

It is also possible to express the wavefunction as a function of time and momentum. Here physicists use the Greek letter phi: φ(p,t). Other coordinate systems are possible but these two (position and momentum) are the most common.

You do more than just plug time and space into the wavefunction! You plug the wavefunction itself into all sorts of integrals, from which you determine many dynamical properties: position, velocity, kinetic energy, momentum, and so on. You also do algebra on wavefunctions: add them to each other, multiply them by scalars, and so on. Eventually the wavefunction takes on a life of its own, not merely a function but a value in its own right.

If you know some linear algebra, this notion of adding and multiplying by scalars may remind you of vectors. Indeed, you can think of the wavefunction as a vector, who lives in a type of vector space called Hilbert space.

The output of the wavefunction ψ is a complex number. If you take the absolute value of that complex number, and you square it, it gives you the probability of finding the particle at that point. (Recall that the absolute value of a complex number is a real number).

At this point, you may wonder why we don't just take the squared absolute value of the wavefunction itself, call that the wavefunction, and avoid this annoying complex number two-step? Read on!

Properties of wavefunctions

It's not very hard to be a wavefunction. You have to satisfy the Schrödinger equation, and moreover you have to be localized: as we move further away in space, you have to get closer and closer to zero. Otherwise, you get nutty, non-physical results like probabilities that sum to more than 1.

The Schrödinger equation is linear. This means that if you have two wavefunctions, you can add them together and get a new wavefunction, and it also satisfies the Schrödinger equation. If you've heard of superposition, that's what that is. The visualizer allows you to create superpositions (click the + button).

Linearity also means you can multiply a wavefunction by whatever constant you want, like 7, and it still satisfies the Schrödinger equation. You can even multiply it by a complex number, like 3 + 5i. When you do this, nothing happens: all wavefunctions that are (complex) multiples of one other represent the same physical state! (Except zero!) This will be a very useful property in our numerical technique.

Wavefunctions as Vectors

Recall that wavefunctions are functions, but it's also natural to treat them as vectors in a vector space. If you know some linear algebra, you may remember that vector spaces have a basis - in fact, many of them. A basis is like the cardinal directions, from which all directions can be given ("Northeast by east"). All wavefunctions are a superposition of the basis wavefunctions! This helps us understand an arbitrary wavefunction by decomposing it into its basis wavefunctions, which may be simpler.

Of course, you can come up with a different basis, and it will be just as valid. A superposition isn't inherent, it is just an artifact of which coordinate system you choose to describe the wavefunction.

The Energy Basis

One especially interesting coordinate system is called the energy basis. It is called the energy basis because it is the eigenbasis of the energy operator. The "cardinal directions" of our energy basis are wavefunctions of definite energy. These wavefunctions have a very simple time dependence: their absolute value at every point doesn't change!

This visualizer allows you to build wavefunctions by adding up the energy basis components.


Exercises

These exercises are designed to be done with only the visualizer and your brain.
  1. Stationary States

  2. Use the "V" button to load the Simple Harmonic Oscillator potential, with just the single energy bar (the horizontal red line with the slider). Pause the simulation by clicking the play (triangle) button. Move the energy bar up and down to try to find an energy that eliminates the "kink" in the wavefunction (on its right side).
  3. What is the smallest energy that eliminates the kink in the wavefunction?

    Notice the gap between this energy and the bottom of the potential! This is the ground state energy. In a classical world, you can go all the way down to the minimum: your ball can rest at the bottom of the bowl. Not so in a quantum world! Your quantum state must have some kinetic energy.

  4. What other energies eliminate the kink in the wavefunction? Can you find a formula for them?

    The set of allowed energies is quantized. This means that if you want your system to have a definite energy, you can't pick any old energy. You must select from the allowed list of eigenenergies.

    Does this mean that the system can only have these energies? We can build a system whose energy expectation value is anything we please, as long as we stay above the ground state. However, these systems are necessarily a mixture of states with the quantized energies. If we measure their energy, we will only ever see one of the quantized values.

  5. In the ground state, is the particle more likely to be found in the center or near the edges? How about for the next-smallest energy? To answer these questions, turn on |ψ|2. Its graph shows you where the particle is most likely to be found.

    A classical harmonic oscillator ("ball-on-a-spring") spends most of its time at the edges.

  6. Tunnelling

  7. Locate the two points where the energy bar crosses the potential. (The thin gray lines help you here). These are the classical turning points. A classical particle cannot reach outside of the turning points, because its kinetic energy would be negative. But a quantum particle may be found in the classically forbidden region. This is quantum tunnelling.
  8. Display |ψ|2. Locate the classically forbidden region. Does the wavefunction tunnel into this region?
  9. Try some other potentials. Which potential has no tunnelling? Why not?
  10. Load the Two Square Wells potential. Try to find the energy that maximizes the amount of tunnelling into the potential barrier (the "wall" in the middle).
  11. Time Evolution

  12. Ensure the Play button ▶ is clicked, and enjoy the show. The z-axis (depth) represents the imaginary component of the wavefunction.
  13. Does more energy make the wavefunction rotate faster or slower?
  14. Display |ψ|2. Why doesn't it move?
  15. Add another energy by clicking the + button. Why does |ψ|2 move now?

    States with definite energy change their complex phase, but not their complex magnitude (at a given point in space). Informally, the wavefunction doesn't shrink or grow in time, it just goes around.

    But once you have two states, their phases interfere. When you add two complex numbers, the resulting magnitude may be bigger (constructive interference) or smaller (destructive interference) than the original magnitudes, depending on the phase.

    And if those states have different energies, their phase goes around at different speeds. This means the type of interference at each point changes in time. Now it is constructive; a moment later it is destructive.

  16. Momentum

  17. Load the Infinite Square Well solution and start at the ground state. Show the momentum magnitude |φ|2. What does the momentum distribution look like?

    A momentum spike in the middle means that the particle is most likely to be found with zero momentum. This is the "rest in the bottom of the bowl" state.

  18. Now move the energy bar up. What happens to the momentum?

    A spike to the left or right means the particle is likely to be found moving left or right respectively. The further away the spike is from the center, the faster the particle is moving.

  19. Does more energy make the particle move faster or slower?

    Note this is separate from the rate of oscillation. You answer this by looking at the distribution of the momentum-space wavefunction, not how it moves.

  20. Load an asymmetric potential, such as the stepped square well, with a single energy. Notice that the position space wavefunction is asymmetric. Is the momentum space wavefunction asymmetric too? Why or why not?
  21. A classical particle in a 1D potential well will "bounce:" roll up one side, then the other. Its momentum thus oscillates left, right, left... Can you make our quantum momentum oscillate? (Hint: you can't do it with just one energy!)

The Numerical Method

The Schrödinger equation is a second order differential equation. This visualizer numerically solves the Schrödinger equation using the Numerov method, which is fast and accurate. It is a "step" method, meaning that it constructs each point by building on the previous point(s). However, there are a few wrinkles.

The starting point of this work is Numerical Methods in Quantum Mechanics, by Paolo Giannozzi.

Blow-up solutions

One problem is that solutions to the Schrödinger equations "want" to blow up to infinity. In physical systems, the particle should be localized to some region (like the lab!), which means the wavefunction of a bound particle must approach zero as you get further away. Only a few solutions to the Schrödinger equation localize the particle in this way, and those solutions only exist for very precise energies. Numerically we are much more likely to "find" a solution that approaches infinity.

To prevent this (following Giannozzi), we construct TWO wavefunctions. The "inside out" one starts from inside the potential and steps towards the edge. This solution is well behaved in the center, but probably blows up towards the edge. The "outside in" solution assumes the wavefunction is zero at the boundary, and steps towards the center. This solution does not blow up, but it often decays to zero towards the center.

Once we have these two solutions, we join them into a single wavefunction. Towards the center, this will be our "inside out" wavefunction, and towards the end it will be the "outside in." Unless we are very lucky, they will not have the same value at the point they meet - but we can force them to! This leverages linearity: the remarkable fact that scaling a wavefunction by any complex number produces the same physical result; thus given two wavefunctions, we can always join them at a point by just scaling the first to match the second, at that point (unless it's zero!)

Kinks

Note that while we can always make our "inside out" and "outside in" wavefunctions agree at the turning points, we cannot force their derivatives to agree. Thus our chimera wavefunction does not actually solve the Schrödinger equation at that point, since the first derivative is not defined! This is a manifestation of the fact that there are no solutions of the Schrödinger equation at the chosen energy, except for the unphysical blow-ups.

At what point should we join them? The natural choice is the "classical turning points:" the (outermost) point where the potential equals the energy, i.e. our particle has zero kinetic energy. Understanding why this point is natural requires understanding a bit of the Schrödinger equation.

Modes of the Schrödinger Equation

The (time-independent) Schrödinger Equation has the form:

-d2ψ / dx2 + PotentialEnergy * ψ = TotalEnergy * ψ

Rearranging, we get:

-d2ψ / dx2 = (TotalEnergy - PotentialEnergy) * ψ

which can be understood as:

-d2ψ / dx2 = KineticEnergy * ψ

(Note the KineticEnergy is a function of x). Usually the KineticEnergy is positive. Shifting the minus sign to the other side and squinting, we get an equation that is sort of like:

d2ψ / dx2 = SomethingNegative * ψ

The solution is a complex exponential: sines and cosines. So in this regime of positive kinetic energy, ψ is an oscillating sinusoidal.

But what if the kinetic energy is negative? Then we get an equation that looks like:

d2ψ / dx2 = SomethingPositive * ψ

The solution is a real exponential (hyperbolic sine/cosine). This means we either exponentially blow-up (ex) or exponentially decay (e-x). The blow-up is non-localized, which is unphysical, so the only physical possibility is exponential decay.

(What if the kinetic energy is zero? Then we get that ψ is a line. A line can only go to zero at infinity if it is already everywhere zero, i.e. no particle at all.)

Note that this notion of "negative kinetic energy" is really a mathematical trick. You can measure the position of a particle, and compute what a classical particle's kinetic energy "would have to be" at that point. However it's a mistake to say that the particle has a negative kinetic energy; because of the uncertainty principle we can't say what its energy precisely is at all. Indeed, if you measure the kinetic energy directly, you will never see a negative value (exercise for the reader: prove this!)

So to summarize, the Schrödinger Equation for physical states has two modes: oscillating and exponential decay, which correspond to the classically allowed and forbidden regions respectively. The classical turning points represent switching between the two modes. Thus the turning points are a natural place to join our two wavefunctions.

This change in the first derivative is visible as a kink in the wavefunction. It's only at very special energies that the first derivatives happen to match and the kink disappears. These are the eigenenergies, and this illustrates how quantization of energy arises.

Starting Points

There is a second wrinkle: the Numerov method requires TWO initial points to get it started. (Indeed, it would be surprising if it did not: the Schrödinger equation is second-order, so we need two boundary conditions.) These points are next to each other: think ψ(x) and ψ(x + dx).

Here we leverage the fact that we can multiply a wavefunction by any nonzero complex number, and we get a physically-identical new solution. This means that the actual starting value of the wavefunction hardly matters: we're just going to scale it anyways! All that matters is whether it's zero or nonzero.

So there are only two interesting cases: either exactly one of ψ(x) and ψ(x+dx) are zero, or neither of them is zero. (If both are zero, we get the trivial solution ψ = 0). Furthermore, if one is zero, it doesn't matter which one (by continuity the solutions must be very close to each other). So either ψ(x) is zero, and ψ(x) is nonzero. Note that if our potential is symmetric, and we let our starting x be its minimum, these solutions correspond to odd and even wavefunctions.

So for any given energy, we have two solutions, corresponding conceptually to odd and even wavefunctions. We can mix (linearly combine) these two solutions however we like to get a new wavefunction with that energy. In particular, we can combine them so that one of the kinks cancels out! That is, we choose a linear sum that zeros out the discontinuity in the first derivative, on the left side. If this happens to cancels out the right-side kink too, we have found an eigenenergy, and our solution is physical.

This has the compelling visual effect of making the wavefunction appear to "extrude" from the right side as the energy increases. This is evocative, but not physically meaningful: only the energy eigenvalues are allowed.

Acknowledgements

The graphics use WebGL via threejs. The tour uses introjs. The remainder of the code is original.

Come help out on GitHub!

This work was made by possible thanks to: