Revision as of 21:31, 12 June 2024 by Admin
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
BBy Bot
Jun 09'24

Exercise

A large number of waiting time problems have an exponential distribution of outcomes. We shall see (in Important Densities) that such outcomes are simulated by computing [math](-1/\lambda)\log(\mbox{rnd})[/math], where [math]\lambda \gt 0[/math]. For waiting times produced in this way, the average waiting time is [math]1/\lambda[/math]. For example, the times spent waiting for a car to pass on a highway, or the times between emissions of particles from a radioactive source, are simulated by a sequence of random numbers, each of which is chosen by computing [math](-1/\lambda)\log(\mbox{rnd})[/math], where [math]1/\lambda[/math] is the average time between cars or emissions. Write a program to simulate the times between cars when the average time between cars is 30 seconds. Have your program compute an area bar graph for these times by breaking the time interval from 0 to 120 into 24 subintervals. On the same pair of axes, plot the function [math]f(x) = (1/30)e^{-(1/30)x}[/math]. Does the function fit the bar graph well?