📄 randist.texi
字号:
This function returns a random variate from the Landau distribution. Theprobability distribution for Landau random variates is definedanalytically by the complex integral,@tex\beforedisplay$$p(x) = {1 \over {2 \pi i}} \int_{c-i\infty}^{c+i\infty} ds\, \exp(s \log(s) + x s) $$\afterdisplay@end tex@ifinfo@examplep(x) = (1/(2 \pi i)) \int_@{c-i\infty@}^@{c+i\infty@} ds exp(s log(s) + x s) @end example@end ifinfoFor numerical purposes it is more convenient to use the followingequivalent form of the integral,@tex\beforedisplay$$p(x) = (1/\pi) \int_0^\infty dt \exp(-t \log(t) - x t) \sin(\pi t).$$\afterdisplay@end tex@ifinfo@examplep(x) = (1/\pi) \int_0^\infty dt \exp(-t \log(t) - x t) \sin(\pi t).@end example@end ifinfo@end deftypefn@deftypefun double gsl_ran_landau_pdf (double @var{x})This function computes the probability density @math{p(x)} at @var{x}for the Landau distribution using an approximation to the formula givenabove.@end deftypefun@sp 1@tex\centerline{\input rand-landau.tex}@end tex@page@node The Levy alpha-Stable Distributions@section The Levy alpha-Stable Distributions@deftypefn Random double gsl_ran_levy (const gsl_rng * @var{r}, double @var{c}, double @var{alpha})@cindex Levy distribution, random variatesThis function returns a random variate from the Levy symmetric stabledistribution with scale @var{c} and exponent @var{alpha}. The symmetricstable probability distribution is defined by a fourier transform,@tex\beforedisplay$$p(x) = {1 \over 2 \pi} \int_{-\infty}^{+\infty} dt \exp(-it x - |c t|^\alpha)$$\afterdisplay@end tex@ifinfo@examplep(x) = @{1 \over 2 \pi@} \int_@{-\infty@}^@{+\infty@} dt \exp(-it x - |c t|^alpha)@end example@end ifinfo@noindentThere is no explicit solution for the form of @math{p(x)} and thelibrary does not define a corresponding @code{pdf} function. For@math{\alpha = 1} the distribution reduces to the Cauchy distribution. For@math{\alpha = 2} it is a Gaussian distribution with @c{$\sigma = \sqrt{2} c$} @math{\sigma = \sqrt@{2@} c}. For @math{\alpha < 1} the tails of thedistribution become extremely wide.The algorithm only works for @c{$0 < \alpha \le 2$}@math{0 < alpha <= 2}.@end deftypefn@sp 1@tex\centerline{\input rand-levy.tex}@end tex@page@node The Levy skew alpha-Stable Distribution@section The Levy skew alpha-Stable Distribution@deftypefn Random double gsl_ran_levy_skew (const gsl_rng * @var{r}, double @var{c}, double @var{alpha}, double @var{beta})@cindex Levy distribution, random variatesThis function returns a random variate from the Levy skew stabledistribution with scale @var{c}, exponent @var{alpha} and skewnessparameter @var{beta}. The skewness parameter must lie in the range@math{[-1,1]}. The Levy skew stable probability distribution is definedby a fourier transform,@tex\beforedisplay$$p(x) = {1 \over 2 \pi} \int_{-\infty}^{+\infty} dt \exp(-it x - |c t|^\alpha (1-i \beta sign(t) \tan(\pi\alpha/2)))$$\afterdisplay@end tex@ifinfo@examplep(x) = @{1 \over 2 \pi@} \int_@{-\infty@}^@{+\infty@} dt \exp(-it x - |c t|^alpha (1-i beta sign(t) tan(pi alpha/2)))@end example@end ifinfo@noindentWhen @math{\alpha = 1} the term @math{\tan(\pi \alpha/2)} is replaced by@math{-(2/\pi)\log|t|}. There is no explicit solution for the form of@math{p(x)} and the library does not define a corresponding @code{pdf}function. For @math{\alpha = 2} the distribution reduces to a Gaussiandistribution with @c{$\sigma = \sqrt{2} c$} @math{\sigma = \sqrt@{2@} c} and the skewness parameter has no effect. For @math{\alpha < 1} the tails of the distribution become extremelywide. The symmetric distribution corresponds to @math{\beta =0}.The algorithm only works for @c{$0 < \alpha \le 2$}@math{0 < alpha <= 2}.@end deftypefnThe Levy alpha-stable distributions have the property that if @math{N}alpha-stable variates are drawn from the distribution @math{p(c, \alpha,\beta)} then the sum @math{Y = X_1 + X_2 + \dots + X_N} will also bedistributed as an alpha-stable variate,@c{$p(N^{1/\alpha} c, \alpha, \beta)$} @math{p(N^(1/\alpha) c, \alpha, \beta)}.@comment PDF not available because there is no analytic expression for it@comment@comment @deftypefun double gsl_ran_levy_pdf (double @var{x}, double @var{mu})@comment This function computes the probability density @math{p(x)} at @var{x}@comment for a symmetric Levy distribution with scale parameter @var{mu} and@comment exponent @var{a}, using the formula given above.@comment @end deftypefun@sp 1@tex\centerline{\input rand-levyskew.tex}@end tex@page@node The Gamma Distribution@section The Gamma Distribution@deftypefn Random double gsl_ran_gamma (const gsl_rng * @var{r}, double @var{a}, double @var{b})@cindex Gamma distribution random variatesThis function returns a random variate from the gammadistribution. The distribution function is,@tex\beforedisplay$$p(x) dx = {1 \over \Gamma(a) b^a} x^{a-1} e^{-x/b} dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{1 \over \Gamma(a) b^a@} x^@{a-1@} e^@{-x/b@} dx@end example@end ifinfo@noindentfor @math{x > 0}.@comment If @xmath{X} and @xmath{Y} are independent gamma-distributed random@comment variables of order @xmath{a} and @xmath{b}, then @xmath{X+Y} has a gamma@comment distribution of order @xmath{a+b}.@end deftypefn@deftypefun double gsl_ran_gamma_pdf (double @var{x}, double @var{a}, double @var{b})This function computes the probability density @math{p(x)} at @var{x}for a gamma distribution with parameters @var{a} and @var{b}, using theformula given above.@end deftypefun@sp 1@tex\centerline{\input rand-gamma.tex}@end tex@page@node The Flat (Uniform) Distribution@section The Flat (Uniform) Distribution@deftypefn Random double gsl_ran_flat (const gsl_rng * @var{r}, double @var{a}, double @var{b})@cindex flat distribution random variatesThis function returns a random variate from the flat (uniform)distribution from @var{a} to @var{b}. The distribution is,@tex\beforedisplay$$p(x) dx = {1 \over (b-a)} dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{1 \over (b-a)@} dx@end example@end ifinfo@noindentif @c{$a \le x < b$}@math{a <= x < b} and 0 otherwise.@end deftypefn@deftypefun double gsl_ran_flat_pdf (double @var{x}, double @var{a}, double @var{b})This function computes the probability density @math{p(x)} at @var{x}for a uniform distribution from @var{a} to @var{b}, using the formulagiven above.@end deftypefun@sp 1@tex\centerline{\input rand-flat.tex}@end tex@page@node The Lognormal Distribution@section The Lognormal Distribution@deftypefn Random double gsl_ran_lognormal (const gsl_rng * @var{r}, double @var{zeta}, double @var{sigma})@cindex Lognormal random variatesThis function returns a random variate from the lognormaldistribution. The distribution function is,@tex\beforedisplay$$p(x) dx = {1 \over x \sqrt{2 \pi \sigma^2}} \exp(-(\ln(x) - \zeta)^2/2 \sigma^2) dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{1 \over x \sqrt@{2 \pi \sigma^2@} @} \exp(-(\ln(x) - \zeta)^2/2 \sigma^2) dx@end example@end ifinfo@noindentfor @math{x > 0}.@end deftypefn@deftypefun double gsl_ran_lognormal_pdf (double @var{x}, double @var{zeta}, double @var{sigma})This function computes the probability density @math{p(x)} at @var{x}for a lognormal distribution with parameters @var{zeta} and @var{sigma},using the formula given above.@end deftypefun@sp 1@tex\centerline{\input rand-lognormal.tex}@end tex@page@node The Chi-squared Distribution@section The Chi-squared DistributionThe chi-squared distribution arises in statistics If @math{Y_i} are@math{n} independent gaussian random variates with unit variance then thesum-of-squares,@tex\beforedisplay$$X_i = \sum_i Y_i^2$$\afterdisplay@end tex@ifinfo@exampleX_i = \sum_i Y_i^2@end example@end ifinfo@noindenthas a chi-squared distribution with @math{n} degrees of freedom.@deftypefn Random double gsl_ran_chisq (const gsl_rng * @var{r}, double @var{nu})@cindex Chi-squared random variatesThis function returns a random variate from the chi-squared distributionwith @var{nu} degrees of freedom. The distribution function is,@tex\beforedisplay$$p(x) dx = {1 \over \Gamma(\nu/2) } (x/2)^{\nu/2 - 1} \exp(-x/2) dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{1 \over \Gamma(\nu/2) @} (x/2)^@{\nu/2 - 1@} \exp(-x/2) dx@end example@end ifinfo@noindentfor @c{$x \ge 0$}@math{x >= 0}. @end deftypefn@deftypefun double gsl_ran_chisq_pdf (double @var{x}, double @var{nu})This function computes the probability density @math{p(x)} at @var{x}for a chi-squared distribution with @var{nu} degrees of freedom, usingthe formula given above.@end deftypefun@sp 1@tex\centerline{\input rand-chisq.tex}@end tex@page@node The F-distribution@section The F-distributionThe F-distribution arises in statistics. If @math{Y_1} and @math{Y_2}are chi-squared deviates with @math{\nu_1} and @math{\nu_2} degrees offreedom then the ratio,@tex\beforedisplay$$X = { (Y_1 / \nu_1) \over (Y_2 / \nu_2) }$$\afterdisplay@end tex@ifinfo@exampleX = @{ (Y_1 / \nu_1) \over (Y_2 / \nu_2) @}@end example@end ifinfo@noindenthas an F-distribution @math{F(x;\nu_1,\nu_2)}.@deftypefn Random double gsl_ran_fdist (const gsl_rng * @var{r}, double @var{nu1}, double @var{nu2})@cindex F-distribution random variatesThis function returns a random variate from the F-distribution with degrees of freedom @var{nu1} and @var{nu2}. The distribution function is,@tex\beforedisplay$$p(x) dx = { \Gamma((\nu_1 + \nu_2)/2) \over \Gamma(\nu_1/2) \Gamma(\nu_2/2) } \nu_1^{\nu_1/2} \nu_2^{\nu_2/2} x^{\nu_1/2 - 1} (\nu_2 + \nu_1 x)^{-\nu_1/2 -\nu_2/2}$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{ \Gamma((\nu_1 + \nu_2)/2) \over \Gamma(\nu_1/2) \Gamma(\nu_2/2) @} \nu_1^@{\nu_1/2@} \nu_2^@{\nu_2/2@} x^@{\nu_1/2 - 1@} (\nu_2 + \nu_1 x)^@{-\nu_1/2 -\nu_2/2@}@end example@end ifinfo@noindentfor @c{$x \ge 0$}@math{x >= 0}. @end deftypefn@deftypefun double gsl_ran_fdist_pdf (double @var{x}, double @var{nu1}, double @var{nu2})This function computes the probability density @math{p(x)} at @var{x}for an F-distribution with @var{nu1} and @var{nu2} degrees of freedom,using the formula given above.@end deftypefun@sp 1@tex\centerline{\input rand-fdist.tex}@end tex@page@node The t-distribution@section The t-distributionThe t-distribution arises in statistics. If @math{Y_1} has a normaldistribution and @math{Y_2} has a chi-squared distribution with@math{\nu} degrees of freedom then the ratio,@tex\beforedisplay$$X = { Y_1 \over \sqrt{Y_2 / \nu} }$$\afterdisplay@end tex@ifinfo@exampleX = @{ Y_1 \over \sqrt@{Y_2 / \nu@} @}@end example@end ifinfo@noindenthas a t-distribution @math{t(x;\nu)} with @math{\nu} degrees of freedom.@deftypefn Random double gsl_ran_tdist (const gsl_rng * @var{r}, double @var{nu})@cindex t-distribution random variatesThis function returns a random variate from the t-distribution. Thedistribution function is,@tex\beforedisplay$$p(x) dx = {\Gamma((\nu + 1)/2) \over \sqrt{\pi \nu} \Gamma(\nu/2)} (1 + x^2/\nu)^{-(\nu + 1)/2} dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{\Gamma((\nu + 1)/2) \over \sqrt@{\pi \nu@} \Gamma(\nu/2)@} (1 + x^2/\nu)^@{-(\nu + 1)/2@} dx@end example@end ifinfo@noindentfor @math{-\infty < x < +\infty}.@end deftypefn@deftypefun double gsl_ran_tdist_pdf (double @var{x}, double @var{nu})This function computes the probability density @math{p(x)} at @var{x}for a t-distribution with @var{nu} degrees of freedom, using the formulagiven above.@end deftypefun@sp 1@tex\centerline{\input rand-tdist.tex}@end tex@page@node The Beta Distribution@section The Beta Distribution@deftypefn Random double gsl_ran_beta (const gsl_rng * @var{r}, double @var{a}, double @var{b})@cindex Beta distribution random variatesThis function returns a random variate from the betadistribution. The distribution function is,@tex\beforedisplay$$p(x) dx = {\Gamma(a+b) \over \Gamma(a) \Gamma(b)} x^{a-1} (1-x)^{b-1} dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{\Gamma(a+b) \over \Gamma(a) \Gamma(b)@} x^@{a-1@} (1-x)^@{b-1@} dx@end example@end ifinfo@noindent
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -