Quote:
Originally Posted by Ether
Using symmetry for the chords problem, you can reduce the length computation to:
Code:
sum += sin(pi*abs(random-random));
... and when the iterations are complete, multiply the sum by 2.
|
Because sin(x) is symmetric around pi/2, you can further optimize this to:
Code:
sum += sin(pi_2*random);
where pi_2 is pi/2. As before, when the iterations are complete, multiply the sum by 2.
Also, as no one has attempted a closed form solution for these averages, I'm attaching the solutions. I have solved all of the circle and sphere problems for both the mean length and the mean square length. As such, these results can be used to solve for the variance or standard deviation of the population, by calling that:
- variance of the population is the mean of the squares minus the square of the mean
- standard deviation of the population is the square root of the variance of the population