  The Wang-Landau (WL) algorithm has been widely used for simulations in many
areas of physics. Our analysis of the WL algorithm explains its properties and
shows that the difference of the largest eigenvalue of the transition matrix in
the energy space from unity can be used to control the accuracy of estimating
the density of states. Analytic expressions for the matrix elements are given
in the case of the one-dimensional Ising model. The proposed method is further
confirmed by numerical results for the one-dimensional and two-dimensional
Ising models and also the two-dimensional Potts model.
