calculate entropy