B9 · Lesson 5 · Quantum lab
Energy levels by matrix, a finite well by bisection, tunneling and the uncertainty principle in code
The first four lessons solved the box with hard walls exactly and estimated everything else: finite wells, barriers, wave packets. A computer removes the need to estimate. In this lab you'll find a box's energy levels as the eigenvalues of a matrix, solve a finite well's ground state by bisection, compute the exact chance of tunneling through a barrier and see when the simple exponential estimate is trustworthy, and check the uncertainty principle on a wave packet with the FFT.
- An electron of energy E meets a barrier of height V and thickness d. The solid curve is the exact chance of getting through, the dashed one the simple estimate , on a log scale against thickness.
- For thick barriers the two curves lie on top of each other. For thin ones the estimate overshoots, and at zero thickness it gives a nonsense value.
- The readout gives the exact transmission through 1 nm.
Predict
A GaAs well 10 nm wide (effective mass 0.067) has walls 0.3 eV high instead of hard walls. How does its ground state compare with the hard-walled box's 56 meV?
Lower, about 34 meV. With finite walls the wave leaks a little way into them, so it fits a slightly longer half-wavelength than the well's width, and a longer wavelength means less energy. Here the leak is large enough to bring the energy down to 61% of the hard-wall value, which is why real quantum-well lasers emit at longer wavelengths than the simple box predicts.
Name it
Levels from a matrix
On a grid of spacing Δx, the second derivative is , so the Schrödinger equation becomes a matrix eigenvalue problem. The matrix has on its diagonal and beside it, and its eigenvalues are the energy levels. Any potential can be added to the diagonal.
A finite well
For a well of depth and width a, the even states satisfy , with inside and in the walls. The ground state lies below both and the hard-wall value, and bisection finds it by halving an interval where the function changes sign.
Exact tunneling
Through a rectangular barrier of height and thickness d, with ,
which for becomes .
Uncertainty by FFT
A wave packet's momentum distribution is its Fourier transform. For a Gaussian , the spreads of in x and of its transform in k multiply to exactly , the smallest product the uncertainty principle allows.
Worked example
How accurately does a 500-point grid reproduce the levels of a 1 nm box?
Show the solution
- Compare the levels. The matrix gives the three lowest levels below, against the exact values (computed with the same constants).
| Level | Grid (eV) | Exact (eV) | Error |
|---|---|---|---|
| 1 | 0.376106 | 0.376108 | 0.0003% |
| 2 | 1.504411 | 1.504430 | 0.0013% |
| 3 | 3.384868 | 3.384968 | 0.003% |
- How the error scales. The errors grow as for higher states and shrink as with more points.
- Where the grid struggles. The grid struggles most with the highest states, which wiggle fastest, but the first few levels come out to four or five digits.
- Other wells. The same code with any potential on the diagonal solves wells nobody can solve on paper.
Answer very closely: the first three levels are off by 0.0003%, 0.0013% and 0.003%.
Worked example
What is the exact chance that a 1 eV electron tunnels through a 3 eV barrier 1 nm thick, and how good is the simple estimate? And through 0.2 nm?
Show the solution
- Decay constant. so κd = 7.24 for the 1 nm barrier.
- The 1 nm barrier. The exact formula gives , and the estimate agrees to six digits.
- The 0.2 nm barrier. Here κd = 1.45, and the exact value is 0.180 while the estimate gives 0.196, 9% high.
- Where the estimate works. The simple exponential holds whenever κd is more than about 2, which covers almost every barrier that matters in devices.
Answer through 1 nm the chance is , and the estimate agrees to six digits; through 0.2 nm it's 0.180, and the estimate is 9% high.
Worked example
What are the wavelengths of the first three Balmer lines, from ?
Show the solution
- Photon energies. Drops to level 2 from levels 3, 4 and 5 release which is 1.889, 2.550 and 2.856 eV.
- Wavelengths. Those are 656.4, 486.2 and 434.1 nm: red, blue-green and violet.
- Compare with measurement. The measured lines are at 656.3, 486.1 and 434.0 nm, so the simple model is off by about a part in 10 000.
- Why they differ. The gap comes mostly from the proton not being infinitely heavy, and correcting for the reduced mass closes most of it.
Answer 656.4, 486.2 and 434.1 nm (red, blue-green and violet).
Check
Step 1. Write box_levels(L, N, k) that builds the N × N finite-difference matrix for an electron in a box of width L (N interior points, spacing ) and returns its k lowest eigenvalues in eV. Use ħ = 1.0546 × 10⁻³⁴ J·s, m = 9.109 × 10⁻³¹ kg and 1.602 × 10⁻¹⁹ J/eV.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 2. Write well_ground(V0, a, mr) that finds the ground state (in eV) of a finite well of depth V0 eV and width a meters for a particle of mass mr times the electron's, by bisection on between nearly 0 and the smaller of V0 and the hard-wall energy.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 3. Write T_exact(E, V0, d) and T_approx(E, V0, d) for an electron (energies in eV, d in meters) tunneling through a rectangular barrier, using the exact formula and the exponential estimate.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 4. Write packet(sigma, N) that samples on N points across 40σ, computes the standard deviations of in x and of in k (with np.fft.fft and np.fft.fftfreq), and returns (dx, dk, dx * dk).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Step 5. Write balmer(nmax) returning the wavelengths in nm of hydrogen's lines from levels 3 to nmax down to level 2, using 13.6 eV and hc = 1239.84 eV·nm, and series_limit() returning the shortest Balmer wavelength.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
An electron of 1 eV meets a barrier 2 eV high and 1.5 nm thick.
(a)
What is κd?
(b)
What is the exact transmission?
Check
A finite-difference grid with N interior points in a box spaces them apart. By roughly what factor would the spacing squared shrink, going from N to 2N + 1 points? (Answer as spacing² at N over spacing² at 2N + 1, divided by 4.)
Explain why
Why does a finite well's ground state sit lower than a hard-walled box of the same width?
In a box with hard walls the wave must vanish exactly at the walls, so half a wavelength fits the width exactly. With finite walls the wave doesn't stop at the edge: it decays exponentially into the walls, so the oscillating part inside no longer has to reach zero at the edge, and the half-wavelength effectively stretches past the width. A longer wavelength means a smaller momentum and less kinetic energy, so every level drops. The shallower the walls, the farther the wave leaks and the larger the drop.
Practice
Keep practicing
4 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.