Skip to content
DeepForgeby svx
All problems
MediumInformation Theoryinfo-061

Differential Entropy of Gaussian

Problem

Return the differential entropy in bits of a Gaussian with variance var:

h = 0.5 * log2(2 * pi * e * var)

Assume var > 0.

Hint

Gaussians maximize differential entropy for a fixed variance.

Test cases

case 1
in: [1]
expected: 2.047095585180641
case 2
in: [4]
expected: 3.047095585180641
case 3
in: [0.25]
expected: 1.047095585180641
case 4
in: [0.05854983152431917]
expected: 0
Starter codePython
import math
def de_gaussian(var):
    # Your code here
    pass

4 test cases · run your code against them in the editor