File indexing completed on 2025-01-18 09:40:06
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_MATH_HYPERGEOMETRIC_SEPARATED_SERIES_HPP
0011 #define BOOST_MATH_HYPERGEOMETRIC_SEPARATED_SERIES_HPP
0012
0013 namespace boost { namespace math { namespace detail {
0014
0015 template <class T, class Policy>
0016 inline T hypergeometric_1F1_separated_series(const T& a, const T& b, const T& z, const Policy& pol)
0017 {
0018 BOOST_MATH_STD_USING
0019
0020 std::uintmax_t max_iter = policies::get_max_series_iterations<Policy>();
0021 const T factor = policies::get_epsilon<T, Policy>();
0022
0023 T denom = 1, numer = 1;
0024 T intermediate_result = 1, result = 1;
0025 T a_pochhammer = a, z_pow = z;
0026 unsigned N = 0;
0027 while (--max_iter)
0028 {
0029 ++N;
0030 const T mult = (((b + N) - 1) * N);
0031 denom *= mult; numer *= mult;
0032 numer += a_pochhammer * z_pow;
0033
0034 result = numer / denom;
0035
0036 if (fabs(factor * result) > fabs(result - intermediate_result))
0037 break;
0038
0039 intermediate_result = result;
0040
0041 a_pochhammer *= (a + N);
0042 z_pow *= z;
0043 }
0044
0045 return result;
0046 }
0047
0048 } } }
0049
0050 #endif