  We propose a data-driven method to describe consistent equations of state
(EOS) for arbitrary systems. Complex EOS are traditionally obtained by fitting
suitable analytical expressions to thermophysical data. A key aspect of EOS are
that the relationships between state variables are given by derivatives of the
system free energy. In this work, we model the free energy with an artificial
neural network, and utilize automatic differentiation to directly learn the
derivatives of the free energy. We demonstrate this approach on two different
systems, the analytic van der Waals EOS, and published data for the
Lennard-Jones fluid, and show that it is advantageous over direct learning of
thermodynamic properties (i.e. not as derivatives of the free energy, but as
independent properties), in terms of both accuracy and the exact preservation
of the Maxwell relations. Furthermore, the method implicitly provides the free
energy of a system without explicit integration.
