Length distribution of random secants on a unit square
- To: mathgroup at smc.vnet.net
- Subject: [mg95712] Length distribution of random secants on a unit square
- From: andreas.kohlmajer at gmx.de
- Date: Sun, 25 Jan 2009 06:53:55 -0500 (EST)
I need to work with the length distribution of random secants (of two
random points on the perimeter) on a unit square. It's easy to
generate some random data and a histogram. I used the following code
(Mathematica 7.0):
len = Norm[(First[#] - Last[#])] &;
corners = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
dir = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
p[t_] := Block[{n, r},
n = Mod[IntegerPart[t], 4];
r = FractionalPart[t];
corners[[n + 1]] + r dir[[n + 1]]
]
Histogram[
Table[len[{p[RandomReal[{0, 4}]], p[RandomReal[{0, 4}]]}], {100000}],
PlotRange -> All]
The histogram shows a small increase close to 1, a big peak at 1 and
some kind of exponential decay to Sqrt[2] (= maximum).
Does anybody know how to calculate this distribution exactly? What
about moving from a unit square to a random rectangle or a random
polygon? Thanks!