All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Shapes
Mean Distance Two Points (Posted on 2013-06-01) Difficulty: 3 of 5
[1] What is the mean distance between two random points on the perimeter of a unit square?

[2] What is the mean distance between two random points on the interior of a unit square?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts re: Part 2 in two different ways. | Comment 4 of 9 |
(In reply to Part 2 in two different ways. by Jer)

The following program does the numerical integration for n = 2 to 20:

DEFDBL A-Z
RANDOMIZE TIMER
CLS
FOR n = 2 TO 20
  tdist = 0: numdist = 0
  st = 1 / (2 * n): incr = 1 / n
  FOR x1 = st TO 1 STEP incr
   FOR x2 = st TO 1 STEP incr
    FOR y1 = st TO 1 STEP incr
     FOR y2 = st TO 1 STEP incr
       dist = SQR((x1 - x2) ^ 2 + (y1 - y2) ^ 2)
       tdist = tdist + dist
       numdist = numdist + 1
     NEXT
    NEXT
   NEXT
  NEXT
  PRINT n, numdist, tdist / numdist
NEXT

The results for n=2 and n=3 agree with Jer's, but not for n=4:

n             number of      mean distance
              distances
2             16            .4267766952966369
3             81            .4844370910985638
4             256           .5020037423450223
5             625           .5095129960727699
6             1296          .5133861693773205
7             2401          .5156379202536392
8             4096          .517060338925679
9             6561          .5180153643456192
10            10000         .5186872221213226
11            14641         .5191776353130316
12            20736         .5195464665681498
13            28561         .5198307970458254
14            38416         .5200545852311136
15            50625         .5202338670624983
16            65536         .520379702532333
17            83521         .5204999191245344
18            104976        .5206001822997849
19            130321        .5206846742324516
20            160000        .5207565364233291

I think it makes sense that the distance is continually increasing as it gets to include larger and larger almost-full diagonal lengths.


  Posted by Charlie on 2013-06-02 10:43:12
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information