Distance of Random Points Within Hollow Square Laminae

Assuming that two points are chosen randomly (with uniform distribution) within a rectangle, it is possible to determine the expected value of the distance between these two points.
For example, the expected distance between two random points in a unit square is about $0.521405$, while the expected distance between two random points in a rectangle with side lengths $2$ and $3$ is about $1.317067$.
Now we define a hollow square lamina of size $n$ to be an integer sized square with side length $n \ge 3$ consisting of $n^2$ unit squares from which a rectangle consisting of $x \times y$ unit squares ($1 \le x,y \le n – 2$) within the original square has been removed.
For $n = 3$ there exists only one hollow square lamina:

For $n = 4$ you can find $9$ distinct hollow square laminae, allowing shapes to reappear in rotated or mirrored form:

Let $S(n)$ be the sum of the expected distance between two points chosen randomly within each of the possible hollow square laminae of size $n$. The two points have to lie within the area left after removing the inner rectangle, i.e. the gray-colored areas in the illustrations above.
For example, $S(3) = 1.6514$ and $S(4) = 19.6564$, rounded to four digits after the decimal point.
Find $S(40)$ rounded to four digits after the decimal point.

The calculation of $S(40)$ requires an understanding of Probability theory, Geometry and Programming. We need to generate all possible rectangles that can be cut from the 40×40 square, then calculate the Modified area and Expected distance between two points for each formation and sum that up.

The Expected distance between two random points in any shape can be calculated as twice the Triple integral of (A.p.d)/(A^2) over the shape boundaries. Where A denotes the modified area available after cutting out the rectangle, p the probability for point 2 to exist in the shape and d the distance between the two points.
The Iterated triple integral over the two points results into a Sextuple integral which can be quite complex to solve using analytical methods due to the existence of rectangle boundary conditions.

However, The Coding solution for this calculation involves the following steps:

Step 1. Set up a nested loop to cycle through widths and heights of possible rectangles to remove, each ranging from 1 to 40-2 (i.e., from 1 to 38), as inner rectangles need to be strictly smaller than the 40×40 square.

Step 2. For each possible rectangle – For widths W and heights H run for loop from 1 to 38 and calculate Modified Area = Total Area – (W * H) for each possible formation. So, for every possible (W, H) we calculate the Area left after cutting out rectangle as Modified_area = Area of square (n^2) – Area of Inner rectangle (w * h).

Step 3. To calculate the expected distance for every possible rectangle, You break down the area to infinitesimally small parts and Integrate (sum up) every possible coordinate of two points over that area which results in six-fold summation.

Step 4. These are summed up for all positions of the rectangle within the square, taking care to avoid double-counting of equivalent rectangles.

Step 5. At the end, round the answer to four decimal places.

The Calculations and loops involved consumes a lot of computing power taking into account 38*38 combinations of rectangles plus the Sextuple integral calculation for each combination which involves Looping over 40 raise to power of 6, which is a very large number. Hence brute force method takes a very long time to calculate this. There exist interesting mathematical properties when solving this using Brownian Bridge process to simplify the calculation which involves a different solution approach.

While it is possible to write out the code for the process described above, you would require a high level scientific computing environment to run the program due to its computation-intensive nature. Hence, Without a high power computing system, it is not feasible to provide the exact result of this computation in this query.

More Answers:
Chromatic Conundrum
Faulhaber’s Formulas
The Floor’s Revenge

Error 403 The request cannot be completed because you have exceeded your quota. : quotaExceeded

Share:

Recent Posts

Don't Miss Out! Sign Up Now!

Sign up now to get started for free!