  We propose a new approach to the numerical solution of ergodic problems
arising in the homogenization of Hamilton-Jacobi (HJ) equations. It is based on
a Newton-like method for solving inconsistent systems of nonlinear equations,
coming from the discretization of the corresponding ergodic HJ equations. We
show that our method is able to solve efficiently cell problems in very general
contexts, e.g., for first and second order scalar convex and nonconvex
Hamiltonians, weakly coupled systems, dislocation dynamics and mean field
games, also in the case of more competing populations. A large collection of
numerical tests in dimension one and two shows the performance of the proposed
method, both in terms of accuracy and computational time.
