Suppose $n$ points are uniformly and randomly selected in a square bounded by lines $ x=0,y=0,x=1,y=1.$ Let $X$ be the distance of a point from the centre $(1/2,1/2)$.Can we analytically calculate the density function of the range of $X$.i did a MATLAB simulation
for k=1:1000
for i=1:1000
x1(i)=rand();
x2(i)=rand();
y1(i)=rand();
y2(i)=rand();
d(i)=sqrt((x1(i)-0.5)^2+(y1(i)-0.5)^2);
range=max(d)-min(d);
end
r(k)=range
end
avg=sum(r)/1000
plot(r)
I got the average value of range as 0.67 .References and books for similar problems involving random distances between points are also requested
P.S:-Some experts are suggesting that my problem might be a duplicate of problem which talks about the average distance of a random point in a square .While the two problems might be apparently similar but my problem is different in that its aim to find the density function of the range $R$ of the distance of a random point from the centre of the square ,possibly as a function of $r$ itself just as talk of the pdf $f(y)$ of a random variable $Y$.Further ,while it is relatively straight forward to calculate the pdf of minimum and maximum of a rv ,it is an entirely different problem to compute the pdf of the range
d
. It was not clear to me initially that you had a double loop. Sorry about the confusion. – Jyrki Lahtonen May 19 '20 at 08:35range
variable. Anyway, my other point was that the result depends on the number of tests in the inner loop. Undoubtedly you know this, but without fixing the length of the inner loop we cannot have comparable numbers. – Jyrki Lahtonen May 19 '20 at 08:37