⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 randist.texi

📁 该文件为c++的数学函数库!是一个非常有用的编程工具.它含有各种数学函数,为科学计算、工程应用等程序编写提供方便!
💻 TEXI
📖 第 1 页 / 共 5 页
字号:
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@deftypefun double gsl_cdf_lognormal_P (double @var{x}, double @var{zeta}, double @var{sigma})@deftypefunx double gsl_cdf_lognormal_Q (double @var{x}, double @var{zeta}, double @var{sigma})@deftypefunx double gsl_cdf_lognormal_Pinv (double @var{P}, double @var{zeta}, double @var{sigma})@deftypefunx double gsl_cdf_lognormal_Qinv (double @var{Q}, double @var{zeta}, double @var{sigma})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for the lognormaldistribution with parameters @var{zeta} and @var{sigma}.@end deftypefun@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 distributionThis 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 2 \Gamma(\nu/2) } (x/2)^{\nu/2 - 1} \exp(-x/2) dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{1 \over 2 \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@deftypefun double gsl_cdf_chisq_P (double @var{x}, double @var{nu})@deftypefunx double gsl_cdf_chisq_Q (double @var{x}, double @var{nu})@deftypefunx double gsl_cdf_chisq_Pinv (double @var{P}, double @var{nu})@deftypefunx double gsl_cdf_chisq_Qinv (double @var{Q}, double @var{nu})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for the chi-squareddistribution with @var{nu} degrees of freedom.@end deftypefun@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-distributionThis 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@deftypefun double gsl_cdf_Fdist_P (double @var{x}, double @var{nu1}, double @var{nu2})@deftypefunx double gsl_cdf_Fdist_Q (double @var{x}, double @var{nu1}, double @var{nu2})These functions compute the cumulative distribution functions@math{P(x)} and @math{Q(x)} for the F-distribution with @var{nu1} and@var{nu2} degrees of freedom.@end deftypefun@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@cindex Student t-distributionThis 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@deftypefun double gsl_cdf_tdist_P (double @var{x}, double @var{nu})@deftypefunx double gsl_cdf_tdist_Q (double @var{x}, double @var{nu})@deftypefunx double gsl_cdf_tdist_Pinv (double @var{P}, double @var{nu})@deftypefunx double gsl_cdf_tdist_Qinv (double @var{Q}, double @var{nu})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for the t-distributionwith @var{nu} degrees of freedom.@end deftypefun@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 distributionThis 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@noindentfor @c{$0 \le x \le 1$}@math{0 <= x <= 1}.@end deftypefn@deftypefun double gsl_ran_beta_pdf (double @var{x}, double @var{a}, double @var{b})This function computes the probability density @math{p(x)} at @var{x}for a beta distribution with parameters @var{a} and @var{b}, using theformula given above.@end deftypefun@sp 1@tex\centerline{\input rand-beta.tex}@end tex@deftypefun double gsl_cdf_beta_P (double @var{x}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_beta_Q (double @var{x}, double @var{a}, double @var{b})These functions compute the cumulative distribution functions@math{P(x)} and @math{Q(x)} for the beta distribution withparameters @var{a} and @var{b}.@end deftypefun@page@node The Logistic Distribution@section The Logistic Distribution@deftypefn Random double gsl_ran_logistic (const gsl_rng * @var{r}, double @var{a})@cindex Logistic distributionThis function returns a random variate from the logisticdistribution.  The distribution function is,@tex\beforedisplay$$p(x) dx = { \exp(-x/a) \over a (1 + \exp(-x/a))^2 } dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = @{ \exp(-x/a) \over a (1 + \exp(-x/a))^2 @} dx@end example@end ifinfo@noindentfor @math{-\infty < x < +\infty}.@end deftypefn@deftypefun double gsl_ran_logistic_pdf (double @var{x}, double @var{a})This function computes the probability density @math{p(x)} at @var{x}for a logistic distribution with scale parameter @var{a}, using theformula given above.@end deftypefun@sp 1@tex\centerline{\input rand-logistic.tex}@end tex@deftypefun double gsl_cdf_logistic_P (double @var{x}, double @var{a})@deftypefunx double gsl_cdf_logistic_Q (double @var{x}, double @var{a})@deftypefunx double gsl_cdf_logistic_Pinv (double @var{P}, double @var{a})@deftypefunx double gsl_cdf_logistic_Qinv (double @var{Q}, double @var{a})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for the logisticdistribution with scale parameter @var{a}.@end deftypefun@page@node The Pareto Distribution@section The Pareto Distribution@deftypefn Random double gsl_ran_pareto (const gsl_rng * @var{r}, double @var{a}, double @var{b})@cindex Pareto distributionThis function returns a random variate from the Pareto distribution oforder @var{a}.  The distribution function is,@tex\beforedisplay$$p(x) dx = (a/b) / (x/b)^{a+1} dx$$\afterdisplay@end tex@ifinfo@examplep(x) dx = (a/b) / (x/b)^@{a+1@} dx@end example@end ifinfo@noindentfor @c{$x \ge b$}@math{x >= b}.@end deftypefn@deftypefun double gsl_ran_pareto_pdf (double @var{x}, double @var{a}, double @var{b})This function computes the probability density @math{p(x)} at @var{x}for a Pareto distribution with exponent @var{a} and scale @var{b}, usingthe formula given above.@end deftypefun@sp 1@tex\centerline{\input rand-pareto.tex}@end tex@deftypefun double gsl_cdf_pareto_P (double @var{x}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_pareto_Q (double @var{x}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_pareto_Pinv (double @var{P}, double @var{a}, double @var{b})@deftypefunx double gsl_cdf_pareto_Qinv (double @var{Q}, double @var{a}, double @var{b})These functions compute the cumulative distribution functions@math{P(x)}, @math{Q(x)} and their inverses for the Paretodistribution with exponent @var{a} and scale @var{b}.@end deftypefun@page@node The Spherical Distribution (2D & 3D)@section The Spherical Distribution (2D & 3D)The spherical distributions generate random vectors, located on aspherical surface.  They can be used as random directions, for example inthe steps of a random walk.@deftypefn Random void gsl_ran_dir_2d (const gsl_rng * @var{r}, double *@var{x}, double *@var{y})@deftypefnx Random void gsl_ran_dir_2d_trig_method (const gsl_rng * @var{r}, double *@var{x}, double *@var{y})@cindex 2D random direction vector@cindex direction vector, random 2D@cindex spherical random variates, 2DThis function returns a random direction vector @math{v} =(@var{x},@var{y}) in two dimensions.  The vector is normalized such that@math{|v|^2 = x^2 + y^2 = 1}.  The obvious way to do this is to take auniform random number between 0 and @math{2\pi} and let @var{x} and@var{y} be the sine and cosine respectively.  Two trig functions wouldhave been expensive in the old days, but with modern hardwareimplementations, this is sometimes the fastest way to go.  This is thecase for the Pentium (but not the case for the Sun Sparcstation).One can avoid the trig evaluations by choosing @var{x} and@var{y} in the interior of a unit circle (choose them at random from theinterior of the enclosing square, and then reject those that are outsidethe unit circle), and then dividing by @c{$\sqrt{x^2 + y^2}$}@math{\sqrt@{x^2 + y^2@}}.A much cleverer approach, attributed to von Neumann (See Knuth, v2, 3rded, p140, exercise 23), requires neither trig nor a square root.  Inthis approach, @var{u} and @var{v} are chosen at random from theinterior of a unit circle, and then @math{x=(u^2-v^2)/(u^2+v^2)} and@math{y=uv/(u^2+v^2)}.@end deftypefn@deftypefn Random void gsl_ran_dir_3d (const gsl_rng * @var{r}, double *@var{x}, double *@var{y}, double * @var{z})@cindex 3D random direction vector

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -