.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Math::GSL::Randist 3pm" .TH Math::GSL::Randist 3pm "2019-02-23" "perl v5.28.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Math::GSL::Randist \- Probability Distributions .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& use Math::GSL::RNG; \& use Math::GSL::Randist qw/:all/; \& \& my $rng = Math::GSL::RNG\->new(); \& my $coinflip = gsl_ran_bernoulli($rng\->raw(), .5); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Here is a list of all the functions included in this module. For all sampling methods, the first argument \f(CW$r\fR is a raw gsl_rnd structure retrieve by calling \fBraw()\fR on an Math::GSL::RNG object. .SS "Bernoulli" .IX Subsection "Bernoulli" .ie n .IP "gsl_ran_bernoulli($r, $p)" 4 .el .IP "gsl_ran_bernoulli($r, \f(CW$p\fR)" 4 .IX Item "gsl_ran_bernoulli($r, $p)" This function returns either 0 or 1, the result of a Bernoulli trial with probability \f(CW$p\fR. The probability distribution for a Bernoulli trial is, p(0) = 1 \- \f(CW$p\fR and p(1) = \f(CW$p\fR. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_bernoulli_pdf($k, $p)" 4 .el .IP "gsl_ran_bernoulli_pdf($k, \f(CW$p\fR)" 4 .IX Item "gsl_ran_bernoulli_pdf($k, $p)" This function computes the probability p($k) of obtaining \f(CW$k\fR from a Bernoulli distribution with probability parameter \f(CW$p\fR, using the formula given above. .SS "Beta" .IX Subsection "Beta" .ie n .IP "gsl_ran_beta($r, $a, $b)" 4 .el .IP "gsl_ran_beta($r, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_beta($r, $a, $b)" This function returns a random variate from the beta distribution. The distribution function is, p($x) dx = {Gamma($a+$b) \e Gamma($a) Gamma($b)} \f(CW$x\fR**{$a\-1} (1\-$x)**{$b\-1} dx for 0 <= \f(CW$x\fR <= 1.$r is a gsl_rng structure. .ie n .IP "gsl_ran_beta_pdf($x, $a, $b)" 4 .el .IP "gsl_ran_beta_pdf($x, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_beta_pdf($x, $a, $b)" This function computes the probability density p($x) at \f(CW$x\fR for a beta distribution with parameters \f(CW$a\fR and \f(CW$b\fR, using the formula given above. .SS "Binomial" .IX Subsection "Binomial" .ie n .IP "gsl_ran_binomial($k, $p, $n)" 4 .el .IP "gsl_ran_binomial($k, \f(CW$p\fR, \f(CW$n\fR)" 4 .IX Item "gsl_ran_binomial($k, $p, $n)" This function returns a random integer from the binomial distribution, the number of successes in n independent trials with probability \f(CW$p\fR. The probability distribution for binomial variates is p($k) = {$n! \e \f(CW$k\fR! ($n\-$k)! } \f(CW$p\fR**$k (1\-$p)^{$n\-$k} for 0 <= \f(CW$k\fR <= \f(CW$n\fR. Uses Binomial Triangle Parallelogram Exponential algorithm. .ie n .IP "gsl_ran_binomial_knuth($k, $p, $n)" 4 .el .IP "gsl_ran_binomial_knuth($k, \f(CW$p\fR, \f(CW$n\fR)" 4 .IX Item "gsl_ran_binomial_knuth($k, $p, $n)" Alternative and original implementation for gsl_ran_binomial using Knuth's algorithm. .ie n .IP "gsl_ran_binomial_tpe($k, $p, $n)" 4 .el .IP "gsl_ran_binomial_tpe($k, \f(CW$p\fR, \f(CW$n\fR)" 4 .IX Item "gsl_ran_binomial_tpe($k, $p, $n)" Same as gsl_ran_binomial. .ie n .IP "gsl_ran_binomial_pdf($k, $p, $n)" 4 .el .IP "gsl_ran_binomial_pdf($k, \f(CW$p\fR, \f(CW$n\fR)" 4 .IX Item "gsl_ran_binomial_pdf($k, $p, $n)" This function computes the probability p($k) of obtaining \f(CW$k\fR from a binomial distribution with parameters \f(CW$p\fR and \f(CW$n\fR, using the formula given above. .SS "Exponential" .IX Subsection "Exponential" .ie n .IP "gsl_ran_exponential($r, $mu)" 4 .el .IP "gsl_ran_exponential($r, \f(CW$mu\fR)" 4 .IX Item "gsl_ran_exponential($r, $mu)" This function returns a random variate from the exponential distribution with mean \f(CW$mu\fR. The distribution is, p($x) dx = {1 \e \f(CW$mu\fR} exp(\-$x/$mu) dx for \f(CW$x\fR >= 0. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_exponential_pdf($x, $mu)" 4 .el .IP "gsl_ran_exponential_pdf($x, \f(CW$mu\fR)" 4 .IX Item "gsl_ran_exponential_pdf($x, $mu)" This function computes the probability density p($x) at \f(CW$x\fR for an exponential distribution with mean \f(CW$mu\fR, using the formula given above. .SS "Exponential Power" .IX Subsection "Exponential Power" .ie n .IP "gsl_ran_exppow($r, $a, $b)" 4 .el .IP "gsl_ran_exppow($r, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_exppow($r, $a, $b)" This function returns a random variate from the exponential power distribution with scale parameter \f(CW$a\fR and exponent \f(CW$b\fR. The distribution is, p(x) dx = {1 / 2 \f(CW$a\fR Gamma(1+1/$b)} exp(\-|$x/$a|**$b) dx for \f(CW$x\fR >= 0. For \f(CW$b\fR = 1 this reduces to the Laplace distribution. For \f(CW$b\fR = 2 it has the same form as a gaussian distribution, but with \f(CW$a\fR = \fBsqrt\fR\|(2) sigma. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_exppow_pdf($x, $a, $b)" 4 .el .IP "gsl_ran_exppow_pdf($x, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_exppow_pdf($x, $a, $b)" This function computes the probability density p($x) at \f(CW$x\fR for an exponential power distribution with scale parameter \f(CW$a\fR and exponent \f(CW$b\fR, using the formula given above. .SS "Cauchy" .IX Subsection "Cauchy" .ie n .IP "gsl_ran_cauchy($r, $scale)" 4 .el .IP "gsl_ran_cauchy($r, \f(CW$scale\fR)" 4 .IX Item "gsl_ran_cauchy($r, $scale)" This function returns a random variate from the Cauchy distribution with \&\f(CW$scale\fR. The probability distribution for Cauchy random variates is, .Sp .Vb 1 \& p(x) dx = {1 / $scale pi (1 + (x/$$scale)**2) } dx .Ve .Sp for x in the range \-infinity to +infinity. The Cauchy distribution is also known as the Lorentz distribution. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_cauchy_pdf($x, $scale)" 4 .el .IP "gsl_ran_cauchy_pdf($x, \f(CW$scale\fR)" 4 .IX Item "gsl_ran_cauchy_pdf($x, $scale)" This function computes the probability density p($x) at \f(CW$x\fR for a Cauchy distribution with \f(CW$scale\fR, using the formula given above. .SS "Chi-Squared" .IX Subsection "Chi-Squared" .ie n .IP "gsl_ran_chisq($r, $nu)" 4 .el .IP "gsl_ran_chisq($r, \f(CW$nu\fR)" 4 .IX Item "gsl_ran_chisq($r, $nu)" This function returns a random variate from the chi-squared distribution with \f(CW$nu\fR degrees of freedom. The distribution function is, p(x) dx = {1 / 2 Gamma($nu/2) } (x/2)**{$nu/2 \- 1} exp(\-x/2) dx for \f(CW$x\fR >= 0. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_chisq_pdf($x, $nu)" 4 .el .IP "gsl_ran_chisq_pdf($x, \f(CW$nu\fR)" 4 .IX Item "gsl_ran_chisq_pdf($x, $nu)" This function computes the probability density p($x) at \f(CW$x\fR for a chi-squared distribution with \f(CW$nu\fR degrees of freedom, using the formula given above. .SS "Dirichlet" .IX Subsection "Dirichlet" .ie n .IP "gsl_ran_dirichlet($r, $alpha)" 4 .el .IP "gsl_ran_dirichlet($r, \f(CW$alpha\fR)" 4 .IX Item "gsl_ran_dirichlet($r, $alpha)" This function returns an array of K (where K = length of \f(CW$alpha\fR array) random variates from a Dirichlet distribution of order K\-1. The distribution function is .Sp .Vb 2 \& p(\etheta_1, ..., \etheta_K) d\etheta_1 ... d\etheta_K = \& (1/Z) \eprod_{i=1}^K \etheta_i^{\ealpha_i \- 1} \edelta(1 \-\esum_{i=1}^K \etheta_i) d\etheta_1 ... d\etheta_K .Ve .Sp for theta_i >= 0 and alpha_i > 0. The delta function ensures that \esum \etheta_i = 1. The normalization factor Z is .Sp .Vb 1 \& Z = {\eprod_{i=1}^K \eGamma(\ealpha_i)} / {\eGamma( \esum_{i=1}^K \ealpha_i)} .Ve .Sp The random variates are generated by sampling K values from gamma distributions with parameters a=alpha_i, b=1, and renormalizing. See A.M. Law, W.D. Kelton, Simulation Modeling and Analysis (1991). .ie n .IP "gsl_ran_dirichlet_pdf($theta, $alpha)" 4 .el .IP "gsl_ran_dirichlet_pdf($theta, \f(CW$alpha\fR)" 4 .IX Item "gsl_ran_dirichlet_pdf($theta, $alpha)" This function computes the probability density p(\etheta_1, ... , \etheta_K) at theta[K] for a Dirichlet distribution with parameters alpha[K], using the formula given above. \f(CW$alpha\fR and \f(CW$theta\fR should be array references of the same size. Theta should be normalized to sum to 1. .ie n .IP "gsl_ran_dirichlet_lnpdf($theta, $alpha)" 4 .el .IP "gsl_ran_dirichlet_lnpdf($theta, \f(CW$alpha\fR)" 4 .IX Item "gsl_ran_dirichlet_lnpdf($theta, $alpha)" This function computes the logarithm of the probability density p(\etheta_1, ... , \etheta_K) for a Dirichlet distribution with parameters alpha[K]. \f(CW$alpha\fR and \&\f(CW$theta\fR should be array references of the same size. Theta should be normalized to sum to 1. .SS "Erlang" .IX Subsection "Erlang" .ie n .IP "gsl_ran_erlang($r, $scale, $shape)" 4 .el .IP "gsl_ran_erlang($r, \f(CW$scale\fR, \f(CW$shape\fR)" 4 .IX Item "gsl_ran_erlang($r, $scale, $shape)" Equivalent to gsl_ran_gamma($r, \f(CW$shape\fR, \f(CW$scale\fR) where \f(CW$shape\fR is an integer. .IP "gsl_ran_erlang_pdf" 4 .IX Item "gsl_ran_erlang_pdf" Equivalent to gsl_ran_gamma_pdf($r, \f(CW$shape\fR, \f(CW$scale\fR) where \f(CW$shape\fR is an integer. .SS "F\-distribution" .IX Subsection "F-distribution" .ie n .IP "gsl_ran_fdist($r, $nu1, $nu2)" 4 .el .IP "gsl_ran_fdist($r, \f(CW$nu1\fR, \f(CW$nu2\fR)" 4 .IX Item "gsl_ran_fdist($r, $nu1, $nu2)" This function returns a random variate from the F\-distribution with degrees of freedom nu1 and nu2. The distribution function is, p(x) dx = { Gamma(($nu_1 + \f(CW$nu_2\fR)/2) / Gamma($nu_1/2) Gamma($nu_2/2) } \f(CW$nu_1\fR**{$nu_1/2} \f(CW$nu_2\fR**{$nu_2/2} x**{$nu_1/2 \- 1} ($nu_2 + \f(CW$nu_1\fR x)**{\-$nu_1/2 \-$nu_2/2} for \f(CW$x\fR >= 0. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_fdist_pdf($x, $nu1, $nu2)" 4 .el .IP "gsl_ran_fdist_pdf($x, \f(CW$nu1\fR, \f(CW$nu2\fR)" 4 .IX Item "gsl_ran_fdist_pdf($x, $nu1, $nu2)" This function computes the probability density p(x) at x for an F\-distribution with nu1 and nu2 degrees of freedom, using the formula given above. .SS "Uniform/Flat distribution" .IX Subsection "Uniform/Flat distribution" .ie n .IP "gsl_ran_flat($r, $a, $b)" 4 .el .IP "gsl_ran_flat($r, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_flat($r, $a, $b)" This function returns a random variate from the flat (uniform) distribution from a to b. The distribution is, p(x) dx = {1 / ($b\-$a)} dx if \f(CW$a\fR <= x < \f(CW$b\fR and 0 otherwise. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_flat_pdf($x, $a, $b)" 4 .el .IP "gsl_ran_flat_pdf($x, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_flat_pdf($x, $a, $b)" This function computes the probability density p($x) at \f(CW$x\fR for a uniform distribution from \f(CW$a\fR to \f(CW$b\fR, using the formula given above. .SS "Gamma" .IX Subsection "Gamma" .ie n .IP "gsl_ran_gamma($r, $shape, $scale)" 4 .el .IP "gsl_ran_gamma($r, \f(CW$shape\fR, \f(CW$scale\fR)" 4 .IX Item "gsl_ran_gamma($r, $shape, $scale)" This function returns a random variate from the gamma distribution. The distribution function is, p(x) dx = {1 \eover \eGamma($shape) \f(CW$scale\fR^$shape} x^{$shape\-1} e^{\-x/$scale} dx for x > 0. Uses Marsaglia-Tsang method. Can also be called as gsl_ran_gamma_mt. .ie n .IP "gsl_ran_gamma_pdf($x, $shape, $scale)" 4 .el .IP "gsl_ran_gamma_pdf($x, \f(CW$shape\fR, \f(CW$scale\fR)" 4 .IX Item "gsl_ran_gamma_pdf($x, $shape, $scale)" This function computes the probability density p($x) at \f(CW$x\fR for a gamma distribution with parameters \f(CW$shape\fR and \f(CW$scale\fR, using the formula given above. .ie n .IP "gsl_ran_gamma($r, $shape, $scale)" 4 .el .IP "gsl_ran_gamma($r, \f(CW$shape\fR, \f(CW$scale\fR)" 4 .IX Item "gsl_ran_gamma($r, $shape, $scale)" Same as gsl_ran_gamma. .ie n .IP "gsl_ran_gamma_knuth($r, $shape, $scale)" 4 .el .IP "gsl_ran_gamma_knuth($r, \f(CW$shape\fR, \f(CW$scale\fR)" 4 .IX Item "gsl_ran_gamma_knuth($r, $shape, $scale)" Alternative implementation for gsl_ran_gamma, using algorithm in Knuth volume 2. .SS "Gaussian/Normal" .IX Subsection "Gaussian/Normal" .ie n .IP "gsl_ran_gaussian($r, $sigma)" 4 .el .IP "gsl_ran_gaussian($r, \f(CW$sigma\fR)" 4 .IX Item "gsl_ran_gaussian($r, $sigma)" This function returns a Gaussian random variate, with mean zero and standard deviation \f(CW$sigma\fR. The probability distribution for Gaussian random variates is, p(x) dx = {1 / sqrt{2 pi \f(CW$sigma\fR**2}} exp(\-x**2 / 2 \f(CW$sigma\fR**2) dx for x in the range \-infinity to +infinity. \f(CW$r\fR is a gsl_rng structure. Uses Box-Mueller (polar) method. .ie n .IP "gsl_ran_gaussian_ratio_method($r, $sigma)" 4 .el .IP "gsl_ran_gaussian_ratio_method($r, \f(CW$sigma\fR)" 4 .IX Item "gsl_ran_gaussian_ratio_method($r, $sigma)" This function computes a Gaussian random variate using the alternative Kinderman-Monahan-Leva ratio method. .ie n .IP "gsl_ran_gaussian_ziggurat($r, $sigma)" 4 .el .IP "gsl_ran_gaussian_ziggurat($r, \f(CW$sigma\fR)" 4 .IX Item "gsl_ran_gaussian_ziggurat($r, $sigma)" This function computes a Gaussian random variate using the alternative Marsaglia-Tsang ziggurat ratio method. The Ziggurat algorithm is the fastest available algorithm in most cases. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_gaussian_pdf($x, $sigma)" 4 .el .IP "gsl_ran_gaussian_pdf($x, \f(CW$sigma\fR)" 4 .IX Item "gsl_ran_gaussian_pdf($x, $sigma)" This function computes the probability density p($x) at \f(CW$x\fR for a Gaussian distribution with standard deviation sigma, using the formula given above. .IP "gsl_ran_ugaussian($r)" 4 .IX Item "gsl_ran_ugaussian($r)" .PD 0 .IP "gsl_ran_ugaussian_ratio_method($r)" 4 .IX Item "gsl_ran_ugaussian_ratio_method($r)" .IP "gsl_ran_ugaussian_pdf($x)" 4 .IX Item "gsl_ran_ugaussian_pdf($x)" .PD This function computes results for the unit Gaussian distribution. It is equivalent to the gaussian functions above with a standard deviation of one, sigma = 1. .ie n .IP "gsl_ran_bivariate_gaussian($r, $sigma_x, $sigma_y, $rho)" 4 .el .IP "gsl_ran_bivariate_gaussian($r, \f(CW$sigma_x\fR, \f(CW$sigma_y\fR, \f(CW$rho\fR)" 4 .IX Item "gsl_ran_bivariate_gaussian($r, $sigma_x, $sigma_y, $rho)" This function generates a pair of correlated Gaussian variates, with mean zero, correlation coefficient rho and standard deviations \f(CW$sigma_x\fR and \f(CW$sigma_y\fR in the x and y directions. The first value returned is x and the second y. The probability distribution for bivariate Gaussian random variates is, p(x,y) dx dy = {1 / 2 pi \f(CW$sigma_x\fR \f(CW$sigma_y\fR sqrt{1\-$rho**2}} exp (\-(x**2/$sigma_x**2 + y**2/$sigma_y**2 \- 2 \f(CW$rho\fR x y/($sigma_x \f(CW$sigma_y\fR))/2(1\- \f(CW$rho\fR**2)) dx dy for x,y in the range \-infinity to +infinity. The correlation coefficient \f(CW$rho\fR should lie between 1 and \-1. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_bivariate_gaussian_pdf($x, $y, $sigma_x, $sigma_y, $rho)" 4 .el .IP "gsl_ran_bivariate_gaussian_pdf($x, \f(CW$y\fR, \f(CW$sigma_x\fR, \f(CW$sigma_y\fR, \f(CW$rho\fR)" 4 .IX Item "gsl_ran_bivariate_gaussian_pdf($x, $y, $sigma_x, $sigma_y, $rho)" This function computes the probability density p($x,$y) at ($x,$y) for a bivariate Gaussian distribution with standard deviations \f(CW$sigma_x\fR, \f(CW$sigma_y\fR and correlation coefficient \f(CW$rho\fR, using the formula given above. .SS "Gaussian Tail" .IX Subsection "Gaussian Tail" .ie n .IP "gsl_ran_gaussian_tail($r, $a, $sigma)" 4 .el .IP "gsl_ran_gaussian_tail($r, \f(CW$a\fR, \f(CW$sigma\fR)" 4 .IX Item "gsl_ran_gaussian_tail($r, $a, $sigma)" This function provides random variates from the upper tail of a Gaussian distribution with standard deviation sigma. The values returned are larger than the lower limit a, which must be positive. The probability distribution for Gaussian tail random variates is, p(x) dx = {1 / N($a; \f(CW$sigma\fR) sqrt{2 pi sigma**2}} exp(\- x**2/(2 sigma**2)) dx for x > \f(CW$a\fR where N($a; \f(CW$sigma\fR) is the normalization constant, N($a; \f(CW$sigma\fR) = (1/2) erfc($a / sqrt(2 \f(CW$sigma\fR**2)). \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_gaussian_tail_pdf($x, $a, $gaussian)" 4 .el .IP "gsl_ran_gaussian_tail_pdf($x, \f(CW$a\fR, \f(CW$gaussian\fR)" 4 .IX Item "gsl_ran_gaussian_tail_pdf($x, $a, $gaussian)" This function computes the probability density p($x) at \f(CW$x\fR for a Gaussian tail distribution with standard deviation sigma and lower limit \f(CW$a\fR, using the formula given above. .ie n .IP "gsl_ran_ugaussian_tail($r, $a)" 4 .el .IP "gsl_ran_ugaussian_tail($r, \f(CW$a\fR)" 4 .IX Item "gsl_ran_ugaussian_tail($r, $a)" This functions compute results for the tail of a unit Gaussian distribution. It is equivalent to the functions above with a standard deviation of one, \f(CW$sigma\fR = 1. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_ugaussian_tail_pdf($x, $a)" 4 .el .IP "gsl_ran_ugaussian_tail_pdf($x, \f(CW$a\fR)" 4 .IX Item "gsl_ran_ugaussian_tail_pdf($x, $a)" This functions compute results for the tail of a unit Gaussian distribution. It is equivalent to the functions above with a standard deviation of one, \f(CW$sigma\fR = 1. .SS "Landau" .IX Subsection "Landau" .IP "gsl_ran_landau($r)" 4 .IX Item "gsl_ran_landau($r)" This function returns a random variate from the Landau distribution. The probability distribution for Landau random variates is defined analytically by the complex integral, p(x) = (1/(2 \epi i)) \eint_{c\-i\einfty}^{c+i\einfty} ds exp(s log(s) + x s) For numerical purposes it is more convenient to use the following equivalent form of the integral, p(x) = (1/\epi) \eint_0^\einfty dt \eexp(\-t \elog(t) \- x t) \esin(\epi t). \f(CW$r\fR is a gsl_rng structure. .IP "gsl_ran_landau_pdf($x)" 4 .IX Item "gsl_ran_landau_pdf($x)" This function computes the probability density p($x) at \f(CW$x\fR for the Landau distribution using an approximation to the formula given above. .SS "Geometric" .IX Subsection "Geometric" .ie n .IP "gsl_ran_geometric($r, $p)" 4 .el .IP "gsl_ran_geometric($r, \f(CW$p\fR)" 4 .IX Item "gsl_ran_geometric($r, $p)" This function returns a random integer from the geometric distribution, the number of independent trials with probability \f(CW$p\fR until the first success. The probability distribution for geometric variates is, p(k) = p (1\-$p)^(k\-1) for k >= 1. Note that the distribution begins with k=1 with this definition. There is another convention in which the exponent k\-1 is replaced by k. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_geometric_pdf($k, $p)" 4 .el .IP "gsl_ran_geometric_pdf($k, \f(CW$p\fR)" 4 .IX Item "gsl_ran_geometric_pdf($k, $p)" This function computes the probability p($k) of obtaining \f(CW$k\fR from a geometric distribution with probability parameter p, using the formula given above. .SS "Hypergeometric" .IX Subsection "Hypergeometric" .ie n .IP "gsl_ran_hypergeometric($r, $n1, $n2, $t)" 4 .el .IP "gsl_ran_hypergeometric($r, \f(CW$n1\fR, \f(CW$n2\fR, \f(CW$t\fR)" 4 .IX Item "gsl_ran_hypergeometric($r, $n1, $n2, $t)" This function returns a random integer from the hypergeometric distribution. The probability distribution for hypergeometric random variates is, p(k) = C(n_1, k) C(n_2, t \- k) / C(n_1 + n_2, t) where C(a,b) = a!/(b!(a\-b)!) and t <= n_1 + n_2. The domain of k is max(0,t\-n_2), ..., min(t,n_1). If a population contains n_1 elements of \*(L"type 1\*(R" and n_2 elements of \*(L"type 2\*(R" then the hypergeometric distribution gives the probability of obtaining k elements of \*(L"type 1\*(R" in t samples from the population without replacement. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_hypergeometric_pdf($k, $n1, $n2, $t)" 4 .el .IP "gsl_ran_hypergeometric_pdf($k, \f(CW$n1\fR, \f(CW$n2\fR, \f(CW$t\fR)" 4 .IX Item "gsl_ran_hypergeometric_pdf($k, $n1, $n2, $t)" This function computes the probability p(k) of obtaining k from a hypergeometric distribution with parameters \f(CW$n1\fR, \f(CW$n2\fR \f(CW$t\fR, using the formula given above. .SS "Gumbel" .IX Subsection "Gumbel" .ie n .IP "gsl_ran_gumbel1($r, $a, $b)" 4 .el .IP "gsl_ran_gumbel1($r, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_gumbel1($r, $a, $b)" This function returns a random variate from the Type\-1 Gumbel distribution. The Type\-1 Gumbel distribution function is, p(x) dx = a b \eexp(\-(b \eexp(\-ax) + ax)) dx for \-\einfty < x < \einfty. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_gumbel1_pdf($x, $a, $b)" 4 .el .IP "gsl_ran_gumbel1_pdf($x, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_gumbel1_pdf($x, $a, $b)" This function computes the probability density p($x) at \f(CW$x\fR for a Type\-1 Gumbel distribution with parameters \f(CW$a\fR and \f(CW$b\fR, using the formula given above. .ie n .IP "gsl_ran_gumbel2($r, $a, $b)" 4 .el .IP "gsl_ran_gumbel2($r, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_gumbel2($r, $a, $b)" This function returns a random variate from the Type\-2 Gumbel distribution. The Type\-2 Gumbel distribution function is, p(x) dx = a b x^{\-a\-1} \eexp(\-b x^{\-a}) dx for 0 < x < \einfty. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_gumbel2_pdf($x, $a, $b)" 4 .el .IP "gsl_ran_gumbel2_pdf($x, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_gumbel2_pdf($x, $a, $b)" This function computes the probability density p($x) at \f(CW$x\fR for a Type\-2 Gumbel distribution with parameters \f(CW$a\fR and \f(CW$b\fR, using the formula given above. .SS "Logistic" .IX Subsection "Logistic" .ie n .IP "gsl_ran_logistic($r, $a)" 4 .el .IP "gsl_ran_logistic($r, \f(CW$a\fR)" 4 .IX Item "gsl_ran_logistic($r, $a)" This function returns a random variate from the logistic distribution. The distribution function is, p(x) dx = { \eexp(\-x/a) \eover a (1 + \eexp(\-x/a))^2 } dx for \-\einfty < x < +\einfty. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_logistic_pdf($x, $a)" 4 .el .IP "gsl_ran_logistic_pdf($x, \f(CW$a\fR)" 4 .IX Item "gsl_ran_logistic_pdf($x, $a)" This function computes the probability density p($x) at \f(CW$x\fR for a logistic distribution with scale parameter \f(CW$a\fR, using the formula given above. .SS "Lognormal" .IX Subsection "Lognormal" .ie n .IP "gsl_ran_lognormal($r, $zeta, $sigma)" 4 .el .IP "gsl_ran_lognormal($r, \f(CW$zeta\fR, \f(CW$sigma\fR)" 4 .IX Item "gsl_ran_lognormal($r, $zeta, $sigma)" This function returns a random variate from the lognormal distribution. The distribution function is, p(x) dx = {1 \eover x \esqrt{2 \epi \esigma^2} } \eexp(\-(\eln(x) \- \ezeta)^2/2 \esigma^2) dx for x > 0. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_lognormal_pdf($x, $zeta, $sigma)" 4 .el .IP "gsl_ran_lognormal_pdf($x, \f(CW$zeta\fR, \f(CW$sigma\fR)" 4 .IX Item "gsl_ran_lognormal_pdf($x, $zeta, $sigma)" This function computes the probability density p($x) at \f(CW$x\fR for a lognormal distribution with parameters \f(CW$zeta\fR and \f(CW$sigma\fR, using the formula given above. .SS "Logarithmic" .IX Subsection "Logarithmic" .ie n .IP "gsl_ran_logarithmic($r, $p)" 4 .el .IP "gsl_ran_logarithmic($r, \f(CW$p\fR)" 4 .IX Item "gsl_ran_logarithmic($r, $p)" This function returns a random integer from the logarithmic distribution. The probability distribution for logarithmic random variates is, p(k) = {\-1 \eover \elog(1\-p)} {(p^k \eover k)} for k >= 1. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_logarithmic_pdf($k, $p)" 4 .el .IP "gsl_ran_logarithmic_pdf($k, \f(CW$p\fR)" 4 .IX Item "gsl_ran_logarithmic_pdf($k, $p)" This function computes the probability p($k) of obtaining \f(CW$k\fR from a logarithmic distribution with probability parameter \f(CW$p\fR, using the formula given above. .SS "Multinomial" .IX Subsection "Multinomial" .ie n .IP "gsl_ran_multinomial($r, $P, $N)" 4 .el .IP "gsl_ran_multinomial($r, \f(CW$P\fR, \f(CW$N\fR)" 4 .IX Item "gsl_ran_multinomial($r, $P, $N)" This function computes and returns a random sample n[] from the multinomial distribution formed by N trials from an underlying distribution p[K]. The distribution function for n[] is, .Sp .Vb 2 \& P(n_1, n_2, ..., n_K) = \& (N!/(n_1! n_2! ... n_K!)) p_1^n_1 p_2^n_2 ... p_K^n_K .Ve .Sp where (n_1, n_2, ..., n_K) are nonnegative integers with sum_{k=1}^K n_k = N, and (p_1, p_2, ..., p_K) is a probability distribution with \esum p_i = 1. If the array p[K] is not normalized then its entries will be treated as weights and normalized appropriately. .Sp Random variates are generated using the conditional binomial method (see C.S. Davis, The computer generation of multinomial random variates, Comp. Stat. Data Anal. 16 (1993) 205\-217 for details). .ie n .IP "gsl_ran_multinomial_pdf($counts, $P)" 4 .el .IP "gsl_ran_multinomial_pdf($counts, \f(CW$P\fR)" 4 .IX Item "gsl_ran_multinomial_pdf($counts, $P)" This function returns the probability for the multinomial distribution P(counts[1], counts[2], ..., counts[K]) with parameters p[K]. .ie n .IP "gsl_ran_multinomial_lnpdf($counts, $P)" 4 .el .IP "gsl_ran_multinomial_lnpdf($counts, \f(CW$P\fR)" 4 .IX Item "gsl_ran_multinomial_lnpdf($counts, $P)" This function returns the logarithm of the probability for the multinomial distribution P(counts[1], counts[2], ..., counts[K]) with parameters p[K]. .SS "Negative Binomial" .IX Subsection "Negative Binomial" .ie n .IP "gsl_ran_negative_binomial($r, $p, $n)" 4 .el .IP "gsl_ran_negative_binomial($r, \f(CW$p\fR, \f(CW$n\fR)" 4 .IX Item "gsl_ran_negative_binomial($r, $p, $n)" This function returns a random integer from the negative binomial distribution, the number of failures occurring before n successes in independent trials with probability p of success. The probability distribution for negative binomial variates is, p(k) = {\eGamma(n + k) \eover \eGamma(k+1) \eGamma(n) } p^n (1\-p)^k Note that n is not required to be an integer. .ie n .IP "gsl_ran_negative_binomial_pdf($k, $p, $n)" 4 .el .IP "gsl_ran_negative_binomial_pdf($k, \f(CW$p\fR, \f(CW$n\fR)" 4 .IX Item "gsl_ran_negative_binomial_pdf($k, $p, $n)" This function computes the probability p($k) of obtaining \f(CW$k\fR from a negative binomial distribution with parameters \f(CW$p\fR and \f(CW$n\fR, using the formula given above. .SS "Pascal" .IX Subsection "Pascal" .ie n .IP "gsl_ran_pascal($r, $p, $n)" 4 .el .IP "gsl_ran_pascal($r, \f(CW$p\fR, \f(CW$n\fR)" 4 .IX Item "gsl_ran_pascal($r, $p, $n)" This function returns a random integer from the Pascal distribution. The Pascal distribution is simply a negative binomial distribution with an integer value of \f(CW$n\fR. p($k) = {($n + \f(CW$k\fR \- 1)! \e \f(CW$k\fR! ($n \- 1)! } \f(CW$p\fR**$n (1\-$p)**$k for \f(CW$k\fR >= 0. \f(CW$r\fR is gsl_rng structure .ie n .IP "gsl_ran_pascal_pdf($k, $p, $n)" 4 .el .IP "gsl_ran_pascal_pdf($k, \f(CW$p\fR, \f(CW$n\fR)" 4 .IX Item "gsl_ran_pascal_pdf($k, $p, $n)" This function computes the probability p($k) of obtaining \f(CW$k\fR from a Pascal distribution with parameters \f(CW$p\fR and \f(CW$n\fR, using the formula given above. .SS "Pareto" .IX Subsection "Pareto" .ie n .IP "gsl_ran_pareto($r, $a, $b)" 4 .el .IP "gsl_ran_pareto($r, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_pareto($r, $a, $b)" This function returns a random variate from the Pareto distribution of order \f(CW$a\fR. The distribution function is p($x) dx = ($a/$b) / ($x/$b)^{$a+1} dx for \f(CW$x\fR >= \f(CW$b\fR. \f(CW$r\fR is a gsl_rng structure .ie n .IP "gsl_ran_pareto_pdf($x, $a, $b)" 4 .el .IP "gsl_ran_pareto_pdf($x, \f(CW$a\fR, \f(CW$b\fR)" 4 .IX Item "gsl_ran_pareto_pdf($x, $a, $b)" This function computes the probability density p(x) at x for a Pareto distribution with exponent a and scale b, using the formula given above. .SS "Poisson" .IX Subsection "Poisson" .ie n .IP "gsl_ran_poisson($r, $lambda)" 4 .el .IP "gsl_ran_poisson($r, \f(CW$lambda\fR)" 4 .IX Item "gsl_ran_poisson($r, $lambda)" This function returns a random integer from the Poisson distribution with mean \&\f(CW$lambda\fR. \f(CW$r\fR is a gsl_rng structure. The probability distribution for Poisson variates is, .Sp .Vb 1 \& p(k) = {$lambda**$k \e $k!} exp(\-$lambda) .Ve .Sp for \f(CW$k\fR >= 0. \f(CW$r\fR is a gsl_rng structure. .ie n .IP "gsl_ran_poisson_pdf($k, $lambda)" 4 .el .IP "gsl_ran_poisson_pdf($k, \f(CW$lambda\fR)" 4 .IX Item "gsl_ran_poisson_pdf($k, $lambda)" This function computes the probability p($k) of obtaining \f(CW$k\fR from a Poisson distribution with mean \f(CW$lambda\fR, using the formula given above. .SS "Rayleigh" .IX Subsection "Rayleigh" .ie n .IP "gsl_ran_rayleigh($r, $sigma)" 4 .el .IP "gsl_ran_rayleigh($r, \f(CW$sigma\fR)" 4 .IX Item "gsl_ran_rayleigh($r, $sigma)" This function returns a random variate from the Rayleigh distribution with scale parameter sigma. The distribution is, p(x) dx = {x \eover \esigma^2} \eexp(\- x^2/(2 \esigma^2)) dx for x > 0. \f(CW$r\fR is a gsl_rng structure .ie n .IP "gsl_ran_rayleigh_pdf($x, $sigma)" 4 .el .IP "gsl_ran_rayleigh_pdf($x, \f(CW$sigma\fR)" 4 .IX Item "gsl_ran_rayleigh_pdf($x, $sigma)" This function computes the probability density p($x) at \f(CW$x\fR for a Rayleigh distribution with scale parameter sigma, using the formula given above. .ie n .IP "gsl_ran_rayleigh_tail($r, $a, $sigma)" 4 .el .IP "gsl_ran_rayleigh_tail($r, \f(CW$a\fR, \f(CW$sigma\fR)" 4 .IX Item "gsl_ran_rayleigh_tail($r, $a, $sigma)" This function returns a random variate from the tail of the Rayleigh distribution with scale parameter \f(CW$sigma\fR and a lower limit of \f(CW$a\fR. The distribution is, p(x) dx = {x \eover \esigma^2} \eexp ((a^2 \- x^2) /(2 \esigma^2)) dx for x > a. \f(CW$r\fR is a gsl_rng structure .ie n .IP "gsl_ran_rayleigh_tail_pdf($x, $a, $sigma)" 4 .el .IP "gsl_ran_rayleigh_tail_pdf($x, \f(CW$a\fR, \f(CW$sigma\fR)" 4 .IX Item "gsl_ran_rayleigh_tail_pdf($x, $a, $sigma)" This function computes the probability density p($x) at \f(CW$x\fR for a Rayleigh tail distribution with scale parameter \f(CW$sigma\fR and lower limit \f(CW$a\fR, using the formula given above. .SS "Student-t" .IX Subsection "Student-t" .ie n .IP "gsl_ran_tdist($r, $nu)" 4 .el .IP "gsl_ran_tdist($r, \f(CW$nu\fR)" 4 .IX Item "gsl_ran_tdist($r, $nu)" This function returns a random variate from the t\-distribution. The distribution function is, p(x) dx = {\eGamma((\enu + 1)/2) \eover \esqrt{\epi \enu} \eGamma(\enu/2)} (1 + x^2/\enu)^{\-(\enu + 1)/2} dx for \-\einfty < x < +\einfty. .ie n .IP "gsl_ran_tdist_pdf($x, $nu)" 4 .el .IP "gsl_ran_tdist_pdf($x, \f(CW$nu\fR)" 4 .IX Item "gsl_ran_tdist_pdf($x, $nu)" This function computes the probability density p($x) at \f(CW$x\fR for a t\-distribution with nu degrees of freedom, using the formula given above. .SS "Laplace" .IX Subsection "Laplace" .ie n .IP "gsl_ran_laplace($r, $a)" 4 .el .IP "gsl_ran_laplace($r, \f(CW$a\fR)" 4 .IX Item "gsl_ran_laplace($r, $a)" This function returns a random variate from the Laplace distribution with width \f(CW$a\fR. The distribution is, p(x) dx = {1 \eover 2 a} \eexp(\-|x/a|) dx for \-\einfty < x < \einfty. .ie n .IP "gsl_ran_laplace_pdf($x, $a)" 4 .el .IP "gsl_ran_laplace_pdf($x, \f(CW$a\fR)" 4 .IX Item "gsl_ran_laplace_pdf($x, $a)" This function computes the probability density p($x) at \f(CW$x\fR for a Laplace distribution with width \f(CW$a\fR, using the formula given above. .SS "Levy" .IX Subsection "Levy" .ie n .IP "gsl_ran_levy($r, $c, $alpha)" 4 .el .IP "gsl_ran_levy($r, \f(CW$c\fR, \f(CW$alpha\fR)" 4 .IX Item "gsl_ran_levy($r, $c, $alpha)" This function returns a random variate from the Levy symmetric stable distribution with scale \f(CW$c\fR and exponent \f(CW$alpha\fR. The symmetric stable probability distribution is defined by a fourier transform, p(x) = {1 \eover 2 \epi} \eint_{\-\einfty}^{+\einfty} dt \eexp(\-it x \- |c t|^alpha) There is no explicit solution for the form of p(x) and the library does not define a corresponding pdf function. For \ealpha = 1 the distribution reduces to the Cauchy distribution. For \ealpha = 2 it is a Gaussian distribution with \esigma = \esqrt{2} c. For \ealpha < 1 the tails of the distribution become extremely wide. The algorithm only works for 0 < alpha <= 2. \f(CW$r\fR is a gsl_rng structure .ie n .IP "gsl_ran_levy_skew($r, $c, $alpha, $beta)" 4 .el .IP "gsl_ran_levy_skew($r, \f(CW$c\fR, \f(CW$alpha\fR, \f(CW$beta\fR)" 4 .IX Item "gsl_ran_levy_skew($r, $c, $alpha, $beta)" This function returns a random variate from the Levy skew stable distribution with scale \f(CW$c\fR, exponent \f(CW$alpha\fR and skewness parameter \f(CW$beta\fR. The skewness parameter must lie in the range [\-1,1]. The Levy skew stable probability distribution is defined by a fourier transform, p(x) = {1 \eover 2 \epi} \eint_{\-\einfty}^{+\einfty} dt \eexp(\-it x \- |c t|^alpha (1\-i beta sign(t) tan(pi alpha/2))) When \ealpha = 1 the term \etan(\epi \ealpha/2) is replaced by \-(2/\epi)\elog|t|. There is no explicit solution for the form of p(x) and the library does not define a corresponding pdf function. For \f(CW$alpha\fR = 2 the distribution reduces to a Gaussian distribution with \f(CW$sigma\fR = \fBsqrt\fR\|(2) \f(CW$c\fR and the skewness parameter has no effect. For \f(CW$alpha\fR < 1 the tails of the distribution become extremely wide. The symmetric distribution corresponds to \f(CW$beta\fR = 0. The algorithm only works for 0 < \f(CW$alpha\fR <= 2. The Levy alpha-stable distributions have the property that if N alpha-stable variates are drawn from the distribution p(c, \ealpha, \ebeta) then the sum Y = X_1 + X_2 + \edots + X_N will also be distributed as an alpha-stable variate, p(N^(1/\ealpha) c, \ealpha, \ebeta). \f(CW$r\fR is a gsl_rng structure .SS "Weibull" .IX Subsection "Weibull" .ie n .IP "gsl_ran_weibull($r, $scale, $exponent)" 4 .el .IP "gsl_ran_weibull($r, \f(CW$scale\fR, \f(CW$exponent\fR)" 4 .IX Item "gsl_ran_weibull($r, $scale, $exponent)" This function returns a random variate from the Weibull distribution with \&\f(CW$scale\fR and \f(CW$exponent\fR (aka scale). The distribution function is .Sp .Vb 2 \& p(x) dx = {$exponent \eover $scale^$exponent} x^{$exponent\-1} \& \eexp(\-(x/$scale)^$exponent) dx .Ve .Sp for x >= 0. \f(CW$r\fR is a gsl_rng structure .ie n .IP "gsl_ran_weibull_pdf($x, $scale, $exponent)" 4 .el .IP "gsl_ran_weibull_pdf($x, \f(CW$scale\fR, \f(CW$exponent\fR)" 4 .IX Item "gsl_ran_weibull_pdf($x, $scale, $exponent)" This function computes the probability density p($x) at \f(CW$x\fR for a Weibull distribution with \f(CW$scale\fR and \f(CW$exponent\fR, using the formula given above. .SS "Spherical Vector" .IX Subsection "Spherical Vector" .IP "gsl_ran_dir_2d($r)" 4 .IX Item "gsl_ran_dir_2d($r)" This function returns two values. The first is \f(CW$x\fR and the second is \f(CW$y\fR of a random direction vector v = ($x,$y) in two dimensions. The vector is normalized such that |v|^2 = \f(CW$x\fR^2 + \f(CW$y\fR^2 = 1. \f(CW$r\fR is a gsl_rng structure .IP "gsl_ran_dir_2d_trig_method($r)" 4 .IX Item "gsl_ran_dir_2d_trig_method($r)" This function returns two values. The first is \f(CW$x\fR and the second is \f(CW$y\fR of a random direction vector v = ($x,$y) in two dimensions. The vector is normalized such that |v|^2 = \f(CW$x\fR^2 + \f(CW$y\fR^2 = 1. \f(CW$r\fR is a gsl_rng structure .IP "gsl_ran_dir_3d($r)" 4 .IX Item "gsl_ran_dir_3d($r)" This function returns three values. The first is \f(CW$x\fR, the second \f(CW$y\fR and the third \&\f(CW$z\fR of a random direction vector v = ($x,$y,$z) in three dimensions. The vector is normalized such that |v|^2 = x^2 + y^2 + z^2 = 1. The method employed is due to Robert E. Knop (\s-1CACM 13, 326\s0 (1970)), and explained in Knuth, v2, 3rd ed, p136. It uses the surprising fact that the distribution projected along any axis is actually uniform (this is only true for 3 dimensions). .IP "gsl_ran_dir_nd (Not yet implemented )" 4 .IX Item "gsl_ran_dir_nd (Not yet implemented )" This function returns a random direction vector v = (x_1,x_2,...,x_n) in n dimensions. The vector is normalized such that .Sp .Vb 1 \& |v|^2 = x_1^2 + x_2^2 + ... + x_n^2 = 1. .Ve .Sp The method uses the fact that a multivariate Gaussian distribution is spherically symmetric. Each component is generated to have a Gaussian distribution, and then the components are normalized. The method is described by Knuth, v2, 3rd ed, p135\-136, and attributed to G. W. Brown, Modern Mathematics for the Engineer (1956). .SS "Shuffling and Sampling" .IX Subsection "Shuffling and Sampling" .IP "gsl_ran_shuffle" 4 .IX Item "gsl_ran_shuffle" Please use the \f(CW\*(C`shuffle\*(C'\fR method in the \s-1GSL::RNG\s0 module \s-1OO\s0 interface. .IP "gsl_ran_choose" 4 .IX Item "gsl_ran_choose" Please use the \f(CW\*(C`choose\*(C'\fR method in the \s-1GSL::RNG\s0 module \s-1OO\s0 interface. .IP "gsl_ran_sample" 4 .IX Item "gsl_ran_sample" Please use the \f(CW\*(C`sample\*(C'\fR method in the \s-1GSL::RNG\s0 module \s-1OO\s0 interface. .IP "gsl_ran_discrete_preproc" 4 .IX Item "gsl_ran_discrete_preproc" .PD 0 .ie n .IP "gsl_ran_discrete($r, $g)" 4 .el .IP "gsl_ran_discrete($r, \f(CW$g\fR)" 4 .IX Item "gsl_ran_discrete($r, $g)" .PD After gsl_ran_discrete_preproc has been called, you use this function to get the discrete random numbers. \f(CW$r\fR is a gsl_rng structure and \f(CW$g\fR is a gsl_ran_discrete structure .ie n .IP "gsl_ran_discrete_pdf($k, $g)" 4 .el .IP "gsl_ran_discrete_pdf($k, \f(CW$g\fR)" 4 .IX Item "gsl_ran_discrete_pdf($k, $g)" Returns the probability P[$k] of observing the variable \f(CW$k\fR. Since P[$k] is not stored as part of the lookup table, it must be recomputed; this computation takes O(K), so if K is large and you care about the original array P[$k] used to create the lookup table, then you should just keep this original array P[$k] around. \f(CW$r\fR is a gsl_rng structure and \f(CW$g\fR is a gsl_ran_discrete structure .IP "gsl_ran_discrete_free($g)" 4 .IX Item "gsl_ran_discrete_free($g)" De-allocates the gsl_ran_discrete pointed to by g. .PP .Vb 3 \& You have to add the functions you want to use inside the qw /put_funtion_here /. \& You can also write use Math::GSL::Randist qw/:all/; to use all available functions of the module. \& Other tags are also available, here is a complete list of all tags for this module : .Ve .IP "logarithmic" 4 .IX Item "logarithmic" .PD 0 .IP "choose" 4 .IX Item "choose" .IP "exponential" 4 .IX Item "exponential" .IP "gumbel1" 4 .IX Item "gumbel1" .IP "exppow" 4 .IX Item "exppow" .IP "sample" 4 .IX Item "sample" .IP "logistic" 4 .IX Item "logistic" .IP "gaussian" 4 .IX Item "gaussian" .IP "poisson" 4 .IX Item "poisson" .IP "binomial" 4 .IX Item "binomial" .IP "fdist" 4 .IX Item "fdist" .IP "chisq" 4 .IX Item "chisq" .IP "gamma" 4 .IX Item "gamma" .IP "hypergeometric" 4 .IX Item "hypergeometric" .IP "dirichlet" 4 .IX Item "dirichlet" .IP "negative" 4 .IX Item "negative" .IP "flat" 4 .IX Item "flat" .IP "geometric" 4 .IX Item "geometric" .IP "discrete" 4 .IX Item "discrete" .IP "tdist" 4 .IX Item "tdist" .IP "ugaussian" 4 .IX Item "ugaussian" .IP "rayleigh" 4 .IX Item "rayleigh" .IP "dir" 4 .IX Item "dir" .IP "pascal" 4 .IX Item "pascal" .IP "gumbel2" 4 .IX Item "gumbel2" .IP "shuffle" 4 .IX Item "shuffle" .IP "landau" 4 .IX Item "landau" .IP "bernoulli" 4 .IX Item "bernoulli" .IP "weibull" 4 .IX Item "weibull" .IP "multinomial" 4 .IX Item "multinomial" .IP "beta" 4 .IX Item "beta" .IP "lognormal" 4 .IX Item "lognormal" .IP "laplace" 4 .IX Item "laplace" .IP "erlang" 4 .IX Item "erlang" .IP "cauchy" 4 .IX Item "cauchy" .IP "levy" 4 .IX Item "levy" .IP "bivariate" 4 .IX Item "bivariate" .IP "pareto" 4 .IX Item "pareto" .PD .PP .Vb 1 \& For example the beta tag contains theses functions : gsl_ran_beta, gsl_ran_beta_pdf. .Ve .PP For more information on the functions, we refer you to the \s-1GSL\s0 offcial documentation: .PP .Vb 1 \& You might also want to write \& \& use Math::GSL::RNG qw/:all/; .Ve .PP since a lot of the functions of Math::GSL::Randist take as argument a structure that is created by Math::GSL::RNG. Refer to Math::GSL::RNG documentation to see how to create such a structure. .PP Math::GSL::CDF also contains a structure named gsl_ran_discrete_t. An example is given in the \s-1EXAMPLES\s0 part on how to use the function related to this structure. .SH "EXAMPLES" .IX Header "EXAMPLES" .Vb 2 \& use Math::GSL::Randist qw/:all/; \& print gsl_ran_exponential_pdf(5,2) . "\en"; \& \& use Math::GSL::Randist qw/:all/; \& my $x = Math::GSL::gsl_ran_discrete_t::new; .Ve .SH "AUTHORS" .IX Header "AUTHORS" Jonathan \*(L"Duke\*(R" Leto and Thierry Moisan .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright (C) 2008\-2013 Jonathan \*(L"Duke\*(R" Leto and Thierry Moisan .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.