Re: Sample implementation of make-ball-generator seems incorrect
Bradley Lucier 10 Feb 2024 16:55 UTC
On 2/9/24 11:54 PM, Linas Vepstas wrote:
> Meanwhile please look at
>
> https://github.com/scheme-requests-for-implementation/srfi-194/pull/30
I don't know what that test is trying to do.
For a unit sphere, the mean of N independent samples uniformly
distributed on the sphere is the vector (0. 0. ... 0.) and the variance
is N (the variance of one sample is 1, since (x_1-0)^2+...+(x_n-0)^2=1).
So it's likely that the sum of N samples will have an L_2 norm (the
square root of the sum of squares of the coordinates) < 3 sqrt(N) (about
997 times out of a thousand).
But the same is true, for example, if in two dimensions (so the
one-dimensional circle) (+1,0) is chosen randomly half the time and
(-1,0) is chosen the other half the time. Indeed, the same will be true
of any random distribution of points on the circle that are symmetric
about the origin, i.e., points for which the point -x is exactly as
likely to happen as the point x.
About SRFI 133: I've run the test programs with Chibi Scheme, and
things pass, as Chibi has all the "required" SRFIs. Perhaps it's
possible for you to use Chibi for testing.
Brad