Discussion about this post

User's avatar
Eric Widdison's avatar

I simulated this one extensively. The expected number of posts is slightly more than 3, somewhere between 3.01 and 3.02.

The first time I tried to calculate the answer to the puzzle I was using a spreadsheet to simulate the forest and find the number of points in the convex hull (for that model I figured out which points were extreme points in different discrete directions, like each integer degree angle, which is almost always the same as the actual convex hull) the expectation came out to 3.14..., which had me thinking the result might just be pi. It is not.

I tried to find some way to express the number of posts as a function of angle (including the stated condition that when the angle is close to 360° the two bounding fences are still there). The relationship is almost, but not quite, linear.

(For those who are interested, you can generate the locations of the trees by producing polar coordinates where the radius has a probability density function f(r)=r*ln(0.5)*exp(r*ln(0.5)), and cumulative distribution F(r)=1+exp(r*ln(0.5))*(r*ln(0.5)-1). The angle is uniformly distributed from 0 to 90°, which can be changed to any range up to 360°. Producing a random variable with a given distribution can be done by getting a random probability, uniformly distributed from 0 to 1, and then taking the inverse CDF, which in this case must be done numerically.)

As was often the case with your puzzles, I ended up having a lot of fun exploring the problem, but didn't produce any results that were mature enough to justify writing up. Alas.

Expand full comment
Izumihara Ryoma's avatar

Thank you for sharing such an interesting problem and for including my solution.

I do have one question regarding your simulation.

In your simulation, did you sample the variable r from an exponential distribution with λ equal to log(2) (that is, using a probability density given by 0.5^r × log(2)) and select θ uniformly from the interval [0, π/2] to determine the locations of 1000 trees?

If that is the case, then the model does not actually reflect the scenario described in the problem, where the tree density halves every kilometer.

In general, using the same probability density for r as for the x-y coordinates does not necessarily yield the intended distribution.

For instance, if you sample 1000 values of r uniformly from [0, 1] and 1000 values of θ uniformly from [0, 2π], and then plot the points, you will likely notice that the distribution of points is not uniform.

To illustrate this effect, consider running the following Python code:

import numpy as np

import matplotlib.pyplot as plt

r = np.random.uniform(0, 1, 1000)

theta = np.random.uniform(0, 2*np.pi, 1000)

x = r * np.cos(theta)

y = r * np.sin(theta)

plt.scatter(x, y, marker=".")

plt.axis("equal")

plt.show()

In this example, the average number of points between r = 0.1 and r = 0.1 + Δr is the same as between r = 0.9 and r = 0.9 + Δr.

However, because the area corresponding to the outer region around r = 0.9 is approximately nine times larger than that at r = 0.1, the density in the outer region ends up being about one-ninth of that in the inner region.

The same effect occurs in the probability distribution for this problem, so directly using the x-y density as the probability density for r does not achieve the desired outcome.

Expand full comment
6 more comments...

No posts