added entropy calculating function