  We use the theory of dynamical invariants to yield a simple derivation of
noncyclic analogues of the Abelian and non-Abelian geometric phases. This
derivation relies only on the principle of gauge invariance and elucidates the
existing definitions of the Abelian noncyclic geometric phase. We also discuss
the adiabatic limit of the noncyclic geometric phase and compute the adiabatic
non-Abelian noncyclic geometric phase for a spin 1 magnetic (or electric)
quadrupole interacting with a precessing magnetic (electric) field.
