We propose a fast algorithm for the exact computation of the density o
f states for arbitrary discrete systems on intermediate-size lattices.
Results for the Ising model on lattices up to 13 x 13 are presented.
We also discuss how signals for phase transitions may be observed by i
nspecting the density of states directly, and verify this with the num
erical data for the Ising model. This procedure is based on the classi
cal view of the density of states as the exponential of the entropy. P
hase transition are then characterized by ''straight sections'' in the
entropy, considered as a function of the energy. It is found that sec
ond- as well as first-order phase transitions may be so described, the
difference between the two being in the way the length of the straigh
t section goes to infinity with the size of the system. This viewpoint
leads then to a short and physically transparent derivation of the Jo
sephson inequality for critical exponents.