Quantum Approach to a Derivation of the Second Law of Thermodynamics
Jochen Gemmer
Alexander Otte and G\"unter Mahler
We re-interprete the microcanonical conditions in the quantum domain as constraints for the interaction of the ``gas-subsystem'' under consideration and its environment (``container''). The time-average of a purity-measure is found to equal the average over the respective path in Hilbert-space. We then show that for typical (degenerate or non-degenerate) thermodynamical systems almost all states within the allowed region of Hilbert-space have a local von Neumann-entropy $S$ close to the maximum and a purity $P$ close to its minimum, respectively. Typically thermodynamical systems should therefore obey the second law.
entrooTwoColumn.tex
\documentstyle[pra,eqsecnum,aps,amsmath,amssymb,psfrag,graphicx]{revtex}
\def\>{\rangle}
\def\<{\langle}
%
\def\n{\nonumber}
%
\def\ra{\rightarrow}
\def\ua{\uparrow}
%
\def\lb{\left[}
\def\rb{\right]}
%
\def\lk{\left\{}
\def\rk{\right\}}
\def\<{\langle}
\def\>{\rangle}
%
\def\be#1\ee{\begin{equation}#1\end{equation}}
\def\ba{\begin{eqnarray}}
\def\ea{\end{eqnarray}}
%
\newcommand{\cc}[3]{\ensuremath{\;^{#1}\hspace{-1.5pt}C^{#2}_{#3}}}
\newcommand{\s}[3]{\ensuremath{\;^{#1}\hspace{-1.5pt}S^{#2}_{#3}}}

\input{psfig}

\begin{document}
\draft
%\preprint{}
\twocolumn
%\widetext

\title{ Quantum Approach to a Derivation of the
Second Law of Thermodynamics}
\author{Jochen Gemmer, Alexander Otte and G\"unter Mahler}
\address{Institut f\"ur Theoretische Physik,\\Universit\"at Stuttgart, Pfaffenwaldring 57,\\70550 Stuttgart, Germany}
%\date{\today}
\maketitle

%\tableofcontents

\begin{abstract}
We re-interprete the microcanonical conditions in the quantum domain as
constraints for the interaction of the ``gas-subsystem'' under consideration and
its environment (``container''). The time-average of a purity-measure is found
to equal the average over the respective path in Hilbert-space.
We then show that for typical (degenerate or
non-degenerate) thermodynamical systems almost all states within the allowed
region of Hilbert-space have a local von Neumann-entropy $S$ close to the maximum and 
a purity $P$ close to its minimum, respectively. Typically thermodynamical systems should therefore
obey the second law.
\end{abstract}
\pacs{}

\narrowtext
%\section{Introduction}
The second law has been formulated in a number of
different ways \cite{TER91}: According to Clausius' postulate heat cannot flow 
spontaneously
from a colder to a hotter system. Thomson's formulation reads: ``It is
impossible to construct a perpetuum mobile of the second kind.'' 
Such rules define, essentially, some sort of irreversibility, i.e. the 
existence of a state
function usually called entropy, $S$, which can only increase in closed systems.\\
The second law is arguably one of the most fundamental
and far-reaching laws of physics; nevertheless its origin remains 
puzzling.\\
On the macroscopic level the second law enables us to calculate state
equations from the requirement that entropy has to be maximized under the
condition of given extensive variables in order to get a thermodynamical
potential as a function of those.\\
%On the macroscopic level the second law might be considered a
%constraint for control under incomplete information: Means for determining the
%evolution of a given system cannot
%increase spontaneously, i.e. without further information \cite{SCH98}.\\ 
On the microscopic level irreversibility comes in conflict with the
notorious reversibility of all fundamental physical laws. It has been the
challenge for statistical mechanics to reconcile $dS/dt \ge 0 $ with the 
underlying
microscopic dynamics.\\
Irreversibility in classical mechanics is conventionally introduced via 
two different schemes (cf. \cite{NEU30}): The Boltzmann approach, based on the 
hypothesis of 
molecular chaos ({\em Stosszahlansatz}) and the Gibbs ensemble approach, 
based on 
the hypothesis of quasi-ergodicity. Both these attempts have to acknowledge some additional
assumptions which do not follow from the underlying microscopic laws. \\
This fact has led to continuing controversies as to whether this situation 
can be the last word. Several researchers suggested quantum mechanics as a
possible remedy.\\
L. D. Landau and E. M. Lifshitz \cite{LAN78} expected that quantum 
measurements -- making a difference between future and past -- should be
responsible for the entropy increase according to the second law. 
This assertion has never been proved, though.\\
E. Schr\"odinger \cite{SCH89} argued that the conventional canonical distributions of
thermodynamics can be obtained also for a system 
described by a single wavefunction, if one invokes 
``the old crux of molecular disorder''.\\
J. von  Neumann \cite{NEU30} was able to show that a non-degenerate system should,
indeed, obey a quantum-mechanical version of ergodicity under fairly weak
conditions. In addition he felt obliged to introduce ``macroscopic observers''
(coarse graining) in order to come into contact with standard thermodynamics.\\
This latter aspect has then been taken up also by W. Pauli and M. Fierz
\cite{PAU37}. These authors insisted that the 2nd law should be explained without
reference to external perturbations like those induced by quantum 
measurements.\\ 
G. Lindblad \cite{LIN83} observed that the entropy of a multi-partite system 
defined as the 
sum of the respective partial entropies of the subsystems would tend to 
increase due to the neglect of 
correlations (entanglement). This fact could be taken as a quantum mechanical
justification of Boltzmann's {\em Stosszahlansatz}.\\  
W. Zurek \cite{ZUR91} and his coworkes have discussed in great detail how the
interaction of a quantum system with its environment may induce quasi-classical
behavior in the former (``environment-induced superselection rules''). 
They argued that the second law should eventually result from the impossibility
of isolating macroscopic systems from their environment \cite{ZUR94}.\\
Many of these ideas are pertinent to our present investigation.
It is the purpose of this Letter to show that under (appropriately
redefined) microcanonical conditions the
second law of thermodynamics follows from a quantum mechanical analysis of the 
total system partitioned into the object and the 
environment.\\
%\section{Approach to a derivation of the second Law}
%\subsection{Purity measures and their evolutions}
%\label{mase}
A purity measure that is formulated within standard quantum mechanics but
has also an interpretation within thermodynamics is the
von Neumann-entropy
\be
S(\hat{\rho}):=-k\mbox{Tr}\lk\hat{\rho}\ln \hat{\rho}\rk.
\ee
If this entropy is zero, the system is in a pure state, if it takes on its
maximum value $S_{max}=k\ln(N)$, where $N$ is the system size (number of
accessible states), the system is in
the maximally mixed state.
Another measure is the ``purity'' $P$:
\be
P(\hat{\rho}):=\mbox{Tr}\lk\hat{\rho}^2\rk.
\ee
If $P$ takes on its maximum value $1$ the system is in a pure state, if
$P$ takes on its minimum value $\frac{1}{N}$ the system is in the
maximally mixed state.\\
 For those extreme cases the two measures uniquely map onto each other. For
 general cases, however, this does not hold true anymore. Nevertheless, states with
$P(\hat{\rho})\approx 1$ will have $S(\hat{\rho})\approx 0$ and states with
$P(\hat{\rho})\approx P_{min}$ will have $S(\hat{\rho})\approx S_{max}$. In
the following  we mainly consider $P$ and get back to $S$ in the end.\\
Using the von Neumann-equation for the density operator of the total
system it can easily be shown that the entropy and the purity of a closed system that does not
interact with any other system are conserved.\\
This fact might be considered a contradiction to the second law which
demands that entropy should be maximized during the evolution of a closed
system.\\
If the full system is being
regarded as divided into two subsystems (I and II), the reduced density
operators are:
\be
\hat{\rho}_I=\mbox{Tr}_{II}\lk\hat{\rho}\rk,\quad
\hat{\rho}_{II}=\mbox{Tr}_I\lk\hat{\rho}\rk
\ee
Entropy and purity may be defined for each subsystem as before, using
$\hat{\rho}_I\left(\hat{\rho}_{II}\right)$ instead of $\hat{\rho}$.\\
Since those are not the density operators that appear in the
von Neumann-equation, $S_I\left(S_{II}\right)$ and $P_I\left(P_{II}\right)$ defined on basis of these operators
are no longer conserved. Those are the quantities we are going to examine.\\
%\subsection{Gas in container}
Although the following ideas apply to all sorts of subsystems, we want
to refer to the system of which the entropy is to be calculated as the
``gas-system'', g, and all the surrounding as the ``container-system'', c.\\
The full Hamiltonian is now divided according to
the same scheme:
\be 
\hat{H}=:\hat{L}_g+\hat{L}_c+\hat{W}
\ee
$\hat{L}_g$ describes the energies arising from the gas particles alone, including
their mutual interactions. $\hat{L}_c$ describes the corresponding energies
of the container particles
alone. $\hat{W}$ describes the interaction terms that depend on both, the coordinates of gas
particles and the container particles. These are here basically the ``wall''
interactions that keep the gas particles inside the container.\\
The energy eigenstates of a free gas are unbound and continuous. It is far more convenient to have
bound states for the ``separate'' systems. Thus we modify the Hamiltonian formally
in the following way:
\be 
\hat{H}=:\hat{L}_g'+\hat{L}_c+\hat{W}'
\ee
with
\be
\hat{L}_g':=\hat{L}_g+\hat{V} \quad \mbox{and} \quad \hat{W}':=\hat{W}-\hat{V}
\ee
where $\hat{V}$ models the mean effect of the container on the gas
particles. $\hat{V}$ is an effective potential that only depends on the
coordinates of the gas particles and is chosen to minimize $\hat{W}'$. Usually the container is
simply modelled by some ``box'' potential $\hat{V}$, neglecting $\hat{W}'$
altogether. But however small, starting from first principles $\hat{W}'$
will always be present, and represents a coupling.\\
%\subsection{Microcanonical conditions and constraints in Hilbert-space}
%\label{micro}
We consider the gas-system to be closed in the thermodynamical sense,
i. e., controlled by microcanonical conditions ($E,V,N=const.$); this is
clearly an idealization but can routinely be realized in an approximate
way.\\
A system that is closed on the macroscopic level (thermodynamically
closed) does not need to be closed on the microscopic (quantum-) level
(i. e. not
interacting with any other system).\\
The fact that no extensive quantities are to be exchanged, however, puts constraints on its Hamiltonian, especially on the interactions a system can
have with its surrounding, in order for it to be thermodynamically
closed.\\
The strict conservation of particles $N$ is taken into account simply by
the way the system is partitioned. To which accuracy the volume $V$ stays fixed
is set by $\hat{L}_c$. Microcanonical conditions then correspond to a box with very high, in the limit of the
volume $V$ being exactly conserved, infinitely high potential walls.\\
The condition that no energy is to be exchanged further constrains the
Hamiltonian. The energy contained in the gas is given by:
\be
E_g:=\<\hat{L}_g'\>.
\ee
If this is to be conserved, it follows that
\be
\label{kommu}
\lb\hat{L}_g',\hat{H}\rb=0 \quad \lb\hat{L}_g',\hat{W}'\rb=0.
\ee
Except for these constraints we need not specify $\hat{W}'$ in more detail.\\
Based on these commutator relations we find that for any energy eigenspace $A,B$
\be
\label{constr}
\sum_{i,j}|\psi_{ij}^{AB}(t)|^2=\sum_{i,j}|\psi_{ij}^{AB}(0)|^2
\ee
is a conserved quantity, set by the initial state, where $\psi_{ij}^{AB}$
denotes the amplitudes of the degenerate product energy eigenstates of
$\hat{L}_g'+\hat{L}_c$ (``$i$'' denoting the gas, ``$j$'' the container
part of the product) that are associated with the energy eigenvalues $E_A^g\left(E_B^c\right)$ in the gas-(container-)
system.\\
Since we want to consider cases here that have zero local entropy in the
beginning (product states), we get
\be
\sum_{i,j}|\psi_{ij}^{AB}(0)|^2=\sum_{i,j}|\psi_i^A(0)|^2|\psi_j^B(0)|^2=P_A^gP_B^c
\ee
where $P_A^g\left(P_B^c\right)$ are the
probabilities of finding the gas-(container-) sytem somewhere in the possibly highly
degenerate subspace characterized by the energy
eigenvalues $E_A^g\left(E_B^c\right)$. If no energy is to be exchanged,
clearly these probabilities have to remain conserved. This is the constraint that
microcanonical conditions impose on the accessible region of Hilbert-space.\\
%\subsection{Trajectories in Hilbert-space}
Although we are interested in $P(t\rightarrow \infty)$, we start by
considering the time average of the purity $P$ for reasons that will become
clear later.
\be
\label{taver}
\overline{P}:=\frac{1}{T}\int_0^T P(|\psi(t)\>)dt
\ee
Choosing a special parametrization for $|\psi\>$, we can convert the time
integral into an integral over the trajectory generated by the total
system's dynamics for given initial conditions. Parametrizing $|\psi\>$ in terms of the real and imaginary parts of
its amplitudes
\be
|\psi(t)\>:=\lk \psi_{ij}(t),\psi'_{ij}(t)\rk
\ee
we can write instead of (\ref{taver})
\be
\label{killer}
\overline{P}=\frac{\int_{|\psi(0)\>}^{|\psi(T)\>}P\left(\lk
  \psi_{ij},\psi'_{ij}\rk\right)\frac{1}{v_{eff}} |d|\psi\>|}{\int_{|\psi(0)\>}^{|\psi(T)\>}\frac{1}{v_{eff}}|d|\psi\>|}
\ee
where $|d|\psi\>|$ denotes the ``length'' of an infinitesimal step along the
trajectory in Hilbert-space.\\
The advantage of this special
parametrization derives from the fact that the effective velocity
\be
v^2_{eff}=\sum_{i,j}\left(\dot{\psi_{ij}}^2+\dot{\psi'_{ij}}^2\right)=\frac{1}{\hbar^2}\<\psi (0)|\hat{H}^2|\psi (0)\>
\ee
is constant on each trajectory and thus independent of the
time $t$ or the special point on the trajectory. Hence, the integral
  (\ref{killer}) simplifies to
\be
\overline{P}=\frac{1}{L}\int_{|\psi(0)\>}^{|\psi(T)\>}P\left(\lk
  \psi_{ij},\psi'_{ij}\rk\right)|d|\psi\>|
\ee
where $L$ is the length of the path. So, the time average of $P$ equals the path average along a special
  trajectory in this parametrization of Hilbert-space.\\ 
We are not able to compute this
  integral for we do not know $\hat{W}'$ in detail, and even if we did, we could never hope to solve the Schr\"odinger-equation for a
  system with about $10^{23}$ degrees of freedom.\\
All we want to prove here, is that for typical trajectories staying within the region allowed by the microcanonical
  conditions, $P$ is extremely close to its minimum value for almost all points within this region.\\
%\subsection{The flatness of $P$ in Hilbert-space}
We proceed as follows:\\
First we calculate $P_{min}$ which is the smallest possible value
of $P$ within the allowed region. Then we compute the average of $P$
over the total allowed region. If this average is close to $P_{min}$, we
can conclude that $P\approx P_{min}$ for almost all points within this
region, which means for almost all $P(t)$, since any distribution with a mean value close to a boundary has to
be sharply peaked.\\
From (\ref{kommu}) it follows that the $P_A^g$ remain conserved. Now the
lowest purity $P$ of any state consistent with this conditon is:
\be
\label{pmin}
P_{min}=\sum_A\frac{(P_A^g)^2}{N_A^g}
\ee
where $N_A^g$ is the degree of degeneracy of $E_A^g$.\\
To calculate the Hilbert-space average of $P$ denoted as $<P>$ we
need a parametrization for $\psi_{ij},{\psi'}_{ij}$ confined to the allowed
region (\ref{constr}) that essentially consists of hyperspheres in different parts of the
Hilbert-space of the total system. The Hilbert-space average can then be written as
\be
<P>=\frac{\int P\left(\lk\psi_{ij}(\lk\phi_n\rk),{\psi'}_{ij}(\lk\phi_n\rk)\rk\right)\det{\mathcal F}\prod_n d\phi_n}{\int\det{\mathcal F}\prod_n d\phi_n}
\ee
where $\phi_n$ is the respective set of parameters and ${\mathcal F}$ is the corresponding
functional matrix.\\
This integral can actually be solved analytically. The  techniques are
essentially the same as those used to calculate surface areas of
hyperspheres in the classical statistical analysis of the ideal gas. Since this calculation is rather elaborate we do not want to present it in detail here, but give
  and discuss the result:
\ba
\label{exact}
&&<P>=\\
&&\sum_A\frac{(P_A^g)^2}{N_A^g}\left(1-\sum_B(P_B^c)^2\right)+\sum_B\frac{(P_B^c)^2}{N_B^c}\left(1-\sum_A(P_A^g)^2\right)\n\\
&&+\sum_{A,B}\frac{(P_A^g)^2(P_B^c)^2(N_A^g+N_B^c)}{N_A^gN_B^c+1}\n
\ea
Here $N_B^g$ is the degree of degeneracy of the energy eigenvalue
  $E_B^g$.\\
If the degeneracy of the occupied energy levels is large
enough so that
\be
\frac{1}{N_A^gN_B^c+1}\approx\frac{1}{N_A^cN_B^c}
\ee
which should hold true for typical thermodynamical systems,
(\ref{exact}) reduces to
\be
<P>\approx\sum_A\frac{(P_A^g)^2}{N_A^g}+\sum_B\frac{(P_B^c)^2}{N_B^c}
\ee
The first sum in this expression is obviously exactly $P_{min}$
(\ref{pmin}), so that for systems and initial conditions in which the
second sum is small the allowed region almost only consists of states for
which $P\approx P_{min}$. The second sum will be small if the container
system occupies highly degenerate states, typical for thermodynamical systems.\\
To illustrate this result, we have plotted the relative frequency of $P$
(see Fig 1.), which
we calculated using a formula by Lloyd, Pagels \cite{LLO88} and
Page \cite{PAG93}, that
applies to completely degenerate subsystems only. In this case we find from (\ref{exact})
\be
<P>=\frac{N^g+N^c}{N^gN^c+1}
\ee
(For this special case the average has
also been calculated by Lubkin \cite{LUB78}.)\\
\begin{figure}[!h]
\centering
\psfrag{x}[][]{$P$}
\psfrag{y}[][l]{$P_P$}
\psfrag{p1}[][]{2x2}
\psfrag{p2}[][]{2x4}
\psfrag{p3}[][]{2x8}
\psfrag{0}[][cb]{0}
\psfrag{0.25}[][cb]{}
\psfrag{0.5}[][cb]{$\frac{1}{n_1}$}
\psfrag{0.75}[][cb]{}
\psfrag{1.}[][cb]{1}
\includegraphics[width=6.5cm]{PurityDistribution.eps}
\vspace{5mm}
\caption{Probability density as a function of $P=\mbox{Tr} \{
  {\hat{\rho}_I}^2 \}$ for
various $n_1$x$n_2$ systems. With increasing size of subsystem II the
density becomes peaked near the value $\frac{1}{n_1}$.}
\label{puritydist}
\end{figure}
Obviously our average $<P>$ is in perfect agreement with the more detailed
distribution of $P$.\\
%\subsection{Ergodicity?}
So far we have only shown that, except for negligible parts, the Hilbert-space-section in which the trajectories can be found under microcanonical
conditions, has $P\approx P_{min}$, provided the surrounding system is much larger than
the considered system.\\
To examine under what conditions trajectories will even
``fill'' the whole space they can possibly live in, we consider the special
case of no degeneracy in either subsystem. Here  the evolution
of $P$ can be calculated exactly:
\be
\label{deco}
P(t)=\sum_{A,B,C,D}e^{\left(\frac{1}{i\hbar}\left(E_{AB}-E_{CB}+E_{CD}-E_{AD}\right)t\right)}P_A^gP_B^cP_C^gP_D^c
\ee
where $E_{IJ}$ are the energy eigenvalues of the respective energy
eigenstates. Note that without any interaction $E_{IJ}=E_I+E_J$ and
$P(t)=const.$, as expected.\\ 
Assuming that all terms in (\ref{deco}) are oscillating except the ones
with $A=C$ or $B=D$, we get
\be
\overline{P}=\sum_A(P_A^g)^2+\sum_B(P_B^c)^2-\left(\sum_A(P_A^g)^2\right)\left(\sum_B(P_B^c)^2\right)
\ee
which is exactly the same result as (\ref{exact}) with $N_A^g=N_B^c=1$. So, under this assumption the Hilbert-space average is exactly equal
to the time average.\\
In general, however, this specific ergodicity is not needed: It suffices
that typical quantum trajectories, even though starting with $P(0)=1$,
venture out into the vast Hilbert-space regions characterized by
$P=P_{min}$. Of course, one cannot exclude that in special situations there might be
trajectories that never leave the very tiny region with $P\approx 1$, but
these situations become extremely rare as the surrounding gets big.\\
%\subsection{Purity and entropy}
Finally, we return to the local entropy $S$. Trying to compute $<S>$ rather than $<P>$ we get, after some lengthy but
straightforward perturbative calculations 
\be
\label{ende}
<S>\approx S_{max}\left(\lk P_A^g,N_A^g\rk
\right)-K\left(\sum_B\frac{(P_B^c)^2}{N_B^c}\right)
\ee
where $K$ is a
 positive function that scales linearly with the system size of the gas
 system. (\ref{ende}) is valid for situations with
\be
\sum_A\frac{(P_A^g)^2}{N_A^g}\gg\sum_B\frac{(P_B^c)^2}{N_B^c},
\ee
which is the thermodynamical regime in which the second term in
(\ref{ende}) will be small.
(Again, for the special case of both subsystems being completely
 degenerate, our results are in perfect agreement with a result by S. Sen \cite{SEN96})\\
%\section{Summary and conclusion}
In conclusion we have shown that the local von Neumann-entropy of a
considered system will be maximized during its evolution, even if the
system is thermodynamically closed, provided the energy
eigenspaces occupied by the surrounding are much bigger than the energy
eigenspaces occupied by the considered system. This is typical for
thermodynamical systems. We did not need the additional assumptions
underlying classical derivations. Since we considered microcanonical conditions we
get the maximum entropy as an explicit function of  the initial energy distribution. This allows for a connection with standard thermodynamics,
entropy being a thermodynamical potential.\\
Generalizations to canonical conditions and the treatment of quantum
computer systems as specific open systems are under way.\\
We thank Dr. I.~Kim, M.~Stollsteimer, Dipl. Phys. F.~Tonner and T.~Wahl for
fruitful discussions. One of us (A.O.) acknowledeges financial support by
the Deutsche Forschungsgemeinschaft.
\begin{thebibliography}{9}
\addcontentsline{toc}{chapter}{Literaturverzeichnis}

\bibitem{TER91} Ya.~P.~Terlitskii, {\em Statistical Physics} (North Holland Publ., Amsterdam, 1991)

\bibitem{SCH89} F.~Schl\"ogl, {\em Probability and Heat} (Vieweg, Braunschweig, 1998)

\bibitem{NEU30} J.~v.~Neumann, 
 Zeitschr. f. Physik {\bf 57}, 30 (1930).


\bibitem{LAN78}L.~Landau, M.~Lifshitz, {\em Statistical Mechanics} (Pergamon
  Press, Oxford, 1978); {\em Quantum Mechanics} (Pergamon Press, Oxford, 1977)


\bibitem{SCH89} E.~Schr\"odinger, {\em Statistical Thermodynamics} (Dover Publ.,
  New York, 1989).

\bibitem{PAU37} W.~Pauli, M.~Fierz,
 Zeitschr. f. Physik {\bf 106}, 572 (1937).

\bibitem{LIN83} G.~Lindblad, {\em Non-equilibrium Entropy and Irreversibility}
  (D. Reidel Publ. Comp., Dordrecht 1983)
 
\bibitem{ZUR91} W.~Zurek,
 Phys. Today {\bf 44}, No.10, 36 (1991);
 Phys. Today {\bf 46}, No.12, 81 (1993).

\bibitem{ZUR94} W.~Zurek, J.~ Paz,
 Phys.~Rev~Lett. {\bf 72}, 2508 (1994).

\bibitem{LLO88} S.~Lloyd, H.~Pagels, Ann.Phys. (N.Y.)
{\bf 188}, 186 (1988).

\bibitem{PAG93} Don N. Page,
 Phys.~Rev.~Lett. {\bf 71}, 1291 (1993).

\bibitem{LUB78} E.~Lubkin,
Math. Phys. {\bf 19}, 1028 (1978).


\bibitem{SEN96} S.~Sen,
 Phys.~Rev.~Lett. {\bf 77}, 1 (1996).



\end{thebibliography}

\end{document}
psfig.tex
% Psfig/TeX 
\def\PsfigVersion{1.10}
\def\setDriver{\DvipsDriver} % \DvipsDriver or \OzTeXDriver
%
% All software, documentation, and related files in this distribution of
% psfig/tex are Copyright 1993 Trevor J. Darrell
%
% Permission is granted for use and non-profit distribution of psfig/tex 
% providing that this notice is clearly maintained. The right to
% distribute any portion of psfig/tex for profit or as part of any commercial
% product is specifically reserved for the author(s) of that portion.
%
% To use with LaTeX, use \documentstyle[psfig,...]{...}
% To use with TeX, use \input psfig.sty
%
% Bugs and improvements to trevor@media.mit.edu.
%
% Thanks to Ned Batchelder, Greg Hager (GDH), J. Daniel Smith (JDS),
% Tom Rokicki (TR), Robert Russell (RR), George V. Reilly (GVR),
% Ken McGlothlen (KHC), Baron Grey (BG), Gerhard Tobermann (GT).
% and all others who have contributed code and comments to this project!
%
% ======================================================================
% Modification History:
%
%  9 Oct 1990   JDS	used more robust bbox reading code from Tom Rokicki
% 29 Mar 1991   JDS	implemented rotation= option
% 25 Jun 1991   RR	if bb specified on cmd line don't check
%			for .ps file.
%  3 Jul 1991	JDS	check if file already read in once
%  4 Sep 1991	JDS	fixed incorrect computation of rotated
%			bounding box
% 25 Sep 1991	GVR	expanded synopsis of \psfig
% 14 Oct 1991	JDS	\fbox code from LaTeX so \psdraft works with TeX
%			changed \typeout to \ps@typeout
% 17 Oct 1991	JDS	added \psscalefirst and \psrotatefirst
% 23 Jun 1993   KHC     ``doclip'' must appear before ``rotate''
% 27 Oct 1993   TJD	removed printing of filename to avoid 
%			underscore problems. changed \frame to \fbox.
%			Added OzTeX support from BG. Added new
%			figure search path code from GT.
%
% ======================================================================
%
% Command synopsis:
%
% \psdraft	draws an outline box, but doesn't include the figure
%		in the DVI file.  Useful for previewing.
%
% \psfull	includes the figure in the DVI file (default).
%
% \psscalefirst width= or height= specifies the size of the figure
% 		before rotation.
% \psrotatefirst (default) width= or height= specifies the size of the
% 		 figure after rotation.  Asymetric figures will
% 		 appear to shrink.
%
% \psfigurepath{dir:dir:...}  sets the path to search for the figure
%
% \psfig
% usage: \psfig{file=, figure=, height=, width=,
%			bbllx=, bblly=, bburx=, bbury=,
%			rheight=, rwidth=, clip=, angle=, silent=}
%
%	"file" is the filename.  If no path name is specified and the
%		file is not found in the current directory,
%		it will be looked for in directory \psfigurepath.
%	"figure" is a synonym for "file".
%	By default, the width and height of the figure are taken from
%		the BoundingBox of the figure.
%	If "width" is specified, the figure is scaled so that it has
%		the specified width.  Its height changes proportionately.
%	If "height" is specified, the figure is scaled so that it has
%		the specified height.  Its width changes proportionately.
%	If both "width" and "height" are specified, the figure is scaled
%		anamorphically.
%	"bbllx", "bblly", "bburx", and "bbury" control the PostScript
%		BoundingBox.  If these four values are specified
%               *before* the "file" option, the PSFIG will not try to
%               open the PostScript file.
%	"rheight" and "rwidth" are the reserved height and width
%		of the figure, i.e., how big TeX actually thinks
%		the figure is.  They default to "width" and "height".
%	The "clip" option ensures that no portion of the figure will
%		appear outside its BoundingBox.  "clip=" is a switch and
%		takes no value, but the `=' must be present.
%	The "angle" option specifies the angle of rotation (degrees, ccw).
%	The "silent" option makes \psfig work silently.
%
% ======================================================================
% check to see if macros already loaded in (maybe some other file says
% "\input psfig") ...
\ifx\undefined\psfig\else\endinput\fi
%
% from a suggestion by eijkhout@csrd.uiuc.edu to allow
% loading as a style file. Changed to avoid problems
% with amstex per suggestion by jbence@math.ucla.edu

\let\LaTeXAtSign=\@
\let\@=\relax
\edef\psfigRestoreAt{\catcode`\@=\number\catcode`@\relax}
%\edef\psfigRestoreAt{\catcode`@=\number\catcode`@\relax}
\catcode`\@=11\relax
\newwrite\@unused
\def\ps@typeout#1{{\let\protect\string\immediate\write\@unused{#1}}}

\def\DvipsDriver{
	\ps@typeout{psfig/tex \PsfigVersion -dvips}
\def\PsfigSpecials{\DvipsSpecials} 	\def\ps@dir{/}
\def\ps@predir{} }
\def\OzTeXDriver{
	\ps@typeout{psfig/tex \PsfigVersion -oztex}
	\def\PsfigSpecials{\OzTeXSpecials}
	\def\ps@dir{:}
	\def\ps@predir{:}
	\catcode`\^^J=5
}

%% Here's how you define your figure path.  Should be set up with null
%% default and a user useable definition.

\def\figurepath{./:}
\def\psfigurepath#1{\edef\figurepath{#1:}}

%%% inserted for Searching Unixpaths
%%% (the path must end with :)
%%% (call: \DoPaths\figurepath )
%%%------------------------------------------------------
\def\DoPaths#1{\expandafter\EachPath#1\stoplist}
%
\def\leer{}
\def\EachPath#1:#2\stoplist{% #1 part of the list (delimiter :)
  \ExistsFile{#1}{\SearchedFile}
  \ifx#2\leer
  \else
    \expandafter\EachPath#2\stoplist
  \fi}
%
% exists the file (does not work for directories!)
%
\def\ps@dir{/}
\def\ExistsFile#1#2{%
   \openin1=\ps@predir#1\ps@dir#2
   \ifeof1
       \closein1
       %\ps@typeout{...not: \ps@predir#1\ps@dir#2}
   \else
       \closein1
       %\ps@typeout{...in:  \ps@predir#1\ps@dir#2}
        \ifx\ps@founddir\leer
          %\ps@typeout{set founddir #1}
           \edef\ps@founddir{#1}
        \fi
   \fi}
%------------------------------------------------------
%
% Get dir in path or error
%
\def\get@dir#1{%
  \def\ps@founddir{}
  \def\SearchedFile{#1}
  \DoPaths\figurepath
%  \fi
}
%------------------------------------------------------
%%% END of Searching Unixpaths


%
% @psdo control structure -- similar to Latex @for.
% I redefined these with different names so that psfig can
% be used with TeX as well as LaTeX, and so that it will not 
% be vunerable to future changes in LaTeX's internal
% control structure,
%
\def\@nnil{\@nil}
\def\@empty{}
\def\@psdonoop#1\@@#2#3{}
\def\@psdo#1:=#2\do#3{\edef\@psdotmp{#2}\ifx\@psdotmp\@empty \else
    \expandafter\@psdoloop#2,\@nil,\@nil\@@#1{#3}\fi}
\def\@psdoloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else
       #5\def#4{#2}\ifx #4\@nnil \else#5\@ipsdoloop #3\@@#4{#5}\fi\fi}
\def\@ipsdoloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil 
       \let\@nextwhile=\@psdonoop \else
      #4\relax\let\@nextwhile=\@ipsdoloop\fi\@nextwhile#2\@@#3{#4}}
\def\@tpsdo#1:=#2\do#3{\xdef\@psdotmp{#2}\ifx\@psdotmp\@empty \else
    \@tpsdoloop#2\@nil\@nil\@@#1{#3}\fi}
\def\@tpsdoloop#1#2\@@#3#4{\def#3{#1}\ifx #3\@nnil 
       \let\@nextwhile=\@psdonoop \else
      #4\relax\let\@nextwhile=\@tpsdoloop\fi\@nextwhile#2\@@#3{#4}}
% 
% \fbox is defined in latex.tex; so if \fbox is undefined, assume that
% we are not in LaTeX.
% Perhaps this could be done better???
\ifx\undefined\fbox
% \fbox code from modified slightly from LaTeX
\newdimen\fboxrule
\newdimen\fboxsep
\newdimen\ps@tempdima
\newbox\ps@tempboxa
\fboxsep = 3pt
\fboxrule = .4pt
\long\def\fbox#1{\leavevmode\setbox\ps@tempboxa\hbox{#1}\ps@tempdima\fboxrule
    \advance\ps@tempdima \fboxsep \advance\ps@tempdima \dp\ps@tempboxa
   \hbox{\lower \ps@tempdima\hbox
  {\vbox{\hrule height \fboxrule
          \hbox{\vrule width \fboxrule \hskip\fboxsep
          \vbox{\vskip\fboxsep \box\ps@tempboxa\vskip\fboxsep}\hskip 
                 \fboxsep\vrule width \fboxrule}
                 \hrule height \fboxrule}}}}
\fi
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% file reading stuff from epsf.tex
%   EPSF.TEX macro file:
%   Written by Tomas Rokicki of Radical Eye Software, 29 Mar 1989.
%   Revised by Don Knuth, 3 Jan 1990.
%   Revised by Tomas Rokicki to accept bounding boxes with no
%      space after the colon, 18 Jul 1990.
%   Portions modified/removed for use in PSFIG package by
%      J. Daniel Smith, 9 October 1990.
%
\newread\ps@stream
\newif\ifnot@eof       % continue looking for the bounding box?
\newif\if@noisy        % report what you're making?
\newif\if@atend        % %%BoundingBox: has (at end) specification
\newif\if@psfile       % does this look like a PostScript file?
%
% PostScript files should start with `%!'
%
{\catcode`\%=12\global\gdef\epsf@start{%!}}
\def\epsf@PS{PS}
%
\def\epsf@getbb#1{%
%
%   The first thing we need to do is to open the
%   PostScript file, if possible.
%
\openin\ps@stream=\ps@predir#1
\ifeof\ps@stream\ps@typeout{Error, File #1 not found}\else
%
%   Okay, we got it. Now we'll scan lines until we find one that doesn't
%   start with %. We're looking for the bounding box comment.
%
   {\not@eoftrue \chardef\other=12
    \def\do##1{\catcode`##1=\other}\dospecials \catcode`\ =10
    \loop
       \if@psfile
	  \read\ps@stream to \epsf@fileline
       \else{
	  \obeyspaces
          \read\ps@stream to \epsf@tmp\global\let\epsf@fileline\epsf@tmp}
       \fi
       \ifeof\ps@stream\not@eoffalse\else
%
%   Check the first line for `%!'.  Issue a warning message if its not
%   there, since the file might not be a PostScript file.
%
       \if@psfile\else
       \expandafter\epsf@test\epsf@fileline:. \\%
       \fi
%
%   We check to see if the first character is a % sign;
%   if so, we look further and stop only if the line begins with
%   `%%BoundingBox:' and the `(atend)' specification was not found.
%   That is, the only way to stop is when the end of file is reached,
%   or a `%%BoundingBox: llx lly urx ury' line is found.
%
          \expandafter\epsf@aux\epsf@fileline:. \\%
       \fi
   \ifnot@eof\repeat
   }\closein\ps@stream\fi}%
%
% This tests if the file we are reading looks like a PostScript file.
%
\long\def\epsf@test#1#2#3:#4\\{\def\epsf@testit{#1#2}
			\ifx\epsf@testit\epsf@start\else
\ps@typeout{Warning! File does not start with `\epsf@start'.  It may not be a PostScript file.}
			\fi
			\@psfiletrue} % don't test after 1st line
%
%   We still need to define the tricky \epsf@aux macro. This requires
%   a couple of magic constants for comparison purposes.
%
{\catcode`\%=12\global\let\epsf@percent=%\global\def\epsf@bblit{%BoundingBox}}
%
%
%   So we're ready to check for `%BoundingBox:' and to grab the
%   values if they are found.  We continue searching if `(at end)'
%   was found after the `%BoundingBox:'.
%
\long\def\epsf@aux#1#2:#3\\{\ifx#1\epsf@percent
   \def\epsf@testit{#2}\ifx\epsf@testit\epsf@bblit
	\@atendfalse
        \epsf@atend #3 . \\%
	\if@atend	
	   \if@verbose{
		\ps@typeout{psfig: found `(atend)'; continuing search}
	   }\fi
        \else
        \epsf@grab #3 . . . \\%
        \not@eoffalse
        \global\no@bbfalse
        \fi
   \fi\fi}%
%
%   Here we grab the values and stuff them in the appropriate definitions.
%
\def\epsf@grab #1 #2 #3 #4 #5\\{%
   \global\def\epsf@llx{#1}\ifx\epsf@llx\empty
      \epsf@grab #2 #3 #4 #5 .\\\else
   \global\def\epsf@lly{#2}%
   \global\def\epsf@urx{#3}\global\def\epsf@ury{#4}\fi}%
%
% Determine if the stuff following the %%BoundingBox is `(atend)'
% J. Daniel Smith.  Copied from \epsf@grab above.
%
\def\epsf@atendlit{(atend)} 
\def\epsf@atend #1 #2 #3\\{%
   \def\epsf@tmp{#1}\ifx\epsf@tmp\empty
      \epsf@atend #2 #3 .\\\else
   \ifx\epsf@tmp\epsf@atendlit\@atendtrue\fi\fi}


% End of file reading stuff from epsf.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% trigonometry stuff from "trig.tex"
\chardef\psletter = 11 % won't conflict with \begin{letter} now...
\chardef\other = 12

\newif \ifdebug %%% turn me on to see TeX hard at work ...
\newif\ifc@mpute %%% don't need to compute some values
\c@mputetrue % but assume that we do

\let\then = \relax
\def\r@dian{pt }
\let\r@dians = \r@dian
\let\dimensionless@nit = \r@dian
\let\dimensionless@nits = \dimensionless@nit
\def\internal@nit{sp }
\let\internal@nits = \internal@nit
\newif\ifstillc@nverging
\def \Mess@ge #1{\ifdebug \then \message {#1} \fi}

{ %%% Things that need abnormal catcodes %%%
	\catcode `\@ = \psletter
	\gdef \nodimen {\expandafter \n@dimen \the \dimen}
	\gdef \term #1 #2 #3%
	       {\edef \t@ {\the #1}%%% freeze parameter 1 (count, by value)
		\edef \t@@ {\expandafter \n@dimen \the #2\r@dian}%
				   %%% freeze parameter 2 (dimen, by value)
		\t@rm {\t@} {\t@@} {#3}%
	       }
	\gdef \t@rm #1 #2 #3%
	       {{%
		\count 0 = 0
		\dimen 0 = 1 \dimensionless@nit
		\dimen 2 = #2\relax
		\Mess@ge {Calculating term #1 of \nodimen 2}%
		\loop
		\ifnum	\count 0 < #1
		\then	\advance \count 0 by 1
			\Mess@ge {Iteration \the \count 0 \space}%
			\Multiply \dimen 0 by {\dimen 2}%
			\Mess@ge {After multiplication, term = \nodimen 0}%
			\Divide \dimen 0 by {\count 0}%
			\Mess@ge {After division, term = \nodimen 0}%
		\repeat
		\Mess@ge {Final value for term #1 of 
				\nodimen 2 \space is \nodimen 0}%
		\xdef \Term {#3 = \nodimen 0 \r@dians}%
		\aftergroup \Term
	       }}
	\catcode `\p = \other
	\catcode `\t = \other
	\gdef \n@dimen #1pt{#1} %%% throw away the ``pt''
}

\def \Divide #1by #2{\divide #1 by #2} %%% just a synonym

\def \Multiply #1by #2%%% allows division of a dimen by a dimen
       {{%%% should really freeze parameter 2 (dimen, passed by value)
	\count 0 = #1\relax
	\count 2 = #2\relax
	\count 4 = 65536
	\Mess@ge {Before scaling, count 0 = \the \count 0 \space and
			count 2 = \the \count 2}%
	\ifnum	\count 0 > 32767 %%% do our best to avoid overflow
	\then	\divide \count 0 by 4
		\divide \count 4 by 4
	\else	\ifnum	\count 0 < -32767
		\then	\divide \count 0 by 4
			\divide \count 4 by 4
		\else
		\fi
	\fi
	\ifnum	\count 2 > 32767 %%% while retaining reasonable accuracy
	\then	\divide \count 2 by 4
		\divide \count 4 by 4
	\else	\ifnum	\count 2 < -32767
		\then	\divide \count 2 by 4
			\divide \count 4 by 4
		\else
		\fi
	\fi
	\multiply \count 0 by \count 2
	\divide \count 0 by \count 4
	\xdef \product {#1 = \the \count 0 \internal@nits}%
	\aftergroup \product
       }}

\def\r@duce{\ifdim\dimen0 > 90\r@dian \then   % sin(x+90) = sin(180-x)
		\multiply\dimen0 by -1
		\advance\dimen0 by 180\r@dian
		\r@duce
	    \else \ifdim\dimen0 < -90\r@dian \then  % sin(-x) = sin(360+x)
		\advance\dimen0 by 360\r@dian
		\r@duce
		\fi
	    \fi}

\def\Sine#1%
       {{%
	\dimen 0 = #1 \r@dian
	\r@duce
	\ifdim\dimen0 = -90\r@dian \then
	   \dimen4 = -1\r@dian
	   \c@mputefalse
	\fi
	\ifdim\dimen0 = 90\r@dian \then
	   \dimen4 = 1\r@dian
	   \c@mputefalse
	\fi
	\ifdim\dimen0 = 0\r@dian \then
	   \dimen4 = 0\r@dian
	   \c@mputefalse
	\fi
%
	\ifc@mpute \then
        	% convert degrees to radians
		\divide\dimen0 by 180
		\dimen0=3.141592654\dimen0
%
		\dimen 2 = 3.1415926535897963\r@dian %%% a well-known constant
		\divide\dimen 2 by 2 %%% we only deal with -pi/2 : pi/2
		\Mess@ge {Sin: calculating Sin of \nodimen 0}%
		\count 0 = 1 %%% see power-series expansion for sine
		\dimen 2 = 1 \r@dian %%% ditto
		\dimen 4 = 0 \r@dian %%% ditto
		\loop
			\ifnum	\dimen 2 = 0 %%% then we've done
			\then	\stillc@nvergingfalse 
			\else	\stillc@nvergingtrue
			\fi
			\ifstillc@nverging %%% then calculate next term
			\then	\term {\count 0} {\dimen 0} {\dimen 2}%
				\advance \count 0 by 2
				\count 2 = \count 0
				\divide \count 2 by 2
				\ifodd	\count 2 %%% signs alternate
				\then	\advance \dimen 4 by \dimen 2
				\else	\advance \dimen 4 by -\dimen 2
				\fi
		\repeat
	\fi		
			\xdef \sine {\nodimen 4}%
       }}

% Now the Cosine can be calculated easily by calling \Sine
\def\Cosine#1{\ifx\sine\UnDefined\edef\Savesine{\relax}\else
		             \edef\Savesine{\sine}\fi
	{\dimen0=#1\r@dian\advance\dimen0 by 90\r@dian
	 \Sine{\nodimen 0}
	 \xdef\cosine{\sine}
	 \xdef\sine{\Savesine}}}	      
% end of trig stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\psdraft{
	\def\@psdraft{0}
	%\ps@typeout{draft level now is \@psdraft \space . }
}
\def\psfull{
	\def\@psdraft{100}
	%\ps@typeout{draft level now is \@psdraft \space . }
}

\psfull

\newif\if@scalefirst
\def\psscalefirst{\@scalefirsttrue}
\def\psrotatefirst{\@scalefirstfalse}
\psrotatefirst

\newif\if@draftbox
\def\psnodraftbox{
	\@draftboxfalse
}
\def\psdraftbox{
	\@draftboxtrue
}
\@draftboxtrue

\newif\if@prologfile
\newif\if@postlogfile
\def\pssilent{
	\@noisyfalse
}
\def\psnoisy{
	\@noisytrue
}
\psnoisy
%%% These are for the option list.
%%% A specification of the form a = b maps to calling \@p@@sa{b}
\newif\if@bbllx
\newif\if@bblly
\newif\if@bburx
\newif\if@bbury
\newif\if@height
\newif\if@width
\newif\if@rheight
\newif\if@rwidth
\newif\if@angle
\newif\if@clip
\newif\if@verbose
\def\@p@@sclip#1{\@cliptrue}
%
%
\newif\if@decmpr
%
\def\@p@@sfigure#1{\def\@p@sfile{null}\def\@p@sbbfile{null}\@decmprfalse
   % look directly for file (e.g. absolute path)
   \openin1=\ps@predir#1
   \ifeof1
	\closein1
	% failed, search directories for file
	\get@dir{#1}
	\ifx\ps@founddir\leer
		% failed, search directly for file.bb
		\openin1=\ps@predir#1.bb
		\ifeof1
			\closein1
			% failed, search directories for file.bb
			\get@dir{#1.bb}
			\ifx\ps@founddir\leer
				% failed, lose.
				\ps@typeout{Can't find #1 in \figurepath}
			\else
				% found file.bb in search dir
				\@decmprtrue
				\def\@p@sfile{\ps@founddir\ps@dir#1}
				\def\@p@sbbfile{\ps@founddir\ps@dir#1.bb}
			\fi
		\else
			\closein1
			%found file.bb directly
			\@decmprtrue
			\def\@p@sfile{#1}
			\def\@p@sbbfile{#1.bb}
		\fi
	\else
		% found file in search dir
		\def\@p@sfile{\ps@founddir\ps@dir#1}
		\def\@p@sbbfile{\ps@founddir\ps@dir#1}
	\fi
   \else
	% found file directly
	\closein1
	\def\@p@sfile{#1}
	\def\@p@sbbfile{#1}
   \fi
}
%
%
%
\def\@p@@sfile#1{\@p@@sfigure{#1}}
%
\def\@p@@sbbllx#1{
		%\ps@typeout{bbllx is #1}
		\@bbllxtrue
		\dimen100=#1
		\edef\@p@sbbllx{\number\dimen100}
}
\def\@p@@sbblly#1{
		%\ps@typeout{bblly is #1}
		\@bbllytrue
		\dimen100=#1
		\edef\@p@sbblly{\number\dimen100}
}
\def\@p@@sbburx#1{
		%\ps@typeout{bburx is #1}
		\@bburxtrue
		\dimen100=#1
		\edef\@p@sbburx{\number\dimen100}
}
\def\@p@@sbbury#1{
		%\ps@typeout{bbury is #1}
		\@bburytrue
		\dimen100=#1
		\edef\@p@sbbury{\number\dimen100}
}
\def\@p@@sheight#1{
		\@heighttrue
		\dimen100=#1
   		\edef\@p@sheight{\number\dimen100}
		%\ps@typeout{Height is \@p@sheight}
}
\def\@p@@swidth#1{
		%\ps@typeout{Width is #1}
		\@widthtrue
		\dimen100=#1
		\edef\@p@swidth{\number\dimen100}
}
\def\@p@@srheight#1{
		%\ps@typeout{Reserved height is #1}
		\@rheighttrue
		\dimen100=#1
		\edef\@p@srheight{\number\dimen100}
}
\def\@p@@srwidth#1{
		%\ps@typeout{Reserved width is #1}
		\@rwidthtrue
		\dimen100=#1
		\edef\@p@srwidth{\number\dimen100}
}
\def\@p@@sangle#1{
		%\ps@typeout{Rotation is #1}
		\@angletrue
%		\dimen100=#1
		\edef\@p@sangle{#1} %\number\dimen100}
}
\def\@p@@ssilent#1{ 
		\@verbosefalse
}
\def\@p@@sprolog#1{\@prologfiletrue\def\@prologfileval{#1}}
\def\@p@@spostlog#1{\@postlogfiletrue\def\@postlogfileval{#1}}
\def\@cs@name#1{\csname #1\endcsname}
\def\@setparms#1=#2,{\@cs@name{@p@@s#1}{#2}}
%
% initialize the defaults (size the size of the figure)
%
\def\ps@init@parms{
		\@bbllxfalse \@bbllyfalse
		\@bburxfalse \@bburyfalse
		\@heightfalse \@widthfalse
		\@rheightfalse \@rwidthfalse
		\def\@p@sbbllx{}\def\@p@sbblly{}
		\def\@p@sbburx{}\def\@p@sbbury{}
		\def\@p@sheight{}\def\@p@swidth{}
		\def\@p@srheight{}\def\@p@srwidth{}
		\def\@p@sangle{0}
		\def\@p@sfile{} \def\@p@sbbfile{}
		\def\@p@scost{10}
		\def\@sc{}
		\@prologfilefalse
		\@postlogfilefalse
		\@clipfalse
		\if@noisy
			\@verbosetrue
		\else
			\@verbosefalse
		\fi
}
%
% Go through the options setting things up.
%
\def\parse@ps@parms#1{
	 	\@psdo\@psfiga:=#1\do
		   {\expandafter\@setparms\@psfiga,}}
%
% Compute bb height and width
%
\newif\ifno@bb
\def\bb@missing{
	\if@verbose{
		\ps@typeout{psfig: searching \@p@sbbfile \space  for bounding box}
	}\fi
	\no@bbtrue
	\epsf@getbb{\@p@sbbfile}
        \ifno@bb \else \bb@cull\epsf@llx\epsf@lly\epsf@urx\epsf@ury\fi
}	
\def\bb@cull#1#2#3#4{
	\dimen100=#1 bp\edef\@p@sbbllx{\number\dimen100}
	\dimen100=#2 bp\edef\@p@sbblly{\number\dimen100}
	\dimen100=#3 bp\edef\@p@sbburx{\number\dimen100}
	\dimen100=#4 bp\edef\@p@sbbury{\number\dimen100}
	\no@bbfalse
}
% rotate point (#1,#2) about (0,0).
% The sine and cosine of the angle are already stored in \sine and
% \cosine.  The result is placed in (\p@intvaluex, \p@intvaluey).
\newdimen\p@intvaluex
\newdimen\p@intvaluey
\def\rotate@#1#2{{\dimen0=#1 sp\dimen1=#2 sp
%            	calculate x' = x \cos\theta - y \sin\theta
		  \global\p@intvaluex=\cosine\dimen0
		  \dimen3=\sine\dimen1
		  \global\advance\p@intvaluex by -\dimen3
% 		calculate y' = x \sin\theta + y \cos\theta
		  \global\p@intvaluey=\sine\dimen0
		  \dimen3=\cosine\dimen1
		  \global\advance\p@intvaluey by \dimen3
		  }}
\def\compute@bb{
		\no@bbfalse
		\if@bbllx \else \no@bbtrue \fi
		\if@bblly \else \no@bbtrue \fi
		\if@bburx \else \no@bbtrue \fi
		\if@bbury \else \no@bbtrue \fi
		\ifno@bb \bb@missing \fi
		\ifno@bb \ps@typeout{FATAL ERROR: no bb supplied or found}
			\no-bb-error
		\fi
		%
%\ps@typeout{BB: \@p@sbbllx, \@p@sbblly, \@p@sbburx, \@p@sbbury} 
%
% store height/width of original (unrotated) bounding box
		\count203=\@p@sbburx
		\count204=\@p@sbbury
		\advance\count203 by -\@p@sbbllx
		\advance\count204 by -\@p@sbblly
		\edef\ps@bbw{\number\count203}
		\edef\ps@bbh{\number\count204}
		%\ps@typeout{ psbbh = \ps@bbh, psbbw = \ps@bbw }
		\if@angle 
			\Sine{\@p@sangle}\Cosine{\@p@sangle}
	        	{\dimen100=\maxdimen\xdef\r@p@sbbllx{\number\dimen100}
					    \xdef\r@p@sbblly{\number\dimen100}
			                    \xdef\r@p@sbburx{-\number\dimen100}
					    \xdef\r@p@sbbury{-\number\dimen100}}
%
% Need to rotate all four points and take the X-Y extremes of the new
% points as the new bounding box.
                        \def\minmaxtest{
			   \ifnum\number\p@intvaluex<\r@p@sbbllx
			      \xdef\r@p@sbbllx{\number\p@intvaluex}\fi
			   \ifnum\number\p@intvaluex>\r@p@sbburx
			      \xdef\r@p@sbburx{\number\p@intvaluex}\fi
			   \ifnum\number\p@intvaluey<\r@p@sbblly
			      \xdef\r@p@sbblly{\number\p@intvaluey}\fi
			   \ifnum\number\p@intvaluey>\r@p@sbbury
			      \xdef\r@p@sbbury{\number\p@intvaluey}\fi
			   }
%			lower left
			\rotate@{\@p@sbbllx}{\@p@sbblly}
			\minmaxtest
%			upper left
			\rotate@{\@p@sbbllx}{\@p@sbbury}
			\minmaxtest
%			lower right
			\rotate@{\@p@sbburx}{\@p@sbblly}
			\minmaxtest
%			upper right
			\rotate@{\@p@sbburx}{\@p@sbbury}
			\minmaxtest
			\edef\@p@sbbllx{\r@p@sbbllx}\edef\@p@sbblly{\r@p@sbblly}
			\edef\@p@sbburx{\r@p@sbburx}\edef\@p@sbbury{\r@p@sbbury}
%\ps@typeout{rotated BB: \r@p@sbbllx, \r@p@sbblly, \r@p@sbburx, \r@p@sbbury}
		\fi
		\count203=\@p@sbburx
		\count204=\@p@sbbury
		\advance\count203 by -\@p@sbbllx
		\advance\count204 by -\@p@sbblly
		\edef\@bbw{\number\count203}
		\edef\@bbh{\number\count204}
		%\ps@typeout{ bbh = \@bbh, bbw = \@bbw }
}
%
% \in@hundreds performs #1 * (#2 / #3) correct to the hundreds,
%	then leaves the result in @result
%
\def\in@hundreds#1#2#3{\count240=#2 \count241=#3
		     \count100=\count240	% 100 is first digit #2/#3
		     \divide\count100 by \count241
		     \count101=\count100
		     \multiply\count101 by \count241
		     \advance\count240 by -\count101
		     \multiply\count240 by 10
		     \count101=\count240	%101 is second digit of #2/#3
		     \divide\count101 by \count241
		     \count102=\count101
		     \multiply\count102 by \count241
		     \advance\count240 by -\count102
		     \multiply\count240 by 10
		     \count102=\count240	% 102 is the third digit
		     \divide\count102 by \count241
		     \count200=#1\count205=0
		     \count201=\count200
			\multiply\count201 by \count100
		 	\advance\count205 by \count201
		     \count201=\count200
			\divide\count201 by 10
			\multiply\count201 by \count101
			\advance\count205 by \count201
			%
		     \count201=\count200
			\divide\count201 by 100
			\multiply\count201 by \count102
			\advance\count205 by \count201
			%
		     \edef\@result{\number\count205}
}
\def\compute@wfromh{
		% computing : width = height * (bbw / bbh)
		\in@hundreds{\@p@sheight}{\@bbw}{\@bbh}
		%\ps@typeout{ \@p@sheight * \@bbw / \@bbh, = \@result }
		\edef\@p@swidth{\@result}
		%\ps@typeout{w from h: width is \@p@swidth}
}
\def\compute@hfromw{
		% computing : height = width * (bbh / bbw)
	        \in@hundreds{\@p@swidth}{\@bbh}{\@bbw}
		%\ps@typeout{ \@p@swidth * \@bbh / \@bbw = \@result }
		\edef\@p@sheight{\@result}
		%\ps@typeout{h from w : height is \@p@sheight}
}
\def\compute@handw{
		\if@height 
			\if@width
			\else
				\compute@wfromh
			\fi
		\else 
			\if@width
				\compute@hfromw
			\else
				\edef\@p@sheight{\@bbh}
				\edef\@p@swidth{\@bbw}
			\fi
		\fi
}
\def\compute@resv{
		\if@rheight \else \edef\@p@srheight{\@p@sheight} \fi
		\if@rwidth \else \edef\@p@srwidth{\@p@swidth} \fi
		%\ps@typeout{rheight = \@p@srheight, rwidth = \@p@srwidth}
}
%		
% Compute any missing values
\def\compute@sizes{
	\compute@bb
	\if@scalefirst\if@angle
% at this point the bounding box has been adjsuted correctly for
% rotation.  PSFIG does all of its scaling using \@bbh and \@bbw.  If
% a width= or height= was specified along with \psscalefirst, then the
% width=/height= value needs to be adjusted to match the new (rotated)
% bounding box size (specifed in \@bbw and \@bbh).
%    \ps@bbw       width=
%    -------  =  ---------- 
%    \@bbw       new width=
% so `new width=' = (width= * \@bbw) / \ps@bbw; where \ps@bbw is the
% width of the original (unrotated) bounding box.
	\if@width
	   \in@hundreds{\@p@swidth}{\@bbw}{\ps@bbw}
	   \edef\@p@swidth{\@result}
	\fi
	\if@height
	   \in@hundreds{\@p@sheight}{\@bbh}{\ps@bbh}
	   \edef\@p@sheight{\@result}
	\fi
	\fi\fi
	\compute@handw
	\compute@resv}
%
%
%
\def\OzTeXSpecials{
	\special{empty.ps /@isp {true} def}
	\special{empty.ps \@p@swidth \space \@p@sheight \space
			\@p@sbbllx \space \@p@sbblly \space
			\@p@sbburx \space \@p@sbbury \space
			startTexFig \space }
	\if@clip{
		\if@verbose{
			\ps@typeout{(clip)}
		}\fi
		\special{empty.ps doclip \space }
	}\fi
	\if@angle{
		\if@verbose{
			\ps@typeout{(rotate)}
		}\fi
		\special {empty.ps \@p@sangle \space rotate \space} 
	}\fi
	\if@prologfile
	    \special{\@prologfileval \space } \fi
	\if@decmpr{
		\if@verbose{
			\ps@typeout{psfig: Compression not available
			in OzTeX version \space }
		}\fi
	}\else{
		\if@verbose{
			\ps@typeout{psfig: including \@p@sfile \space }
		}\fi
		\special{epsf=\@p@sfile \space }
	}\fi
	\if@postlogfile
	    \special{\@postlogfileval \space } \fi
	\special{empty.ps /@isp {false} def}
}
\def\DvipsSpecials{
	%
	\special{ps::[begin] 	\@p@swidth \space \@p@sheight \space
			\@p@sbbllx \space \@p@sbblly \space
			\@p@sbburx \space \@p@sbbury \space
			startTexFig \space }
	\if@clip{
		\if@verbose{
			\ps@typeout{(clip)}
		}\fi
		\special{ps:: doclip \space }
	}\fi
	\if@angle
		\if@verbose{
			\ps@typeout{(clip)}
		}\fi
		\special {ps:: \@p@sangle \space rotate \space} 
	\fi
	\if@prologfile
	    \special{ps: plotfile \@prologfileval \space } \fi
	\if@decmpr{
		\if@verbose{
			\ps@typeout{psfig: including \@p@sfile.Z \space }
		}\fi
		\special{ps: plotfile "`zcat \@p@sfile.Z" \space }
	}\else{
		\if@verbose{
			\ps@typeout{psfig: including \@p@sfile \space }
		}\fi
		\special{ps: plotfile \@p@sfile \space }
	}\fi
	\if@postlogfile
	    \special{ps: plotfile \@postlogfileval \space } \fi
	\special{ps::[end] endTexFig \space }
}
%
% \psfig
% usage : \psfig{file=, height=, width=, bbllx=, bblly=, bburx=, bbury=,
%			rheight=, rwidth=, clip=}
%
% "clip=" is a switch and takes no value, but the `=' must be present.
\def\psfig#1{\vbox {
	% do a zero width hard space so that a single
	% \psfig in a centering enviornment will behave nicely
	%{\setbox0=\hbox{\ }\ \hskip-\wd0}
	%
	\ps@init@parms
	\parse@ps@parms{#1}
	\compute@sizes
	%
	\ifnum\@p@scost<\@psdraft{
		\PsfigSpecials 
		% Create the vbox to reserve the space for the figure.
		\vbox to \@p@srheight sp{
		% 1/92 TJD Changed from "true sp" to "sp" for magnification.
			\hbox to \@p@srwidth sp{
				\hss
			}
		\vss
		}
	}\else{
		% draft figure, just reserve the space and print the
		% path name.
		\if@draftbox{		
			% Verbose draft: print file name in box
			% 10/93 TJD changed to fbox from frame
			\hbox{\fbox{\vbox to \@p@srheight sp{
			\vss
			\hbox to \@p@srwidth sp{ \hss 
			        % 10/93 TJD deleted to avoid ``_'' problems
				% \@p@sfile
			 \hss }
			\vss
			}}}
		}\else{
			% Non-verbose draft
			\vbox to \@p@srheight sp{
			\vss
			\hbox to \@p@srwidth sp{\hss}
			\vss
			}
		}\fi	



	}\fi
}}
\psfigRestoreAt
\setDriver
\let\@=\LaTeXAtSign




quant-ph0101140.extracted_bib
\begin{thebibliography}{9}
\addcontentsline{toc}{chapter}{Literaturverzeichnis}

\bibitem{TER91} Ya.~P.~Terlitskii, {\em Statistical Physics} (North Holland Publ., Amsterdam, 1991)

\bibitem{SCH89} F.~Schl\"ogl, {\em Probability and Heat} (Vieweg, Braunschweig, 1998)

\bibitem{NEU30} J.~v.~Neumann, 
 Zeitschr. f. Physik {\bf 57}, 30 (1930).


\bibitem{LAN78}L.~Landau, M.~Lifshitz, {\em Statistical Mechanics} (Pergamon
  Press, Oxford, 1978); {\em Quantum Mechanics} (Pergamon Press, Oxford, 1977)


\bibitem{SCH89} E.~Schr\"odinger, {\em Statistical Thermodynamics} (Dover Publ.,
  New York, 1989).

\bibitem{PAU37} W.~Pauli, M.~Fierz,
 Zeitschr. f. Physik {\bf 106}, 572 (1937).

\bibitem{LIN83} G.~Lindblad, {\em Non-equilibrium Entropy and Irreversibility}
  (D. Reidel Publ. Comp., Dordrecht 1983)
 
\bibitem{ZUR91} W.~Zurek,
 Phys. Today {\bf 44}, No.10, 36 (1991);
 Phys. Today {\bf 46}, No.12, 81 (1993).

\bibitem{ZUR94} W.~Zurek, J.~ Paz,
 Phys.~Rev~Lett. {\bf 72}, 2508 (1994).

\bibitem{LLO88} S.~Lloyd, H.~Pagels, Ann.Phys. (N.Y.)
{\bf 188}, 186 (1988).

\bibitem{PAG93} Don N. Page,
 Phys.~Rev.~Lett. {\bf 71}, 1291 (1993).

\bibitem{LUB78} E.~Lubkin,
Math. Phys. {\bf 19}, 1028 (1978).


\bibitem{SEN96} S.~Sen,
 Phys.~Rev.~Lett. {\bf 77}, 1 (1996).



\end{thebibliography}