Compute Shannon entropy H (bits/symbol) from discrete source symbol probabilities (probabilities should sum to 1; zero-probability terms count as 0).
概率应之和为 1;某事件概率为 0 时该项记 0。
| Item | Formula / Rule | Source / Standard |
|---|---|---|
| Shannon entropy | H = −∑ pi log2 pi in bits per symbol | Shannon, A Mathematical Theory of Communication, 1948 |
| Boundary conditions | H peaks at log2 n for a uniform distribution and falls to 0 when one symbol is certain | Shannon 1948 §1, Theorem 1 |
| Practical estimator | Sample estimate Ĥ = −∑ (ci/N) log2(ci/N) with counts ci | Cover & Thomas, Elements of Information Theory, Ch. 2 |