By downloading this code you agree to the
Source Code Use License (PDF). |
{version = 3.17; (* of normal.p 1994 sep 5}
(* begin module describe.normal *)
(*
name
normal: generate normally distributed random numbers
synopsis
normal(normalp:in, data: out, output: out)
files
normalp: parameter file controlling the program.
Two numbers, one per line:
seed: random seed to start the process
total: the number of numbers to generate
data: This is a set of numbers which should have Gaussian distribution
if the random number generator is a reasonable one.
It will be N(0,1), a normal distribution
with mean 0 and standard deviation 1.
genhisp: control file for the genhis histogram plotting program.
output: messages to the user
description
Test of a random number generator by creating a gaussian
distribution of numbers for plotting by genhis.
Method: if U is a member of the set [0..1] and Un and Un+1
are two members, then define
theta = Un 2 pi
r = sqrt(-2 ln(Un+1))
then when these polar coordinates are converted to Cartesian
coordinates, one gets two independent Normally distributed numbers,
with mean 0 and standard deviation 1. To get other standard deviations
multiply by a constant, and to get other means, add a constant.
The proof was from a friend; I only have sketch notes at the moment.
I'm sure it is available in standard texts. However, it works,
as shown by the example.
example
seed := 0.5;
total := 10000;
The mean was 0.00 (to two places) and the standard deviation was 1.01.
see also
gentst.p, tstrnd.p, genhis.p
author
Tom Schneider
Frederick, Maryland
toms@alum.mit.edu
bugs
none known
*)
(* end module describe.normal *)
{This manual page was created by makman 1.45}
{created by htmlink 1.62}