0

My question is quite similar to this one. But what would be the solution in case of a rectangle with width W and length L??

Q1

I would like to find the average shortest distance between randomly distributed n points in a rectangle L xW. I would like to take each point the Euclidean distance to its nearest neighbor,and calculate the average distance over all points?

I was hoping if I could do the same simulation similar to @Henry's answer but I am not quite familiar to computing languages.

Q2

The second part of my question is if I could assign the coordinates of some points in the rectangle. For example, I would like to add some conditions that points cannot be distributed in the grey shaded area in this rectangle. Image here Thus the points can be distributed randomly over the area of the rectangle except for the shaded gray area. What would be the average shortest distance between randomly distributed n number of points ?

I would sincerely appreciate some help.

Semiclassical
  • 15,842
  • To get accurate approximate answers, a simulation is likely the best you can do. – quasi Jan 06 '21 at 05:43
  • "A square with width W and length L." Should this be a rectangle? – Semiclassical Jan 06 '21 at 05:49
  • @quasi I am quite I'm not familiar with computing simulations, could you give a simple suggestion? – Yun Hyunsoo Jan 06 '21 at 05:50
  • @semiclassical Yes, a rectangle with width W and length L – Yun Hyunsoo Jan 06 '21 at 05:51
  • Yun Hyunsoo: Then those are the skills that you need to acquire. – quasi Jan 06 '21 at 05:52
  • What is the motivation for this problem? – user619894 Jan 06 '21 at 06:29
  • @user619894 I am trying to calculate the average shortest distance between points in a rectangle for designing a spacious layout, and it seemed that mathematical concepts were required. – Yun Hyunsoo Jan 06 '21 at 06:53
  • Have a look at this answer and the papers linked. Trust me you want to simulate or find someone to do this for you! – g g Jan 06 '21 at 08:06
  • @gg I've check this answers and the papers linked. Thanks! I think my situation is quite different, as I am trying to calculate the average shortest distance between "n" points instead of two random points. I am now trying to simulate this problem with R. I generated random points in a rectangle, then I calculated the average shortest distances between randomly generated points. The problem I am facing is that if I should perform a number of iteration, then calculate the average results of my simulation. Since I generated random points the results could be different for every iteration – Yun Hyunsoo Jan 06 '21 at 08:10
  • @gg I am very new to computing and statistics, so I hope you understand if Im asking something obvious – Yun Hyunsoo Jan 06 '21 at 08:13
  • No problem, if you pick any question in math it is non-obvious to many people, except for a few experts. Your problem sounds(!) as if you would like to find the average of the shortest distance between the points. Then you need to do lots (say a 1000 or so) simulation runs of "simulate points, calculate shortest distance" and then average over those. – g g Jan 06 '21 at 08:43
  • But of course, what you really want to calculate we cannot tell you. So think about this, the simulation results will help you make up your mind. And be aware that the average of the minimum distance is quite different from minimums over average distances. – g g Jan 06 '21 at 08:48
  • 1
    For large $n$ and uniform distribution of points inside a shape of area $\Delta$, the leading term of the expected nearest neighbor distance is $\frac{\sqrt{\Delta}}{2\sqrt{n-1}}$. It is not hard to write down a triple integral to represent this average but computing it is a nightmare. See my answer to a similar question on unit square for the setup. – achille hui Jan 06 '21 at 10:33

1 Answers1

1

Approximate solution to Q1 for a large amount of points

If you have N, a large amount of points, then the shape you use becomes irrelevant. In that case you can assume a Poisson distribution of points and consult the literature for the nearest neighbor distribution ( starting point: https://en.wikipedia.org/wiki/Nearest_neighbour_distribution).

In order to decide what "large amount" means, you need to have enough points to ignore the circumference of the shape. This means you need to have a lot more points "inside" the shape than "on the edges". To find out if this holds, lets assume we know $l$, the typical distance between points (we'll estimate the value in a moment). If the total circumference of the shape is $S$, there are approximately $N_{edge} \sim {S\over l}$ points near the edge, so as long as $N>>N_{edge}$ you can use the Poisson approximation.

To estimate $l$ note that the mean area a point "occupies" is $A_{mean} = {W*L\over N}$. Then the typical distance between points is $l=\sqrt{A_{mean}}$. If instead of a rectangle you have some other shape, replace $W*L$ with the area of the shape.

user619894
  • 3,838
  • Thanks for the brief explanation! So do you mean N_edge is approximately S/l , and when N >> N_edge, we can use the poisson approximation? – Yun Hyunsoo Jan 06 '21 at 12:28
  • 1
    Yes. also, in the comments someone posted https://math.stackexchange.com/a/2565546/617446, which is close in spirit. – user619894 Jan 06 '21 at 13:15