---
title: "Quantum Harmonic Oscillator Interactive Lab | Sandbox Physics"
description: "If the probability density of a quantum oscillator never changes, is its energy zero? No."
canonical_url: "https://sandboxphysics.com/labs/quantum-harmonic-oscillator/"
language: "en"
page_type: "lab"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/labs/quantum-harmonic-oscillator/"
last_modified: "2026-10-27"
---

Q010 · Eigenstates, superpositions and displacement

# Quantum Harmonic Oscillator

**If the probability density of a quantum oscillator never changes, is its energy zero?** No. In an energy eigenstate the probability density never changes, yet the momentum still has a spread, and even the ground state keeps half a quantum of zero-point energy. No particle is orbiting behind that steady density.

Prepare an energy eigenstate, a coherent mix of neighboring levels or a displaced ground state. See how the nodes, the energy occupations and the position records fit together, with no hidden orbit assumed for the particle.

> Interactive simulation: open this page in a web browser to change the parameters and run the model.

The potential is an ideal one-dimensional harmonic well. The Lab uses Hermite eigenfunctions and the exact evolution of the displaced ground state. Changing the frequency prepares a new state; it is not a sudden quench. The energy bars show weights in the energy basis, while the position density lives in real space.

Recorded distributions and time series

Simulated independent preparations

## Build a distribution, one event at a time

Blue bars are recorded frequencies; the gray curve is a separate model density. Time-series dots show sample means with one standard error; orange dots show sample standard deviations. These are not confidence intervals or particle paths.

Current sample mean and spread

$\text{—}$

Current measured uncertainty product

$\text{—}$

Grid norm and boundary mass

$\text{—}$

Model occupation beyond level 32

$\text{—}$

Hermite eigenstates and displaced-state evolution are analytic. Position and Fourier momentum are sampled on a 2,048-point interval of length 64. The occupation display groups higher levels; its tail does not truncate the evolved displaced state.

Model sources: [MIT 8.04](https://ocw.mit.edu/courses/8-04-quantum-physics-i-spring-2013/pages/lecture-notes/) · [Coherent-state evolution](https://ocw.mit.edu/courses/8-05-quantum-physics-ii-fall-2013/resources/lecture-14-quantum-dynamics-cont/)

Physics tutorial

## Still clouds can carry energy

**Background** A harmonic trap has discrete stationary states with nodes, and even its ground state has nonzero energy.

**Why it matters** In a superposition of levels the relative phase changes in time, and a displacement moves the whole ground-state cloud.

Start with the essentials

- **Focus question**: If the density does not move, is the kinetic energy zero?
- **One-sentence intuition**: A density that never moves can still have a finite spread of momenta and a finite energy.

### Core mathematical model

#### Dimensionless units

$$
X=x/\ell,\quad P=p\ell/\hbar,\quad \tau=\hbar t/(m\ell^2)
$$

Pick a length scale and a particle mass. All displayed numbers use these dimensionless variables, and the code sets the mass and the reduced Planck constant to unity.

#### Hamiltonian of the harmonic trap

$$
H=\tfrac12P^2+\tfrac12\omega^2X^2,\quad E_n=\omega(n+\tfrac12)
$$

The potential stays exactly quadratic over the whole displayed amplitude. Changing the frequency prepares the state again. Equally spaced levels and a nonzero ground energy are properties of this ideal Hamiltonian.

#### Energy eigenfunctions

$$
\phi_n(X)=\frac{(\omega/\pi)^{1/4}}{\sqrt{2^n n!}}H_n(\sqrt\omega X)e^{-\omega X^2/2}
$$

A normalized Hermite recurrence generates levels zero through nine. An eigenstate only changes its global phase, so its density stays still, yet its kinetic and potential energies are both nonzero.

#### Interference between neighboring levels

$$
\psi=\sqrt{1-w}\,\phi_n e^{-iE_n\tau}+\sqrt w\,e^{i\varphi}\phi_{n+1}e^{-iE_{n+1}\tau}
$$

Changing the relative phase moves the interference pattern in space. The occupation weights stay constant during ideal evolution. The energy bars are not positions inside the trap.

#### Displaced ground state

$$
\langle X\rangle=a\cos(\omega\tau),\quad\langle P\rangle=-a\omega\sin(\omega\tau),\quad\Delta X=\frac1{\sqrt{2\omega}}
$$

The center moves like a classical oscillator, and the packet keeps its width. This is an ensemble average, not the path of a hidden point particle. The exact displaced state is not cut off at the displayed levels.

#### Level occupation of a coherent state

$$
P_n=e^{-\bar n}\frac{\bar n^n}{n!},\quad\bar n=\frac{\omega a^2}{2}
$$

The first nine levels get their own bars, and all higher levels are grouped together. The model also tracks the tail beyond level 32 and does not renormalize the visible bars.

#### Separate preparations

$$
\bar q=\frac{1}{N}\sum_j q_j,\qquad s_q^2=\frac{\sum_j(q_j-\bar q)^2}{N-1}
$$

Each event starts from a new preparation, and position and momentum records come from separate ensembles. The standard error says how uncertain a sample mean is; the sample spread estimates the uncertainty of the prepared state.

### Common difficulties

#### A particle or a cloud?

**Typical misconception** The moving density is the known path of one particle.

**Better mental model** The cloud is the distribution of the prepared state. Each recorded point comes from a new preparation, not from tracking one particle continuously.

#### What more shots can fix

**Typical misconception** More shots fix every error.

**Better mental model** More shots reduce sampling noise. They do not correct grid spacing, a periodic boundary, imperfect apparatus or a wrong physical model.

### Run the experiment

1. 01

   #### Watch the ground state

   Replay the ground state and inspect the complex amplitude.

   **What to observe:** The global phase turns, but the probability density does not move.

2. 02

   #### Count the nodes

   Select Three nodes, then change the level and trap frequency.

   **What to observe:** The number of nodes equals the eigenstate index; the trap frequency changes the length scale.

3. 03

   #### Mix two levels

   Mix adjacent levels and vary their weight and phase.

   **What to observe:** The density moves, but the level occupations stay fixed.

4. 04

   #### Displace the ground state

   Displace the ground state and sample positions at nine times.

   **What to observe:** The measured centers oscillate, and the cloud keeps a nonzero width.

Physical conclusion

Treat the state, the position density and the energy basis as three different things.

Starter path · Step 4 of 6

## Start from a single measurement

[Next step → **Which Path & Quantum Eraser** Tag the two paths, then erase the which-path information. Do the fringes come back in all the data, or only after the detections are sorted into groups? Compare · 25 min](https://sandboxphysics.com/labs/quantum-eraser/)

1. [1 Quantum State & Born Measurement](https://sandboxphysics.com/labs/qubit-state/)
2. [2 Stern–Gerlach Sequence](https://sandboxphysics.com/labs/stern-gerlach-sequence/)
3. [3 Wave Packet & Uncertainty](https://sandboxphysics.com/labs/wave-packet-uncertainty/)
4. [4 Quantum Harmonic Oscillator](https://sandboxphysics.com/labs/quantum-harmonic-oscillator/)
5. [5 Which Path & Quantum Eraser](https://sandboxphysics.com/labs/quantum-eraser/)
6. [6 Hong–Ou–Mandel Two-Photon Interference](https://sandboxphysics.com/labs/hong-ou-mandel/)

[View the full path →](https://sandboxphysics.com/topics/quantum/#starter-path)
