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

Home > Shapes
Hexagon Picking Probability (Posted on 2023-10-25) Difficulty: 3 of 5
You choose a random point, uniformly, within a regular hexagon, with unit side length.

What's the average distance to the six sides?

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution my numerical integration | Comment 6 of 7 |
Label the points:

A  .5, sqrt(3)/2
B  1, 0
C  .5, -sqrt(3)/2
D  -.5, -sqrt(3)/2
E  -1,0
F  -.5, sqrt(3)/2

O  0,0

Concentrate on triangle ABO as in Larry's posts.

All points within the triangle will have distances to AB and DE add up to sqrt(3).

When x < .5, distances to FA and DC will add up to sqrt(3), but
     x > .5, distance to FA is distance to A and distance to DC is distance to C.
     
When y is below line FB the distances to AB and DE add up to sqrt(3), otherwise
             distance to EF is distance to F and distance to CB is distance to B.
          The slope of FB is -sqrt(3)/2 / (3/2) = -1/sqrt(3) and
          FB goes through -.5, sqrt(3)/2, so the dividing line is
               y = sqrt(3)/2 - (x+.5)/sqrt(3)
               
so

A = [.5, sqrt(3)/2];
B = [1, 0];
C = [.5, -sqrt(3)/2];
D = [-.5, -sqrt(3)/2];
E = [-1,0];
F = [-.5, sqrt(3)/2];

O = [0,0];

slopeFB=-1/sqrt(3);
granu=1/1000;

sumdist=0; numdist=0;
for x=granu:granu:1
  for y=granu:granu:1
    if y<sqrt(3)*x && y<sqrt(3)*(1-x)
      sumdist=sumdist+sqrt(3);
      numdist=numdist+2;
      if x<.5
        sumdist=sumdist+sqrt(3);
        numdist=numdist+2;
      else
        sumdist=sumdist+norm(A-[x,y])+norm(C-[x,y]);
        numdist=numdist+2;
      end
      if y<sqrt(3)/2+slopeFB*(x+.5)  %   slopeFB is negative
        sumdist=sumdist+sqrt(3);
        numdist=numdist+2;
      else
        sumdist=sumdist+norm(F-[x,y])+norm(B-[x,y]);
        numdist=numdist+2;
      end
    end
  end
end
sumdist/numdist

finds an average of:

0.874441697155773

when the granularity (granu) is changed to 1/2000:

0.874441259261843

The norm function in Matlab is the square root of the sum of the squares.

With granularity 1/1000, sumdist is 2269239.16392143 and numdist is 2595072.


  Posted by Charlie on 2023-10-26 07:58:07
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 (4)
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