In a class, we just learnt of Paul Lévy's arcsine rule. This rule
gives the limit distribution of the time a symmetric simple random
walk spends on the positive half line within some given time.
The rule is easy to illustrate in J. The first fret of the following
two simulates some random walks and plots the empirical cdf of the
variable we're interested in, the second fret shows the sine shape
this should approximate (there could be some off-by-one errors, so the
placement and size might not be the same, but the shape should be).
'#'{.~"0->:-:_80{.\/:~+/"1]0<(+0,"1}:"1)+/\"1-.+:?2$~4000 156
'#'{.~"0->:<.79*-:>:1 o.}:i:(o.0.5)j.51
Ambrus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm