Solution (source code)

= Solution

Adjacent <nodes of a wavefunction> are separated by roughly $a/n$, so a locally sinusoidal <wavefunction> has typical <wavevector> $k\sim\pi n/a$. The <kinetic-energy estimate from wavefunction nodes> is therefore
$$
\boxed{\langle K\rangle\sim\frac{\hbar^2\pi^2 n^2}{2ma^2}\quad(n\gg1).}
$$
Equivalently, $\langle K\rangle=\hbar^2\int|\psi'|^2dx/(2m\int|\psi|^2dx)$. The robust scaling is $\hbar^2 n^2/(ma^2)$; the precise coefficient depends on how the extent is defined and how the oscillations vary near <classical turning points>. For few nodes, use an order-one offset to $n$: the nodeless <ground state> still has <confinement energy bound from position support> of order $\hbar^2/(ma^2)$, rather than zero.