Solve the Schrodinger equation for the simplest trap there is — a particle between two walls it cannot cross — and the answer is a ladder of allowed energies, E = n²h² / 8mL², with a wave function psi(x) = sqrt(2/L) · sin(nπx/L) for each rung. Drag the box width and the quantum number below and watch both respond together.

Particle in a Box: Energy Levels and Wave Functions

The Schrodinger equation, solved for the simplest trap there is. Set the box width and the quantum number and watch the wave function gain exactly one more half-wave — and one more interior node — per step up, while the energy ladder beside it climbs as n squared.

Energy of this level  E = n²h² / 8mL²
3.384 eV
5.421 × 10-19 J
Box width L1.00 nm
Quantum number n3
Gap to the level above  E(n+1) − E(n) 2.368 eV
Gap down to n − 1  (2n−1)h² / 8mL² 1.880 eV
Photon emitted falling to n − 1 659.5 nm visible light
De Broglie wavelength  2L / n 0.667 nm
Interior nodes  n − 1 2
Half-waves in the box 3
Particle: electron · mass 9.109 × 10-31 kg
h = 6.62607015 × 10-34 J·s · walls infinitely high
Tip: hold n fixed and halve the box width. Every level jumps by a factor of four, because L is squared and sits underneath.

How to use the Schrodinger equation simulator

Start with the quantum number n slider, because it is the one that shows you what quantisation actually means. Every step up adds exactly one more half-wave between the walls, and therefore exactly one more interior node — a point inside the box where the wave crosses zero and the particle is never found. The panel counts those nodes for you, and the count is always n minus 1, so the ground state has none at all. The dots on the curve are placed from the drawn wave rather than from the number, so what you count on screen and what the readout says can never disagree.

Now watch the ladder on the right while you drag. It is drawn to true n-squared scale, not evenly spaced, so the rungs sit at 1, 4, 9 and 16 ground-state units and crowd together near the floor. The shaded band shows the gap you just crossed at its real height, labelled in those same units, and it grows by two every step: 3 units from n = 1 to 2, then 5, then 7. That is the 2n − 1 pattern, and seeing it as a widening band makes it much harder to forget than seeing it as a formula.

The box width L slider is the other half of the story, and it is worth dragging slowly. Every level moves as 1 over L squared, so widening the box pushes the whole ladder down hard while leaving its shape untouched — the rungs stay at 1, 4, 9 relative to one another whatever L is. Squeeze the box instead and the levels fly apart. This is the knob that quantum-dot engineers actually turn, and the same arithmetic is available as a solver on the particle in a box calculator when you want a specific number rather than a trend.

Two buttons round it out. Proton swaps the trapped particle for one 1836 times heavier, which divides every level by that factor and drops a visible-light transition into the microwave; it is the cleanest demonstration on the page that quantisation is not something only electrons do, merely something only light particles do noticeably. Show probability adds a second panel with the square of the wave function, the quantity that actually tells you where the particle is likely to be, together with a dashed line marking the flat answer classical physics would have given. The full derivation behind all of it is set out in the guide to the Schrodinger equation.

Worked example: change one control at a time

Press Reset to load an electron in a 1.00 nm box at n = 3, then move a single control per step. Every figure in the table is the string the simulator itself printed for those slider positions — the values were read back out of the running lab, not worked out on paper — so if the table and the tool ever disagree, the tool is right.

What the simulator reports as each control moves
Step Energy of this level Gap to the level above Gap to the level below Photon emitted Interior nodes Band
Reset: an electron in a 1.00 nm box at n = 3 3.384 eV 2.632 eV 1.88 eV 659.4 nm 2 visible light
Drag n down to the ground state 0.376 eV 1.128 eV no lower level nothing to emit 0 -
Step up one level, to n = 2 1.504 eV 1.88 eV 1.128 eV 1099 nm 1 infrared
Take n to the top of the ladder, n = 8 24.07 eV 6.393 eV 5.64 eV 219.8 nm 7 ultraviolet
Back to n = 1, then halve the box to 0.50 nm 1.504 eV 4.512 eV no lower level nothing to emit 0 -
Widen it right out to 5.00 nm at n = 1 0.01504 eV 0.04512 eV no lower level nothing to emit 0 -
A 1.00 nm box at n = 3 again, now a proton 0.001843 eV 0.001434 eV 0.001024 eV 1.211 x 10^6 nm 2 microwave

Rows three and five are the pair to compare. Doubling n and halving L land on exactly the same energy, 1.504 eV, because n sits squared on top and L sits squared underneath — the simulator gives you two physically different routes to one number. Row four shows the ladder at full stretch: at n = 8 the level is 24.07 eV, sixty-four times the ground state, with seven interior nodes packed between the walls. Row seven is the mass term working alone; nothing about the box changed, but swapping the electron for a proton pushed the emitted photon from 659 nm, which you can see, out to 1.2 millimetres, which you cannot.

What each control does

The four controls, their ranges and what each one changes
Control Range What it changes
Box width L 0.10 nm to 5.00 nm, in steps of 0.05 nm Scales every level as 1 over L squared, and stretches the box the wave has to fit
Quantum number n 1 to 8, whole numbers only Adds one half-wave and one interior node per step, and moves the highlighted rung up the ladder
Particle Electron or proton Divides every level by the mass ratio, 1836.15, when you switch to the proton
Probability Show or hide the second panel Draws the square of the wave function, with the flat classical guess dashed across it

The misconception this simulator is built to kill

Ask most people what the lowest energy of a trapped particle is and they will say zero — put it in the box, let it settle, and eventually it stops. The simulator makes that answer impossible to hold. Set n to 1, its smallest value, and the energy readout does not read zero; at 1.00 nm it reads 0.376 eV, and no control on the page will drive it lower except widening the box, which never reaches zero either. The wave function is still there, one clean hump, with a real amplitude.

The reason is structural rather than arithmetic. A stationary state has to vanish at both walls, and it has to be non-zero somewhere in between or there is no particle to speak of. The smallest shape meeting both conditions is a single half-wave, and a half-wave of length L carries a definite wavelength, hence a definite momentum, hence kinetic energy that cannot be taken away. Confinement itself costs energy. That is also the uncertainty principle stated in different words — pin a particle inside a width L and you force a momentum spread of order h-bar over L — and the same floor comes out of the argument from that direction, as set out in the guide to the Heisenberg uncertainty principle.

The probability panel makes the second common misconception just as hard to keep. Classical intuition says a particle rattling between two walls spends equal time everywhere, which would draw a flat line — and that flat line is on the plot, dashed, so you can compare. The real density is nothing like it: at n = 1 the particle is overwhelmingly likely to be found near the middle and almost never near the walls, and at higher n it develops n distinct peaks with genuine dead spots between them. Only as n climbs do the peaks crowd together enough that the average starts to resemble the classical guess, which is the correspondence principle appearing on screen rather than being asserted.

Where the infinite well stops being true

The walls here are infinitely high, which no real wall is. In a genuine quantum well the barrier is finite, so the wave function leaks a short way into it instead of stopping dead, and the particle behaves as though its box were slightly wider than the one you measured. Every real level therefore sits a little below what this simulator predicts, with the gap growing for shallow wells and for high levels. Near the top of a finite well the ladder simply ends, because a particle with more energy than the barrier is not bound at all.

The box is also one-dimensional, flat-bottomed and single-occupancy. A real quantum dot confines in three directions, so its levels are sums of three independent terms and the tidy 1, 4, 9 pattern gives way to a denser set with repeated values. A real molecule has individual nuclei rather than a uniform floor. And a real dot holds many electrons, which repel one another and shift the levels appreciably. Read the numbers here as the right order of magnitude and, more importantly, the right scaling — as n squared, as 1 over L squared, as 1 over m — rather than as spectroscopic predictions.

Frequently asked questions

Why does the energy jump so fast when I raise n?

Because the energy carries n squared, not n. The ladder in the simulator is drawn to that true scale, so the rungs are not evenly spaced: measured in units of the ground state they sit at 1, 4, 9, 16 and so on, and the gap you cross going from n minus 1 up to n is 2n minus 1 of those units. Step from 1 to 2 and you cross 3 units; step from 7 to 8 and you cross 15. The shaded band on the ladder is that gap drawn at its real height, which is why it visibly grows every time you nudge the slider up. The physical reason is that each step up adds one more half-wave inside the same box, which shortens the wavelength, and shorter wavelength means more momentum, and kinetic energy goes as momentum squared.

What happens if I make the box wider?

Every level falls, and it falls fast, because L is squared and sits underneath: energy is proportional to 1 over L squared. Doubling the width divides every level by four; going from 1.00 nm to 5.00 nm divides the ground state by twenty-five, from 0.376 eV to 0.01504 eV. What does not change is the shape of the ladder. The rungs stay at 1, 4, 9, 16 relative to each other no matter what L is, because L is the same in every term. Widen the box far enough and the levels crowd so close together that the ladder stops looking like a ladder at all, which is exactly why a marble in a box has no measurable quantisation and an electron in a molecule does.

Why is the lowest energy not zero?

Because a wave that is zero everywhere is not a particle. The wave function has to vanish at both walls and still be somewhere in between, and the smallest shape that satisfies both is a single half-wave, n = 1. Set n to 1 in the simulator and the curve is one hump: no interior nodes, but a real amplitude. That state has energy h squared over 8mL squared and there is no way to remove it, because removing it would mean flattening the wave to nothing. This is the ground state, and its stubborn non-zero value is the same effect that keeps helium liquid at absolute zero and keeps atoms from collapsing.

Does this apply to a real atom?

Not directly, and the difference is instructive. An atom traps its electron in a Coulomb well that gets deeper toward the nucleus, not in a flat box with vertical walls, so its levels go as minus 1 over n squared and crowd closer together as n rises. The box does the opposite: its levels spread further apart as n rises. Comparing the two is the fastest way to see that the level pattern comes from the shape of the trap rather than from quantum mechanics in general. Where the box does apply well is anything confined by an engineered structure rather than by a nucleus, such as a quantum dot, a semiconductor quantum well or an electron delocalised along a conjugated molecule.

What units are the readouts in?

Energies appear twice, in electronvolts as the headline figure and in joules underneath, because atomic-scale work is almost always quoted in eV while the SI answer is what a physics problem expects. Wavelengths, both the emitted photon and the de Broglie wavelength, are in nanometres, with a human-scale reading added when the number gets large; a proton in a wide box emits at millimetre wavelengths, so the panel says so in words. The box width is in nanometres and the node and half-wave counts are pure numbers. Very large and very small figures switch to a mantissa times a power of ten rather than running off the panel.

References & formula source

  • Griffiths — Introduction to Quantum Mechanics, chapter on the infinite square well.
  • Eisberg & Resnick — Quantum Physics of Atoms, Molecules, Solids, Nuclei and Particles, chapter on Schrodinger theory.
  • NIST — Fundamental Physical Constants (CODATA 2022): h = 6.62607015e-34 J s (exact), electron mass 9.1093837139e-31 kg, proton mass 1.67262192595e-27 kg.
  • Further reading: Particle in a box — Wikipedia