Zip Zap and Poof!

What is the expected distance between 2 points chosen uniformly (by volume) in a unit cube?


The answer is 0.66170.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Abdelhamid Saadi
Jan 14, 2017

This solution in python based on Monte Carlo.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
"Zip Zap and Poof!"

from random import random as rand

def distance(p, q):
    return ((p[0] -q[0])**2 + (p[1] -q[1])**2 + (p[2] -q[2])**2)**.5

def randPoint():
    return (rand(), rand(), rand())


for k in range(40):
    n = 2**k
    print(n, sum(distance(randPoint(), randPoint()) for p in range(n))/n)

Aaghaz Mahajan
Jan 22, 2019

This is known as the Robbin's Constant

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...