All problems
Differential Entropy of Exponential
Problem
Return the differential entropy in bits of an exponential distribution with rate parameter lambda:
h = (1 - ln(lambda)) / ln(2)
Assume lambda > 0.
Hint
The exponential distribution with rate 1 has entropy log2(e) bits.
Test cases
case 1
in: [1]
expected: 1.4426950408889634
case 2
in: [0.5]
expected: 2.442695040888964
case 3
in: [2]
expected: 0.44269504088896344
case 4
in: [0.25]
expected: 3.442695040888964
Starter codePython
import math
def de_exponential(rate):
# Your code here
pass4 test cases · run your code against them in the editor