VOOZH about

URL: https://oeis.org/A383856

⇱ A383856 - OEIS


login
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.
0
1, 1, 1, 1, 1, 1, 1, 1, 2, 4
OFFSET
1,9
COMMENTS
Conjecture: a(11)..a(16) are 5, 6, 8, 9, 11, 12 with at least 99.7% confidence (based on numerical simulation discussed below).
Let L be the ratio of vector length to side length of a hypercube. If L <= 1 the probability P that a vector with random start and random orientation falls completely inside one hypercube can be calculated with one integral, e.g. in case of four dimensions: P_4(L) = (8/Pi^2)*Integral_{0..Pi/2} Integral_{0..Pi/2} Integral_{0..Pi/2} (1 - L * cos(x) * cos(y) * cos(z)) * (1 - L * sin(x) * cos(y) * cos(z)) * (1 - L * sin(y) * cos(z)) * (1 - L * sin(z)) * cos(y) * cos^2(z) dx dy dz = 1 - 16*L/(3*Pi) + 3*L^2/Pi - 32*L^3/(15*Pi^2) + L^4/(6*Pi^2). If L > 1, the probability needs to be integrated over multiple parts which leads to elliptical integrals in the case of three dimensions. Therefore for L > 1, numerical simulations were applied (see Python code below).
EXAMPLE
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.
PROG
(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)))
CROSSREFS
Sequence in context: A334822 A082871 A321406 * A166926 A266296 A028573
KEYWORD
nonn,more,hard
AUTHOR
Ruediger Jehn, May 12 2025
STATUS
approved