We consider quantum particle or Gaussian polymer confinement between two surfaces and in cylinders with sinusoidal undulations. In terms of the variational method, we show that the quantum-mechanical wave equations have lower ground-state energy in these geometries under long wavelength undulations, where bulges are formed and waves are localized in the bulges. It turns out correspondingly that Gaussian polymer chains in undulated boxes or tubes acquire higher entropy than in exactly flat or straight ones. These phenomena are explained by the uncertainty principle for quantum particles, and by a polymer confinement rule for Gaussian polymers. If membrane boxes or tubes are flexible, polymer-induced undulation instability is suggested. We find that the wavelength of undulations at the threshold of instability for a membrane box is almost twice the distance between two walls of the box. Surprisingly, we find that the instability for tubes begins with a shorter wavelength compared to the "Rayleigh" area-minimizing instability.