# Limiting density of discrete points

In information theory, the limiting density of discrete points is an adjustment to the formula of Claude Shannon for differential entropy.
It was formulated by Edwin Thompson Jaynes to address defects in the initial definition of differential entropy.

## Definition

Shannon originally wrote down the following formula for the entropy of a continuous distribution, known as differential entropy:
    $h(X)=-\int p(x)\log p(x)\,dx.$
Unlike Shannon's formula for the discrete entropy, however, this is not the result of any derivation (Shannon simply replaced the summation symbol in the discrete version with an integral), and it lacks many of the properties that make the discrete entropy a useful measure of uncertainty. In particular, it is not invariant under a change of variables and can become negative. In addition, it is not even dimensionally correct. Since $h(X)$ would be dimensionless, $p(x)$ must have units of ${\frac {1}{dx}}$, which means that the argument to the logarithm is not dimensionless as required.
Jaynes argued that the formula for the continuous entropy should be derived by taking the limit of increasingly dense discrete distributions. Suppose that we have a set of $N$ discrete points $\{x_{i}\}$, such that in the limit $N\to \infty$ their density approaches a function $m(x)$ called the "invariant measure":
    $\lim _{N\to \infty }{\frac {1}{N}}\,({\mbox{number of points in }}a<x<b)=\int _{a}^{b}m(x)\,dx.$
Jaynes derived from this the following formula for the continuous entropy, which he argued should be taken as the correct formula:
    $\lim _{N\rightarrow \infty }H_{N}(X)=\log(N)-\int p(x)\log {\frac {p(x)}{m(x)}}\,dx.$
Typically, when this is written, the term $\log(N)$ is omitted, as that would typically not be finite. So the actual common definition is
    $H(X)=-\int p(x)\log {\frac {p(x)}{m(x)}}\,dx.$
Where it is unclear whether or not the $\log(N)$ term should be omitted, one could write
    $H_{N}(X)\sim \log(N)+H(X).$
Notice that in Jaynes' formula, $m(x)$ is a probability density. For any finite $N$, $m(x)$ represents a uniform density over the quantized continuous space used in the Riemann sum. In the limit, $m(x)$ is the continuous limiting density of points in the quantization used to represent the continuous variable $x$.
Suppose one had a number format that took on $N$ possible values, distributed as per $m(x)$. Then $H_{N}(X)$ (if $N$ is large enough that the continuous approximation is valid) is the discrete entropy of the variable $x$ in this encoding. This is equal to the average number of bits required to transmit this information, and is no more than $\log(N)$. Therefore, $H(X)$ may be thought of as the amount of information gained by knowing that the variable $x$ follows the distribution $p(x)$, and is not uniformly distributed over the possible quantized values, as would be the case if it followed $m(x)$. $H(X)$ is actually the (negative) Kullback–Leibler divergence from $m(x)$ to $p(x)$, which is thought of as the information gained by learning that a variable previously thought to be distributed as $m(x)$ is actually distributed as $p(x)$.
Jaynes' continuous entropy formula has the property of being invariant under a change of variables, provided that $m(x)$ and $p(x)$ are transformed in the same way. (This motivates the name "invariant measure" for m.) This solves many of the difficulties that come from applying Shannon's continuous entropy formula. Jaynes himself dropped the $\log(N)$ term as it was not relevant to his work (maximum entropy distributions), and it is somewhat awkward to have an infinite term in the calculation. Unfortunately, this cannot be helped if the quantization is made arbitrarily fine, as would be the case in the continuous limit. Note that $H(X)$ as defined here (without the $\log(N)$ term) would always be non-positive, because a KL divergence would always be non-negative.
If it is the case that $m(x)$ is constant over some interval of size $r$, and $p(x)$ is essentially zero outside that interval, then the limiting density of discrete points (LDDP) is closely related to the differential entropy $h(X)$:
    $H_{N}(X)\approx \log(N)-\log(r)+h(X).$