next up previous contents index
Next: Measurement Functions Up: Plots, Vectors and Expressions Previous: Math Functions   Contents   Index


Statistical Functions

These functions generate random values, in accord with different statistical distribution properties. Each relies on the seed command to seed the internal random number generator which is common to all random sources. Each distribution is defined by one or two parameters. For distributions that take a single parameter, if passed a complex vector, the result will be a complex vector, using separately the distribution parameters in the real and imaginary parts. For distributions that require two parameters, the return vector is always real, and the complex vector given will supply the two parameters as the real and imaginary parts. If a real vector is given, a default value will be used for the second parameter.

Note that it is not likely that one would use different values for different indices of the given vector. If all indices have the same value, then the return would contain a number of samples from the same distribution, which is what is almost always needed.

Perhaps most of the time the functions will be called with scalar values. With these and other functions, bear in mind that the syntactic element expected as an argument is a ``single'' number, which can be real or complex. When complex, it has the form ``a, b'' which looks like two numbers. The take-away is that any of these functions can be called as func(a), or func(a, b) where a and b are scalars. The return depends on the function.

The user is expected to know the properties of these distributions and when to apply them. There is much information about these distributions available on-line, and in Knuth.

beta(vector)
The beta distribution is defined by two positive real values a and b. These are taken term by term as the real and imaginary parts of vector when complex. When real, the b will use the default value 1.0.

binomial(vector)
The binomial distribution is defined by a positive real value p and positive integer n. These are taken term by term as the real and imaginary parts of vector when complex. The imaginary value is truncated to form the integer. When vector is real, the n will use the default value 1.

chisq(vector)
The chi-square distribution is defined by a positive real degrees-of-freedom value. This is taken from vector term-by-term. If vector is real, the return is also real. If vector is complex, the return is also complex, with separate results for the real and imaginary parts, obtained using the real and imaginary parts of vector.

erlang(vector)
The Erlang distribution is defined by two positive real values k and mean. These are taken term by term as the real and imaginary parts of vector when complex. When real, the mean will use the default value 10.0. The return is a real vector of the same length as vector.

exponential(vector)
The exponential distribution is defined by a positive real mean value. This is taken from vector term-by-term. If vector is real, the return is also real. If vector is complex, the return is also complex, with separate results for the real and imaginary parts, obtained using the real and imaginary parts of vector.

ogauss(vector)
This function returns a real vector which contains normally distributed random values. The standard deviation and mean are set by the corresponding real and imaginary coefficients of vector term-by-term, and the mean is zero if vector is real.

poisson(vector)
The Poisson distribution is defined by a positive real mean value. This is taken from vector term-by-term. If vector is real, the return is also real. If vector is complex, the return is also complex, with separate results for the real and imaginary parts, obtained using the real and imaginary parts of vector.

rnd(vector)
This function returns a vector which contains uniformly distributed random values between 0 and the corresponding element of vector. If vector is complex then the return is also complex, with the real and imaginary values within the range set by the corresponding entries in vector.

tdist(vector)
The student's T distribution is defined by a positive real degrees-of-freedom value. This is taken from vector term-by-term. If vector is real, the return is also real. If vector is complex, the return is also complex, with separate results for the real and imaginary parts, obtained using the real and imaginary parts of vector.


next up previous contents index
Next: Measurement Functions Up: Plots, Vectors and Expressions Previous: Math Functions   Contents   Index
Stephen R. Whiteley 2024-10-26