We address the paradoxical transformation of a classical-mechanical particle motion when the space and time scales of observation pass down the uncertainty principle threshold. This is analyzed in the language of classical statistical mechanics, considering specifically many-particle systems inhomogeneous along one spatial direction. We employ the density functional formalism in its square-gradient form and find: i) The macroscopic solution is analogous to the classical trajectory of a particle under a potential of force given by (minus) the free energy density. Whereas, ii) fluctuations around the solution in (i) are equal to the quantum-mechanical wave functions of a particle under a potential given by the curvature of the free energy density. We illustrate this situation with three textbook examples: A particle in a box, the harmonic oscillator, and the hydrogen atom. We show that their time-independent Schrödinger equation wave functions describe, respectively, the fluctuations of a fluid interface, of critical point fluctuations, and of a confined ideal gas. At large scales sharp probability distributions make fluctuations irrelevant, the vanishing of the first variation yields the macroscopically observable statistical-mechanical non-uniformity, equivalent to the classical particle trajectory. But at sufficiently small scales, with necessarily very few particles, distributions appear much wider, fluctuations dominate, and one obtains the Schrödinger equation (for the microscopic potential).