Assume that the lifetime of a diesel engine part is a random variable X with density fX. When the part wears out, it is replaced by another with the same density. Let N(t) be the number of parts that are used in time t. We want to study the random variable N(t)/t. Since parts are replaced on the average every E(X) time units, we expect about t/E(X) parts to be used in time t. That is, we expect that
t→∞limE(tN(t))=E(X)1.
This result is correct but quite difficult to prove. Write a program that will allow you to specify the density fX, and the time t, and simulate this experiment to find N(t)/t. Have your program repeat the experiment 500 times and plot a bar graph for the random outcomes of N(t)/t. From this data, estimate E(N(t)/t) and compare this with 1/E(X). In particular, do this for t=100 with the following two densities:
(a) fX=e−t.
(b) fX=te−t.