Probability Distributions

In this experiment, we can simulate the occurrence of random events which can have one of several distributions:
  • An arbitrary distribution, whose values and probabilities are user specified.
  • A Gaussian (or Normal) distribution with a specified mean and standard deviation.
  • A uniform (or flat) distribution, with events equally likely to occur anywhere within the interval from 0 to 1.
Any of these distributions can be assigned to the random variables x, y, or z.

After the random variables x,y,z are defined, a new random variable w(x,y,z) can be formulated.

Rules for forming expressions for w:

  • Operators are: +, -, *, /
  • No more than a single operator may appear within a pair of parentheses
  • Constants may appear within the expression
  • Every time a random variable appears in an expression, a new realization of that variable is obtained.  So, if w = x+x, then w is the sum of two realizations of a random variable whose characteristics are defined as x.
  • Several functions are available
    • pow(x,n)--a single realization of x multiplied by itself n times
    • sum(x,n)--n realizations of x added together
    • exp(x)--the exponential function, e to the xth power
    • sin(a)--where a is an expression in degrees which may involve random variables
    • cos(a)--where a is an expression in degrees which may involve random variables
    • tan(a)--where a is an expression in degrees which may involve random variables
This allows the user to express the following sort of problem:
    If the sides of a box are measured as 20, 30, and 40 centimeters, respectively, where each measurement could have a Gaussian-distributed error of mean 0.0 and standard deviation of 1.0, what would be the distribution of calculated volumes?

    In this problem x would be assigned a Gaussian distribution with mean 0.0 and standard deviation 1.0. Then, the volume w would be expressed as w = ((20+x)*(30+x))*(40+x). Then one can display the distribution of w over, say, 10000 realizations.

Another example:

    What is the distribution of values for the sum of three thrown dice?

    Define x as an arbitrary distribution with Pr(x) = 1,1,1,1,1,1 (i.e., each face equally likely), and with the values of x = 1,2,3,4,5,6 (the values of the six sides). Then the sum of three thrown dice can be expressed as w = (x+x)+x, or w = sum(x,3)

Generate some probability distributions.