Python Relative Entropy Equation