Skip to content

komm.binary_entropy_inv

Computes the inverse of the binary entropy function. More precisely, it computes the value of $p \in [0, 1/2]$ such that $\Hb(p) = h$.

Parameters:

  • h (float)

    A value in the interval $[0, 1]$.

  • tol (float)

    The tolerance for the binary search. The default value is 1e-12.

Returns:

  • float

    The value of $p \in [0, 1/2]$ such that $\Hb(p) = h$.

Examples:

>>> [komm.binary_entropy_inv(h) for h in [0.0, 0.25, 0.5, 0.75, 1.0]]
[0.0, 0.04169269027397604, 0.1100278644385071, 0.2145017448597173, 0.5]