gamma or log gamma function in C or C [closed]

别说谁变了你拦得住时间么 提交于 2019-12-23 13:33:20

问题


I am seeking a C or C++ version of gamma and log gamma functions.

Are there any code pieces or libraries recommended?

If possible, I want to know the principle of the implementations.

Thank you!!!


回答1:


If you can't use C++11: The GNU GSL has all Gamma function you would ever need: http://www.gnu.org/software/gsl/manual/html_node/Gamma-Functions.html#index-gsl_005fsf_005flngamma-583

Or you can have a look at boost's math special functions: http://www.boost.org/doc/libs/1_53_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_gamma/lgamma.html




回答2:


In c++11, you can use std::lgamma for log gamma, and tgamma for gamma.




回答3:


You can try to have a look at Numerical Recipes In C, it should contain the functions you need.



来源:https://stackoverflow.com/questions/15472803/gamma-or-log-gamma-function-in-c-or-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!