  In PT quantum mechanics a fundamental principle of quantum mechanics, that
the Hamiltonian must be hermitian, is replaced by another set of requirements,
including notably symmetry under PT, where P denotes parity and T denotes time
reversal. Here we study the role of boundary conditions in PT quantum mechanics
by constructing a simple model that is the PT symmetric analog of a particle in
a box. The model has the usual particle in a box Hamiltonian but boundary
conditions that respect PT symmetry rather than hermiticity. We find that for a
broad class of PT-symmetric boundary conditions the model respects the
condition of unbroken PT-symmetry, namely that the Hamiltonian and the symmetry
operator PT have simultaneous eigenfunctions, implying that the energy
eigenvalues are real. We also find that the Hamiltonian is self-adjoint under
the PT inner product. Thus we obtain a simple soluble model that fulfils all
the requirements of PT quantum mechanics. In the second part of this paper we
formulate a variational principle for PT quantum mechanics that is the analog
of the textbook Rayleigh-Ritz principle. Finally we consider electromagnetic
analogs of the PT-symmetric particle in a box. We show that the isolated
particle in a box may be realized as a Fabry-Perot cavity between an absorbing
medium and its conjugate gain medium. Coupling the cavity to an external
continuum of incoming and outgoing states turns the energy levels of the box
into sharp resonances. Remarkably we find that the resonances have a
Breit-Wigner lineshape in transmission and a Fano lineshape in reflection; by
contrast in the corresponding hermitian case the lineshapes always have a
Breit-Wigner form in both transmission and reflection.
