Maximum of all distances between any pairs of vertices of a random triangle
Maybe
SeedRandom[1]
n = 300; d = 30;
p = RandomPoint[Sphere[d], {n, 3}];
xyz = Apply[EuclideanDistance, Subsets[#, {2}] & /@ p, {2}];
Mean[Map[Max, xyz]]
1.5164
If we use Ball[d]
instead of Sphere[d]
we get 1.47179
.
And a modification of your code (eliminating repeated invocations of Subsets[#,3]
on p
):
SeedRandom[1]
n = 300; d = 30;
p = RandomPoint[Sphere[d], {n}];
xyz = With[{s3 = Subsets[p, {3}]},
Apply[EuclideanDistance, Subsets[#, {2}] & /@ s3, {2}]];
Mean[Map[Max, xyz]]
1.51594
If we replace Sphere[d]
with Ball[d]
we get 1.46985
.
Seems no so effective.
Here we use RandomPoint
to select uniform points in Ball[]
and use RandomSample
to select three points to construct a random triangle.
SeedRandom[1];
n = 300;
d = 30;
pts = RandomPoint[Ball[d], n];
Table[Max @@
EuclideanDistance @@@ Subsets [RandomSample[pts, 3], {2}], {i,
200000}] // Mean
1.46926