We show that classical thermodynamics has a formulation in terms of
Hamilton-Jacobi theory, analogous to mechanics. Even though the thermodynamic
variables come in conjugate pairs such as pressure/volume or
temperature/entropy, the phase space is odd-dimensional. For a system with n
thermodynamic degrees of freedom it is (2n+1)-dimensional. The equations of
state of a substance pick out an n-dimensional submanifold. A family of
substances whose equations of state depend on n parameters define a
hypersurface of co-dimension one. This can be described by the vanishing of a
function which plays the role of a Hamiltonian. The ordinary differential
equations (characteristic equations) defined by this function describe a
dynamical system on the hypersurface. Its orbits can be used to reconstruct the
equations of state. The `time' variable associated to this dynamics is related
to, but is not identical to, entropy. After developing this formalism on
well-grounded systems such as the van der Waals gases and the Curie-Weiss
magnets, we derive a Hamilton-Jacobi equation for black hole thermodynamics in
General Relativity. The cosmological constant appears as a constant of
integration in this picture.Comment: Minor typos fixe