📄 gamma_ratios.qbk
字号:
[section:gamma_ratios Ratios of Gamma Functions]``#include <boost/math/special_functions/gamma.hpp>`` namespace boost{ namespace math{ template <class T1, class T2> ``__sf_result`` tgamma_ratio(T1 a, T2 b); template <class T1, class T2, class ``__Policy``> ``__sf_result`` tgamma_ratio(T1 a, T2 b, const ``__Policy``&); template <class T1, class T2> ``__sf_result`` tgamma_delta_ratio(T1 a, T2 delta); template <class T1, class T2, class Policy> ``__sf_result`` tgamma_delta_ratio(T1 a, T2 delta, const ``__Policy``&); }} // namespaces [h4 Description] template <class T1, class T2> ``__sf_result`` tgamma_ratio(T1 a, T2 b); template <class T1, class T2, class ``__Policy``> ``__sf_result`` tgamma_ratio(T1 a, T2 b, const ``__Policy``&); Returns the ratio of gamma functions:[equation gamma_ratio0][optional_policy]Internally this just calls `tgamma_delta_ratio(a, b-a)`. template <class T1, class T2> ``__sf_result`` tgamma_delta_ratio(T1 a, T2 delta); template <class T1, class T2, class ``__Policy``> ``__sf_result`` tgamma_delta_ratio(T1 a, T2 delta, const ``__Policy``&); Returns the ratio of gamma functions:[equation gamma_ratio1][optional_policy]Note that the result is calculated accurately even when /delta/ issmall compared to /a/: indeed even if /a+delta ~ a/. The function istypically used when /a/ is large and /delta/ is very small.The return type of these functions is computed using the __arg_pomotion_ruleswhen T1 and T2 are different types, otherwise the result type is simple T1.[graph tgamma_delta_ratio][h4 Accuracy]The following table shows the peak errors (in units of epsilon) found on various platforms with various floating point types.Unless otherwise specified any floating point type that is narrowerthan the one shown will have __zero_error.[table Errors In the Function tgamma_delta_ratio(a, delta)[[Significand Size] [Platform and Compiler] [20 < a < 80anddelta < 1]][[53] [Win32, Visual C++ 8] [Peak=16.9 Mean=1.7] ][[64] [Redhat Linux IA32, gcc-3.4.4] [Peak=24 Mean=2.7]][[64] [Redhat Linux IA64, gcc-3.4.4] [Peak=12.8 Mean=1.8]][[113] [HPUX IA64, aCC A.06.06] [Peak=21.4 Mean=2.3] ]][table Errors In the Function tgamma_ratio(a, b)[[Significand Size] [Platform and Compiler] [6 < a,b < 50]][[53] [Win32, Visual C++ 8] [Peak=34 Mean=9] ][[64] [Redhat Linux IA32, gcc-3.4.4] [Peak=91 Mean=23]][[64] [Redhat Linux IA64, gcc-3.4.4] [Peak=35.6 Mean=9.3]][[113] [HPUX IA64, aCC A.06.06] [Peak=43.9 Mean=13.2] ]][h4 Testing]Accuracy tests use data generated at very high precision(with [@http://shoup.net/ntl/doc/RR.txt NTL RR class]set at 1000-bit precision: about 300 decimal digits)and a deliberately naive calculation of [Gamma](x)/[Gamma](y). [h4 Implementation]The implementation of these functions is very similar to that of __beta, and is based on combining similar power termsto improve accuracy and avoid spurious overflow/underflow.In addition there are optimisations for the situation where /delta/is a small integer: in which case this function is basicallythe reciprocal of a rising factorial, or where both argumentsare smallish integers: in which case table lookup of factorialscan be used to calculate the ratio.[endsect][/section:gamma_ratios Ratios of Gamma Functions][/ Copyright 2006 John Maddock and Paul A. Bristow. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt).]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -