Template:Random Number Generator Probability Density Functions

From SysCAD Documentation
Jump to navigation Jump to search

The random number generator used for all probability functions is from the C++ standard library (http://www.cplusplus.com/reference/random/).

The Probability Density functions used for the Noise generation are shown in the following table. In all cases the following convention is used:

[math]\displaystyle{ \mu }[/math] = Mean Value
[math]\displaystyle{ \sigma }[/math] = Standard Deviation

For all methods, the tag PlantModel.RandomSeedAtStart (set on the Plant Model - FlwSolve page) affects the repeatability of the random values generated. For the same seed value, a repeatable set of random numbers will be generated. For a different seed, a different set of random numbers will be generated. If "*" is used, then a new random set of values will be generated on every run.

Type Probability Density Function P(t) NOTES
Gaussian

[math]\displaystyle{ P(t) = \cfrac{1}{\sigma \sqrt{2\pi}}\cdot e^{\dfrac{-(t-\mu)^2}{2\sigma^2}} }[/math]

where [math]\displaystyle{ \sigma \gt 0 }[/math] Normal distribution: 68.27% of the numbers generated will be between [math]\displaystyle{ \mu-\sigma }[/math] and [math]\displaystyle{ \mu+\sigma }[/math] (see Wikipedia).
Flat

[math]\displaystyle{ P(t) = 0 }[/math]

where [math]\displaystyle{ t \lt \mu - m }[/math] or [math]\displaystyle{ t \gt \mu + m }[/math]

[math]\displaystyle{ P(t) = \dfrac{1}{2\sigma} }[/math]

where [math]\displaystyle{ \mu - m ≤ t ≤; \mu + m }[/math] and [math]\displaystyle{ m ≥; 0 }[/math] and [math]\displaystyle{ m }[/math] = maximum deviation

Poisson

[math]\displaystyle{ P(t) = \cfrac{\mu^t}{t!}\ e^{-\mu} }[/math]

where [math]\displaystyle{ e }[/math] = the base of the natural logarithm system (2.71828...) and [math]\displaystyle{ \mu \gt 0 }[/math]
Gamma

[math]\displaystyle{ P(t) = \cfrac{1}{\Gamma(\alpha)\ \beta^{\alpha}}\ t^{\alpha-1}\ e^{-t/\beta} }[/math]

where [math]\displaystyle{ \alpha ≥ 0.5 }[/math] and [math]\displaystyle{ \beta \gt 0 }[/math]

The Chi-squared distribution is a special case of the Gamma distribution
with [math]\displaystyle{ \alpha = n/2 }[/math] and [math]\displaystyle{ \beta = 2 }[/math], where [math]\displaystyle{ n }[/math] = degrees of freedom

Weibull

[math]\displaystyle{ P(t) = \alpha^{-\beta}\ \beta\ t^{\beta-1}\ e^{-(t/\alpha)^\beta} }[/math]

where [math]\displaystyle{ t = \alpha (-\ln(U))^{1/\beta} }[/math] and [math]\displaystyle{ \alpha ≥ 0.04 }[/math] and [math]\displaystyle{ \beta ≥ 0.01 }[/math]
[math]\displaystyle{ U }[/math] is a randomly generated number between 0 and 1

Bernoulli

[math]\displaystyle{ P(t) = p^{t}\ (1-p)^{1-t} }[/math]

where [math]\displaystyle{ 0 ≤ p ≤ 1 }[/math]

Binomial

[math]\displaystyle{ P(t) = \dbinom{n}{t} p^{t}\ (1-p)^{n-t} }[/math]

where [math]\displaystyle{ n }[/math] is a positive integer, [math]\displaystyle{ \dbinom{n}{t} = \cfrac{n!}{t!(n-t)!} }[/math] and [math]\displaystyle{ 0 \lt p ≤ 1 }[/math]

Geometric

[math]\displaystyle{ P(t) = p\ (1-p)^{t} }[/math]

where [math]\displaystyle{ 0 \lt p ≤ 1 }[/math]

Exponential

[math]\displaystyle{ P(t) = \mu\ e^{-\mu\ t} }[/math]

where [math]\displaystyle{ \mu \gt 0 }[/math]

Extreme Value

[math]\displaystyle{ P(t) = \cfrac{1}{\beta}\ z(t)\ e^{-z(t)} }[/math]

where [math]\displaystyle{ z(t) = e^{(\alpha-t)/\beta} }[/math] and [math]\displaystyle{ \beta \gt 0 }[/math]
Log Normal

[math]\displaystyle{ P(t) = \cfrac{1}{s\ t\ \sqrt{2\pi;}}\ e^{-(\ln t-m)^2/2s^2} }[/math]

where [math]\displaystyle{ 0 \lt s ≤ 50.70 }[/math]
Cauchy

[math]\displaystyle{ P(t) = \cfrac{1}{\pi;\ \beta\ \left [1+\left (\cfrac{t-\alpha}{\beta} \right )^2 \right ]} }[/math]

where [math]\displaystyle{ \beta \gt 0 }[/math]
Fisher F

[math]\displaystyle{ P(t) = \cfrac{\Gamma; \left (\cfrac{m+n}{2} \right )}{\Gamma;\left (\cfrac{m}{2}\right )\ \Gamma;\left (\cfrac{n}{2}\right )}\ \frac{\left (\cfrac{m\ t}{n} \right )^{(m/2)}}{t\ \left (1+\cfrac{m\ t}{n} \right )^{(m+n)/2}} }[/math]

where [math]\displaystyle{ 1 ≤ m ≤ 100 }[/math] and [math]\displaystyle{ n ≥ 1 }[/math]
Student t

[math]\displaystyle{ P(t) = \cfrac{1}{\sqrt{n\ \pi;}}\ \cfrac{\Gamma;\left (\cfrac{n+1}{2} \right )}{\Gamma;\left (\cfrac{n}{2} \right )}\ \left (1+\cfrac{t^2}{n} \right )^{-(n+1)/2} }[/math]

where [math]\displaystyle{ n ≥ 0.25 }[/math]

References

  1. Press W.H, Teukolsky S.A, Vetterling W.T, Flannery B.P Numerical Recipes in C (2nd Edition) Cambridge University Press 1992.
  2. Sanders D.H Statistics A Fresh Approach McGraw-Hill 1990.
  3. http://www.cplusplus.com/reference/random/ and related links describing each distribution.