[Tutor] Normal distribution random numbers?
Deirdre Saoirse Moen
deirdre@deirdre.net
Wed, 20 Jun 2001 11:09:44 -0700
At 7:48 PM +0200 6/20/01, Remco Gerlich wrote:
>*scratch head*. As far as I can see, you'd need the distribution function
>for this, not the density function. And although the density function is
>well known, the distribution (which is the density function, integrated - my
>english vocabulary isn't perfect in this area) isn't directly know, afaik.
That's what I thought. Worse, my calculus is really limited to simple
derivatives and integrals and not up to that par.
>That is, if you have a bell curve thingy, the uniform number 0.9 would
>correspond to the point where the area under the bell curve to the left of
>the point would be 90% of the total. So you need to integrate the function,
>and that is hard.
Right, that's what they call the cdf (cumulative distribution function).
>All the explanations I can find seem to support this, they all ignore the
>problem and point to a table. (I'm looking mainly at
>http://davidmlane.com/hyperstat/normal_distribution.html ). I'm very rusty
>with this subject, but I think the only way is to build a table.
>You need the sums of tiny approximations to the area under the bell curve.
>
>Before I try to write some Python, what do you need this for? What kind of
>accuracy? Do I sound like I'm making sense?
Well, I'm working on the last bit of a final exam that has questions like:
"Consider the assembly of two steel plates, each plate having a hole
drilled in its center. The plates are to be joined by a pin. The
plates are aligned for assembly relative to the bottom left corner
(0, 0).
The hole placement is centered at (3, 2) on each plate. The standard
deviation in each direction is 0.0045.
The hole diameter is normally distributed with a mean of 0.3 and a
standard deviation of 0.005.
The pin diameter is also distributed normally with a mean of 0.29 and
a standard deviation of 0.004.
What fraction of pins will go through the assempled plates? Base your
answer on a simulation of 50 observations."
(don't worry, I'll solve it myself, I was just stumped by needing
random numbers normally distributed)
>Hmm, there are functions in the random module :)
>*read source* (you can also generate normally distributed numbers directly)
Doh!
Thanks -- that just solved my problem.
--
_Deirdre Stash-o-Matic: http://weirdre.com http://deirdre.net
"Cannot run out of time.... Is infinite time. You... are finite....
Zathrus... is finite. This... is wrong tool!" -- Zathrus