WPILibC++ 2023.4.3
|
Go to the source code of this file.
Namespaces | |
namespace | internal |
Functions | |
template<typename T > | |
constexpr T | internal::incomplete_beta_cf (const T a, const T b, const T z, const T c_j, const T d_j, const T f_j, const int depth) noexcept |
template<typename T > | |
constexpr T | internal::incomplete_beta_coef_even (const T a, const T b, const T z, const int k) noexcept |
template<typename T > | |
constexpr T | internal::incomplete_beta_coef_odd (const T a, const T b, const T z, const int k) noexcept |
template<typename T > | |
constexpr T | internal::incomplete_beta_coef (const T a, const T b, const T z, const int depth) noexcept |
template<typename T > | |
constexpr T | internal::incomplete_beta_c_update (const T a, const T b, const T z, const T c_j, const int depth) noexcept |
template<typename T > | |
constexpr T | internal::incomplete_beta_d_update (const T a, const T b, const T z, const T d_j, const int depth) noexcept |
template<typename T > | |
constexpr T | internal::incomplete_beta_decision (const T a, const T b, const T z, const T c_j, const T d_j, const T f_j, const int depth) noexcept |
template<typename T > | |
constexpr T | internal::incomplete_beta_begin (const T a, const T b, const T z) noexcept |
template<typename T > | |
constexpr T | internal::incomplete_beta_check (const T a, const T b, const T z) noexcept |
template<typename T1 , typename T2 , typename T3 , typename TC = common_return_t<T1,T2,T3>> | |
constexpr TC | internal::incomplete_beta_type_check (const T1 a, const T2 b, const T3 p) noexcept |
template<typename T1 , typename T2 , typename T3 > | |
constexpr common_return_t< T1, T2, T3 > | incomplete_beta (const T1 a, const T2 b, const T3 z) noexcept |
Compile-time regularized incomplete beta function. More... | |
|
constexprnoexcept |
Compile-time regularized incomplete beta function.
a | a real-valued, non-negative input. |
b | a real-valued, non-negative input. |
z | a real-valued, non-negative input. |
\[ \frac{\text{B}(z;\alpha,\beta)}{\text{B}(\alpha,\beta)} = \frac{1}{\text{B}(\alpha,\beta)}\int_0^z t^{a-1} (1-t)^{\beta-1} dt \]
using a continued fraction representation, found in the Handbook of Continued Fractions for Special Functions, and a modified Lentz method.\[ \frac{\text{B}(z;\alpha,\beta)}{\text{B}(\alpha,\beta)} = \frac{z^{\alpha} (1-t)^{\beta}}{\alpha \text{B}(\alpha,\beta)} \dfrac{a_1}{1 + \dfrac{a_2}{1 + \dfrac{a_3}{1 + \dfrac{a_4}{1 + \ddots}}}} \]
where \( a_1 = 1 \) and\[ a_{2m+2} = - \frac{(\alpha + m)(\alpha + \beta + m)}{(\alpha + 2m)(\alpha + 2m + 1)}, \ m \geq 0 \]
\[ a_{2m+1} = \frac{m(\beta - m)}{(\alpha + 2m - 1)(\alpha + 2m)}, \ m \geq 1 \]
The Lentz method works as follows: let \( f_j \) denote the value of the continued fraction up to the first \( j \) terms; \( f_j \) is updated as follows:\[ c_j = 1 + a_j / c_{j-1}, \ \ d_j = 1 / (1 + a_j d_{j-1}) \]
\[ f_j = c_j d_j f_{j-1} \]