Entropy, homology and semialgebraic geometry