entropy¶
full name: tenpy.tools.math.entropy
parent module:
tenpy.tools.math
type: function
-
tenpy.tools.math.
entropy
(p, n=1)[source]¶ Calculate the entropy of a distribution.
Assumes that p is a normalized distribution (
np.sum(p)==1.
).- Parameters
p (1D array) – A normalized distribution.
n (1 | float | np.inf) – Selects the entropy, see below.
- Returns
entropy – Shannon-entropy \(-\sum_i p_i \log(p_i)\) (n=1) or Renyi-entropy \(\frac{1}{1-n} \log(\sum_i p_i^n)\) (n != 1) of the distribution p.
- Return type