Transverse vibrations of a ship hull in ideal fluid, determined through variational methods