The Storm Applet:
There are a few more things I want to do:
(1) pause a random amount of time (eg. = -1000 * log(U) ) between drops
of water,
where U is a random number between 0 and 1 (instead of pause 1 second now).
(2) Output the time t from start (may be add a start button), and output
the number of drop hits
at time t. (display time to the 1/10 of a second)
(3) Built a sliding rule where you can
adjust speed while the applet is running.
The range of the slide should be from 0 to a large number like 30.
When slide is at zero, it
means we actually stop the rain drop. (initially the slide should be at 1).
For slide at 2, it means
the time is now running twice as fast as real clock.
(4) Output the true calendar/clock time t* from start. This time
is not affected by the slide, otherwise
the same as time. May be we should call t the tape recorded time,
t* the real time.
(5) A plot of t vs. t*. (if you leave the slide at 1 all the time
then this should be a 45 degree straight line).
(6) a plot of t vs. N(t), like in the physlet resouces. dynamically rescales.
Psodo-code for the speed adjustment:
1. generate a r.v. with exp(1) distribution, value store in InterArrival.
2. SUM <- 0
3. read-in the value of intensity from the slider,
SUM += [intensity*delta], (delta= a small constant)
sleep for [intensity*delta] micro seconds
4. If SUM < Interarrival, go to 3
If SUM > Interarrival, generate one more raindrop, then go to 1.