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