WPILibC++ 2023.4.3
incomplete_gamma.hpp File Reference

Go to the source code of this file.

Namespaces

namespace  internal
 

Functions

template<typename T >
constexpr T internal::incomplete_gamma_quad_inp_vals (const T lb, const T ub, const int counter) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_quad_weight_vals (const T lb, const T ub, const int counter) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_quad_fn (const T x, const T a, const T lg_term) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_quad_recur (const T lb, const T ub, const T a, const T lg_term, const int counter) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_quad_lb (const T a, const T z) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_quad_ub (const T a, const T z) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_quad (const T a, const T z) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_cf_2_recur (const T a, const T z, const int depth) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_cf_2 (const T a, const T z) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_cf_1_coef (const T a, const T z, const int depth) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_cf_1_recur (const T a, const T z, const int depth) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_cf_1 (const T a, const T z) noexcept
 
template<typename T >
constexpr T internal::incomplete_gamma_check (const T a, const T z) noexcept
 
template<typename T1 , typename T2 , typename TC = common_return_t<T1,T2>>
constexpr TC internal::incomplete_gamma_type_check (const T1 a, const T2 p) noexcept
 
template<typename T1 , typename T2 >
constexpr common_return_t< T1, T2 > incomplete_gamma (const T1 a, const T2 x) noexcept
 Compile-time regularized lower incomplete gamma function. More...
 

Function Documentation

◆ incomplete_gamma()

template<typename T1 , typename T2 >
constexpr common_return_t< T1, T2 > incomplete_gamma ( const T1  a,
const T2  x 
)
constexprnoexcept

Compile-time regularized lower incomplete gamma function.

Parameters
aa real-valued, non-negative input.
xa real-valued, non-negative input.
Returns
the regularized lower incomplete gamma function evaluated at (a, x),

\[ \frac{\gamma(a,x)}{\Gamma(a)} = \frac{1}{\Gamma(a)} \int_0^x t^{a-1} \exp(-t) dt \]

When a is not too large, the value is computed using the continued fraction representation of the upper incomplete gamma function, \( \Gamma(a,x) \), using

\[ \Gamma(a,x) = \Gamma(a) - \dfrac{x^a\exp(-x)}{a - \dfrac{ax}{a + 1 + \dfrac{x}{a + 2 - \dfrac{(a+1)x}{a + 3 + \dfrac{2x}{a + 4 - \ddots}}}}} \]

where \( \gamma(a,x) \) and \( \Gamma(a,x) \) are connected via

\[ \frac{\gamma(a,x)}{\Gamma(a)} + \frac{\Gamma(a,x)}{\Gamma(a)} = 1 \]

When \( a > 10 \), a 50-point Gauss-Legendre quadrature scheme is employed.