Introduction to Probability · Problem 2.2.23

Combinatorics — Grinstead & Snell

Mathematics — Probability · continuous-density-functions

Problem

Write a program that picks a random number between 0 and 1 and computes the negative of its logarithm. Repeat this process a large number of times and plot a bar graph to give the number of times that the outcome falls in each interval of length 0.1 in [0,10][0, 10]. On this bar graph plot a graph of the density f(x)=e−xf(x) = e^{-x}. How well does this density fit your graph?

Related theory

Browse the problem library