A383856 Dimension in which a random vector of length n has the highest probability to fall into a single hypercube with side length of 10.
1, 1, 1, 1, 1, 1, 1, 1, 2, 4
Offset: 1
Examples
The probability P_1(0.9) that a one-dimensional vector of length 9 with a random start point does not cross the grid lines spaced by 10 units equals 1 - L = 10% (L=9/10). The probability P_2(0.9) that a two-dimensional vector of the same length with a random start point and a random orientation does not cross the lines of a 10 X 10 grid equals (2/Pi) * Integral_{0..Pi/2} (1 - L * cos(x)) * (1 - L * sin(x)) dx = 1 - L*(4-L)/Pi = 11.2%. The probability P_3(0.9) that a random three-dimensional vector of the same length does not cross the lines of a 10 X 10 X 10 grid equals (2/Pi) * Integral_{0..Pi/2} Integral_{0..Pi/2} (1 - L * cos(x) * cos(y)) * (1 - L * sin(x) * cos(y)) * (1 - L * sin(y)) * cos(y) dx dy = 1 - 1.5 L + 2 L^2/Pi - L^3/(4*Pi) = 10.7%. The highest probability not to cross any grid line is in case of a two-dimensional vector and therefore a(9) = 2.
Programs
-
Python
def random_point_on_sphere(dim): vec = abs(np.random.normal(0, 1, dim)) # Sample from standard normal (only positive values) vec /= np.linalg.norm(vec) # Normalize to unit length return vec L = 1.3 # pencil length, relative to hypercube side length nsample = 100000000 for dim in range(7,10): # explore only dimensions which are interesting for length L count = 0 for i in range(nsample): x0 = np.random.random(dim) # start point of pencil pencil = L*random_point_on_sphere(dim) k=0 while x0[k] + pencil[k] <= 1: # check dimension k if grid line is crossed if k == n-1: count += 1 break else: k += 1 print(dim, count) p = count/nsample # if the difference in the counts is smaller than the confidence interval, repeat with a larger nsample print("Half-width of 99% confidence interval:", 2.58*sqrt(nsample*p*(1-p)))
Comments