Exercises / math
Binary entropy
entropy_bits(p) is the Shannon entropy of a Bernoulli(p) in bits. Use 0*log(0)=0. Print entropy of 0.5, 0.0, and 0.9 rounded to 3 decimals.
Live Pythonpython
Output
Run to execute this in your browser. Nothing is sent to a server.