  We study a harmonic molecule confined to a one--dimensional box with
impenetrable walls. We explicitly consider the symmetry of the problem for the
cases of different and equal masses. We propose suitable variational functions
and compare the approximate energies given by the variation method and
perturbation theory with accurate numerical ones for a wide range of values of
the box length. We analyze the limits of small and large box size.
