한 단위에있는 두 임의 점 사이의 예상 유클리드 거리 추정 $n$-반구

Nov 22 2020

Wolfram Mathematica를 사용하여 예상되는 유클리드 거리를 추정하는 가장 좋은 방법은 무엇입니까? $(n+1)$-차원 공간) 단위에서 무작위로 균일하게 선택된 두 점 사이 $n$- 헤미 ?

내가 염두에 둔 접근 방식은 길이가 비례하는 표현식을 사용합니다. $n$, 나는 더 간단하고 우아한 접근 방식을 원합니다.

답변

5 flinty Nov 22 2020 at 00:45

정규 분포를 사용하여 생성 $n$값과 Normalize구의 점을 얻습니다. 을 사용하여 마지막 좌표가 항상 동일한 부호를 가지고 있는지 확인하십시오 Abs. 수백만 개의 이러한 점을 생성하고 쌍 간의 평균 거리를 추정합니다.

n = 3;
topt[p_] := MapAt[Abs, Normalize[p], -1]
points = topt /@ RandomVariate[NormalDistribution[0, 1], {1000000, n}];
distances = EuclideanDistance @@@ Partition[points, 2];
Histogram[distances]
Mean[distances]

(* 1.13137 *)
2 JoshuaSchrier Nov 23 2020 at 10:02

샘플링을 수행하는 또 다른 방법 (내장 된 Sphere기능 및 RandomPoint기능 활용 ( 구 표면에서 샘플링에 대한 유사한 질문에서 수정 됨)

distanceDistributionOnHalfSphere[dimensionality_, nSamples_:10^5] :=
  With[{
   (* take a few extra samples account for loss *)
   randomPointsOnSurfaceOfNSphere = RandomPoint[Sphere[dimensionality], {4*nSamples, 2}], 
   
   (* define an operator that deletes points when either last coordinate is negative *)
   upperHemisphere = DeleteCases[{{___, x_}, {___, y_}} /; (Negative[x] || Negative[y])]
   },
  
  (* apply operator to the list and compute list of distances *)
  EuclideanDistance @@@ upperHemisphere @ randomPointsOnSurfaceOfNSphere
  ]

(* Evaluate mean of the sample *)
MeanAround /@ distanceDistributionOnHalfSphere /@ Range[10]

(그만큼 $N=3$ 결과는 @flinty의 결과 *와 일치합니다.)