Computation of Entropy in Statistical Mechanics and Information Theory