-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Factor of 2? #6
Comments
Yes. The Box-Muller transformation does mean that: Line 130 in e891a2a
should read
This example of summing samples of Gaussian(0,1) produces approximately mean(0), var=0.5:
produces this output:
See this for a simulation For Gaussian(0,10) the results are mean=0, var = 50:
The input spread parameter appears to be sigma rather than variance.
|
Looking at it further, the line https://github.com/ivanseidel/Gaussian/blob/master/Gaussian.h#L130 should be:
|
Hi - is is possible that this equation should be modified as noted below?
// return mean + variance * cos( 2 * M_PI * R1) * sqrt(-log(R2));
return mean + variance * cos( 2 * M_PI * R1) * sqrt(-2*log(R2));
This appears to be the Box-Muller Transformation, and thus I think there needs to be a 2 inside the sqrt.
thx
The text was updated successfully, but these errors were encountered: