Quantum Harmonic Oscillator Demos

The left panel is a classical stand-in: a mass on a spring with the same total energy as level n, oscillating between the turning points ±An. It is not the quantum state itself — a true energy eigenstate |n⟩ is stationary (|ψn(x)|² is constant in time); the moving dot only shows where a classical particle of that same energy would be, for comparison. The right panel is the energy-level diagram: the parabola is V(x)=½x², the dashed rails are the quantized energies En=(n+½)ħω, and the highlighted curve is ψn(x) = Hn(x)·e−x²/2 (normalized), riding on the En rail it belongs to. Step levels exactly with the ladder operators â / â†, or drag the weight and let go — that models an energy measurement on the coherent state the pull creates, with the panel below showing the actual (Born-rule) probability of landing on each n.

Spring & mass (classical view)

Click and drag the weight, then release. This is not a real relaxation process — it simulates measuring the energy of the coherent state your pull creates, with the outcome n drawn at random from the probabilities shown under the diagram.

Energy levels & wavefunction ψₙ(x)

V(x) = ½x² potential
allowed energies Eₙ
selected ψₙ(x) / |ψₙ(x)|²
mass position (riding Eₙ)

Controls

Energy Eₙ = (n + ½) ħω0.500
Classical turning point Aₙ = √(2n+1)1.000
Current position x(t)0.000

Hₙ(x) is the bare polynomial — unbounded, so it's deliberately left to run off the chart outside the turning points (dotted lines). Multiplying it by the Gaussian e−x²/2 is what tames it into ψₙ(x), the actual normalizable wavefunction. |ψₙ(x)|² is the position probability density.

Measurement outcome probabilities P(n) — Born rule on the pulled coherent state

P(n) for the last pull
actual measured outcome
mean n̄ = |α|² (classical-energy estimate)

Releasing the mass at rest at displacement x₀ makes a coherent state |α⟩ with α = x₀/√2 — a superposition of many n, not a single eigenstate. Its number distribution is Poissonian, P(n) = e−|α|²|α|2n/n!. Free evolution would keep oscillating classically forever without collapsing; only an actual energy measurement forces a single random outcome n, with exactly these probabilities. That's why a small pull can still occasionally measure n=2 or n=3 — it doesn't deterministically round to the "nearest" level.

Ladder operators as matrices (number basis) & state vector |ψ⟩

â (lower) — subdiagonal ⟨n−1|â|n⟩ = √n
↠(raise) — superdiagonal ⟨n+1|â†|n⟩ = √(n+1)
|ψ⟩ = |n⟩, the current state as a one-hot vector

Both operators are drawn as (NMAX+1)×(NMAX+1) grids over the truncated basis |0⟩…|9⟩; cell brightness encodes |⟨row|Ô|col⟩|, so the ladder-shifting rule from the box above shows up as a single off-diagonal band. The shaded column is the current ket |n⟩; the outlined cell is the one entry either operator actually uses when it acts on that column.

N atoms in a ring, each linked to its two neighbors by identical springs (stiffness K), with atom N linked back to atom 1 — periodic boundary conditions. In Fourier (normal-mode) coordinates the Hamiltonian decouples into N independent oscillators, one per allowed wavevector k: Ĥ = Σk [ (1/2m) p̂kp̂−k + ½ m ωk² x̂kx̂−k ],   ωk² = (4K/m) sin²(ka/2). Each of the N allowed k's is exactly the single-oscillator problem from the first tab, just with its own ωk — and its own independent occupation number nk. The full state is a product over every mode, |n0, n1, …, nN−1⟩ — âk / âk† raise or lower only the one mode k you're currently inspecting, leaving every other mode's occupation number untouched.

Atom chain (real space)

Displacement is drawn transverse purely for visibility (the real motion is longitudinal, along the chain). The dashed arc is the periodic link — atom N connects back to atom 1. The dotted orange curve is the selected mode's own contribution in isolation; the atoms follow the sum of every mode's contribution, since each keeps its own occupation number.

State |n₀, n₁, …, nN−1⟩

One independent phonon number per mode — click a mode above, then use âₖ/âₖ† to change just that one.

Dispersion ω(k) & this mode's levels

Click any dot to jump to that mode — that's the other way to change k, besides the slider.

Levels are drawn in units of ħωk — every mode's ladder looks identical on this normalized axis, but the real energy spacing still scales with ωk (read it off the dispersion plot above).

Controls

Wavevector k0.000
ωₖ = √(4K/m)·|sin(k/2)|0.000
Phonon number nₖ0
Energy E = (nₖ+½)ħωₖ0.000

k = 0 is the zero-frequency translation mode: the whole ring drifting rigidly. There is no restoring force for it, so it is not a bound oscillator and has no discrete levels.

Mode k's ladder operators as matrices & state vector |ψ⟩

âₖ (lower) — subdiagonal ⟨n−1|âₖ|n⟩ = √n
âₖ† (raise) — superdiagonal ⟨n+1|âₖ†|n⟩ = √(n+1)
|ψ⟩ = |nₖ⟩, this mode's occupation as a one-hot vector

Every mode has its own copy of these matrices, acting only on that mode's own Fock space — this shows the currently-selected mode k's âₖ / âₖ† and its current occupation |nₖ⟩. The shaded column is the current ket; the outlined cell is the one entry either operator uses when it acts on it.

Same Hamiltonian as the first tab, plus one extra term: Ĥ = p̂²/2 + ½x̂² + λx̂⁴. Unlike the plain ½x̂² potential, this one has no closed-form eigenstates, so the energies En and wavefunctions ψn(x) shown here come from numerically diagonalizing Ĥ inside the truncated harmonic-oscillator basis |0⟩…|9⟩ — the same basis, Hermite functions, and turning-point logic as tab 1, just no longer an eigenbasis of this particular Ĥ. Two things follow directly: the levels stop being evenly spaced by ħω (the quartic wall stiffens faster than the parabola, so spacing grows with n instead of staying constant), and â / ↠stop being ladder operators for these states — they still shift |k⟩ by one step in the harmonic basis, but that no longer maps one true eigenstate of Ĥ onto another, so they're not offered as controls here. Drag λ up from 0 to watch the parabola's evenly-spaced levels warp continuously into the quartic ones.

Spring & mass (classical view)

Displays the classical analog oscillating between ±An, the turning points of V(x) = ½x² + λx⁴ at the selected level's energy. Oscillation speed here is stylized for visibility, not the true (amplitude-dependent) anharmonic period.

Energy levels & wavefunction ψₙ(x)

V(x) = ½x² + λx⁴ (dashed: plain ½x² for comparison)
diagonalized energies Eₙ
selected ψₙ(x) / |ψₙ(x)|²
mass position (riding Eₙ)

Controls

Energy Eₙ (diagonalized)0.500
SHO energy (n+½), for comparison0.500
Classical turning point Aₙ1.000
Current position x(t)0.000

No â / ↠buttons on this tab — see the blurb above: those ladder operators act on the harmonic basis, not on the true eigenstates of this Ĥ once λ ≠ 0.

Hamiltonian in the harmonic-oscillator basis & eigenstate mixing

|⟨i|Ĥ|j⟩| heatmap
|⟨k|n⟩|² — weight of basis state k in eigenstate n

In the pure SHO, Ĥ is exactly diagonal in |0⟩…|9⟩ and every eigenstate is a single one-hot basis vector (see tab 1's matrix panel). Here λx̂⁴ only couples states of matching parity (|i−j| = 0, 2, or 4), so Ĥ has this banded structure instead — and diagonalizing it mixes several |k⟩ into each true eigenstate |n⟩, shown as the bar chart on the right instead of a single spike.

Second quantization: instead of a wavefunction ψ(x,y), the state lives in Fock space and particles are made by operators. Here a 4×4 lattice gives 16 single-particle modes. In position space a†r (bosons) or ĉ†r (fermions) puts a particle at site r=(x,y). In momentum space a†k = (1/4) Σr ei k·r a†r creates a plane wave with k=(2π mx/4, 2π my/4). Acting once on the vacuum gives a single particle either way; the statistics only show up when you create a second one — bosons stack (√(n+1) factors), fermions are Pauli-blocked and pick up sign flips (ĉ†rĉ†s = −ĉ†sĉ†r). Click a cell in either grid to pick the mode.

Position space ⟨nr⟩

Arrows = single-particle amplitude ψ(r) (phase → direction), shown when the state has exactly one particle.

Momentum space ⟨nk⟩

Axes are integers m with k = 2π m / 4. Arrows = ψ̃(k) = ⟨0|âk|ψ⟩.

Particles in the box

Dots are samples drawn from the current state's ⟨nr⟩ and ⟨nk⟩ and then stream freely with their sampled momentum (periodic box). Creating adds a ring pulse, destroying leaves a fading ghost. Re-sampled after every operator.

Controls

Selected mode
⟨N⟩ particles0
‖ψ‖²1

Current operator

Particle number is capped at 3 here to keep the Fock-space expansion small.

Three fermionic modes give an 8-dimensional Fock space with basis |n₁n₂n₃⟩, nj ∈ {0,1}. Creation and annihilation operators are 8×8 matrices built by the Jordan–Wigner construction: ĉ†j = Z⊗…⊗Z⊗σ+⊗I⊗…⊗I, where the Z string (diagonal +1/−1) supplies the fermionic sign by counting the occupied modes to the left of j. Pick an operator below: the canvas shows M·ψ = ψ′ live, and Apply commits ψ ← ψ′. Orange = positive, blue = negative. Click a row of ψ to jump to that basis state.

Operator · state = new state

Three orbitals ("slots"). A particle's opacity = ⟨nj⟩ in the current state; Apply animates the particle appearing or vanishing in the acted mode.

⟨n₁⟩ ⟨n₂⟩ ⟨n₃⟩ · ‖ψ‖²

Jordan–Wigner factorization of the selected operator

Anticommutation relations, computed from the matrices

Entries show the 8×8 result: I = identity, 0 = zero matrix. {ĉi, ĉ†j} = δij, all others vanish.