C或C中的gamma或log gamma函数

我正在寻找C或C ++版本的gamma和log gamma函数。

是否有推荐的代码片段或库?

如果可能,我想知道实现的原理。

谢谢!!!

如果您不能使用C ++ 11:GNU GSL具有您需要的所有Gammafunction: http : //www.gnu.org/software/gsl/manual/html_node/Gamma-Functions.html#index-gsl_005fsf_005flngamma -583

或者你可以看一下boost的数学特殊function: http : //www.boost.org/doc/libs/1_53_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_gamma/lgamma.html

在c ++ 11中,你可以使用std :: lgamma作为log gamma,使用tgamma作为gamma。

您可以尝试查看C中的Numerical Recipes ,它应该包含您需要的function。