Navigation

Operators and Keywords

Function List:

C++ API

Function File: entropy (symbol_probabilites, base)

Computes the Shannon entropy of a discrete source whose probabilities are by symbol_probabilities, and optionally base can be specified. Base of logarithm defaults to 2, when the entropy can be thought of as a measure of bits needed to represent any message of the source. For example

                   entropy([0.25 0.25 0.25 0.25]) ⇒ ans = 2
                   entropy([0.25 0.25 0.25 0.25],4) ⇒ ans = 1