All problems
Differential Entropy of Laplace
Problem
Return the differential entropy in bits of a Laplace distribution with scale b:
h = log2(2 * e * b)
Assume b > 0.
Hint
The Laplace scale b relates to its variance by var = 2 * b^2.
Test cases
case 1
in: [1]
expected: 2.4426950408889634
case 2
in: [0.5]
expected: 1.4426950408889634
case 3
in: [2]
expected: 3.4426950408889634
case 4
in: [0.25]
expected: 0.44269504088896333
Starter codePython
import math
def de_laplace(b):
# Your code here
pass4 test cases · run your code against them in the editor