Skip to content
DeepForgeby svx
All problems
EasyInformation Theoryinfo-033

Binary Symmetric Channel Capacity

Problem

Compute the capacity in bits of a binary symmetric channel with crossover probability p:

C = 1 - H(p)

where H is the binary entropy function in bits.

Hint

At p = 0.5 the output is independent of the input, so no information gets through.

Test cases

case 1
in: [0]
expected: 1
case 2
in: [0.5]
expected: 0
case 3
in: [0.1]
expected: 0.5310044064107188
case 4
in: [0.25]
expected: 0.18872187554086717
Starter codePython
import math
def bsc_capacity(p):
    # Your code here
    pass

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