next up previous

Exercise 2: Explore these concepts using Cray's Random Number Generator.

Here, we shall use the Cray random number generator, ranf(), to perform emissions according to Figure 10 and Equations (23) and (24). We will do this by generating vectors (in the computer sense) of random numbers---one vector for and one vector for . Using these, we'll generate one vector of values and one other vector of values. As we generate ``many'' emissions, we should expect the distribution of emissions to approach: (1) a uniform distribution in and (2) in . First, generate 10,000 emissions (requiring 20,000 random numbers - 10,000 to obtain the 10,000 values of , and another 10,000 to obtain the 10,000 values of ). Partition these emissions into groups of N = 10, 100, 1,000 and 10,000 (you can do this by referencing the first 10, 100, ... elements in your and arrays).

(a) Consider the distribution function for . Partition the domain into 36 intervals (bins) of each (--, --, ...). For each N, plot the function of emissions which fall into the bins vs. the bin centerpoint (i.e., plot vs. , , ...). Comment on the ``convergence'' of the distributions.

(b) Now perform a similar test for . Divide into 9 bins of each, with , , .... Plot vs. for all 5 N's. Comment on the ``convergence'' here, too.


1. The exact answers are:



2. Do the above calculations as efficiently as possible (if on the Cray, use hpm to assess MFLOP's).

Hand in: (1) your program, (2) the plots, and (3) discussions.