  A mathematical framework is constructed for the sum of the lowest N
eigenvalues of a potential. Exactness is illustrated on several model systems
(harmonic oscillator, particle in a box, and Poschl-Teller well). Its
order-by-order semiclassical expansion reduces to the gradient expansion for
slowly-varying densities, but also yields a correction when the system is
finite and the spectrum discrete. Some singularities can be avoided when
evaluating the correction to the leading term. Explicit corrections to the
gradient expansion to the kinetic energy in one dimension are found which, in
simple cases, greatly improve accuracy. We discuss the relevance to practical
density functional calculations.
