# [MATRIX-SIG] random.gauss isn't Gaussian

**Christian Tismer
**
tismer@appliedbiometrics.com

*Fri, 30 Jan 1998 20:13:55 +0100*

>* I've been doing some monte carlo studies with python (monte
*>* python calculations actually) and have found rather weird
*>* distributions when using random.gauss. Contrary to what the
*>* docs say, it does not generate a normal distribution.
*
I did not check this one, but...
>* In addition, while looking into this, I found that the
*>* test_generator function in random.py calculates standard
*>* deviations as sqrt( Sum[ x*x ]/n - mean*mean ), which is
*>* somewhat different from what I think of as the usual
*>* definition - sqrt(Sum[ ( x - mean )^2 / N ]).
*>*
*>* Is this all intentional? Or is it a bug?
*
The last one is definately no bug, but the formulas are equivalent
what can be seen by two lines of transformations. For computational
exactnes, the Python version might have slight advantages over
the usual" one, since there is only a single subtraction. Having
many mixed operations could worsen the result, especially for
very skewed distributions (where the sdev makes no sense at all, btw).
cheers - pirx
--
Christian Tismer :^) <mailto:tismer@appliedbiometrics.com>
Applied Biometrics GmbH : Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101 : *Starship* http://starship.skyport.net
10553 Berlin : PGP key -> http://pgpkeys.mit.edu
we're tired of banana software - shipped green, ripens at home
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________