  We show that the ideal hydrodynamics of an eccentric astrophysical disc can
be derived from a variational principle. The nonlinear secular theory describes
the slow evolution of a continuous set of nested elliptical orbits as a result
of the pressure in a thin disc. In the artificial but widely considered case of
a 2D disc, the hydrodynamic Hamiltonian is just the orbit-averaged internal
energy of the disc, which can be determined from its eccentricity distribution
using the geometry of the elliptical orbits. In the realistic case of a 3D
disc, the Hamiltonian needs to be modified to take into account the dynamical
vertical structure of the disc. The simplest solutions of the theory are
uniformly precessing nonlinear eccentric modes, which make the energy
stationary subject to the angular momentum being fixed. We present numerical
examples of nonlinear eccentric modes up to their limiting amplitudes. Although
it lacks dissipation, which is important in many astrophysical contexts, this
formalism allows a simpler theoretical approach to the nonlinear dynamics of
eccentric discs than that derived from stress integrals, and also connects
better with established methods of celestial mechanics for cases in which the
disc interacts gravitationally with one or more orbital companion.
