This paper analyses the mathematical properties of some unusual quantum states that are constructed by inserting an impenetrable barrier into a chamber confining a single particle. If the barrier is inserted at a fixed node of the wave function, then the energy of the system is unchanged. After barrier insertion, a measurement is made on one side of the chamber to determine if the particle is physically present. The measurement causes the wave function to collapse, and the energy contained in the subchamber where the particle is not present transfers instantaneously to the other subchamber where the particle now exists. This thought experiment constitutes an elementary example of an Einstein–Podolsky–Rosen experiment based on energy conservation rather than momentum or angular–momentum conservation. A more interesting situation arises when one inserts the barrier at a point that is not a fixed node of the wave function because this process changes the energy of the system; the faster the barrier is inserted, the greater the change in the energy. At the point of a sudden insertion the energy density becomes infinite; this energy instantly propagates across the subchamber and causes the wave function to become fractal. If an energy measurement is carried out on such a fractal wave function, the resulting mixed state has finite non–zero entropy. Fractal mixed states having unbounded entropy are also constructed and their properties are discussed. For a finite time insertion of the barrier, Landauer's principle is shown to be insufficient to resolve the apparent violation of the second law of thermodynamics that arises when a Maxwell demon is present. This problem is resolved by calculating the energy required to insert the barrier.