/
usr
/
include
/
boost
/
math
/
special_functions
/
detail
/
/usr/include/boost/math/special_functions/detail
mkdir
upload
Name
Size
Mode
Actions
airy_ai_bi_zero.hpp
6294
0644
edit
dl
rm
bernoulli_details.hpp
26513
0644
edit
dl
rm
bessel_derivatives_linear.hpp
3378
0644
edit
dl
rm
bessel_i0.hpp
28135
0644
edit
dl
rm
bessel_i1.hpp
29933
0644
edit
dl
rm
bessel_ik.hpp
13917
0644
edit
dl
rm
bessel_j0.hpp
8585
0644
edit
dl
rm
bessel_j1.hpp
8951
0644
edit
dl
rm
bessel_jn.hpp
3909
0644
edit
dl
rm
bessel_jy.hpp
21868
0644
edit
dl
rm
bessel_jy_asym.hpp
6488
0644
edit
dl
rm
bessel_jy_derivatives_asym.hpp
4649
0644
edit
dl
rm
bessel_jy_derivatives_series.hpp
6944
0644
edit
dl
rm
bessel_jy_series.hpp
7241
0644
edit
dl
rm
bessel_jy_zero.hpp
24967
0644
edit
dl
rm
bessel_k0.hpp
22178
0644
edit
dl
rm
bessel_k1.hpp
25465
0644
edit
dl
rm
bessel_kn.hpp
2249
0644
edit
dl
rm
bessel_y0.hpp
10805
0644
edit
dl
rm
bessel_y1.hpp
9458
0644
edit
dl
rm
bessel_yn.hpp
3118
0644
edit
dl
rm
daubechies_scaling_integer_grid.hpp
233788
0644
edit
dl
rm
erf_inv.hpp
22738
0644
edit
dl
rm
fp_traits.hpp
17193
0644
edit
dl
rm
gamma_inva.hpp
7066
0644
edit
dl
rm
hypergeometric_0F1_bessel.hpp
1543
0644
edit
dl
rm
hypergeometric_1F1_addition_theorems_on_z.hpp
12980
0644
edit
dl
rm
hypergeometric_1F1_bessel.hpp
32781
0644
edit
dl
rm
hypergeometric_1F1_by_ratios.hpp
33540
0644
edit
dl
rm
hypergeometric_1F1_cf.hpp
1830
0644
edit
dl
rm
hypergeometric_1F1_large_a.hpp
1159
0644
edit
dl
rm
hypergeometric_1F1_large_abz.hpp
22101
0644
edit
dl
rm
hypergeometric_1F1_negative_b_regions.hpp
33376
0644
edit
dl
rm
hypergeometric_1F1_recurrence.hpp
17295
0644
edit
dl
rm
hypergeometric_1F1_scaled_series.hpp
2183
0644
edit
dl
rm
hypergeometric_1F1_small_a_negative_b_by_ratio.hpp
3893
0644
edit
dl
rm
hypergeometric_asym.hpp
5902
0644
edit
dl
rm
hypergeometric_cf.hpp
5826
0644
edit
dl
rm
hypergeometric_pade.hpp
3837
0644
edit
dl
rm
hypergeometric_pFq_checked_series.hpp
27943
0644
edit
dl
rm
hypergeometric_rational.hpp
5068
0644
edit
dl
rm
hypergeometric_separated_series.hpp
1449
0644
edit
dl
rm
hypergeometric_series.hpp
14422
0644
edit
dl
rm
ibeta_inverse.hpp
34072
0644
edit
dl
rm
ibeta_inv_ab.hpp
10363
0644
edit
dl
rm
iconv.hpp
1009
0644
edit
dl
rm
igamma_inverse.hpp
17414
0644
edit
dl
rm
igamma_large.hpp
39534
0644
edit
dl
rm
lambert_w_lookup_table.ipp
15601
0644
edit
dl
rm
lanczos_sse2.hpp
8916
0644
edit
dl
rm
lgamma_small.hpp
23295
0644
edit
dl
rm
polygamma.hpp
22596
0644
edit
dl
rm
round_fwd.hpp
2794
0644
edit
dl
rm
t_distribution_inv.hpp
17735
0644
edit
dl
rm
unchecked_bernoulli.hpp
76437
0644
edit
dl
rm
unchecked_factorial.hpp
46290
0644
edit
dl
rm
Edit:
/usr/include/boost/math/special_functions/detail/hypergeometric_asym.hpp
(5902B)
/////////////////////////////////////////////////////////////////////////////// // Copyright 2014 Anton Bikineev // Copyright 2014 Christopher Kormanyos // Copyright 2014 John Maddock // Copyright 2014 Paul 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) // #ifndef BOOST_MATH_HYPERGEOMETRIC_ASYM_HPP #define BOOST_MATH_HYPERGEOMETRIC_ASYM_HPP #include <boost/math/special_functions/gamma.hpp> #include <boost/math/special_functions/hypergeometric_2F0.hpp> #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4127) #endif namespace boost { namespace math { namespace detail { // // Asymptotic series based on https://dlmf.nist.gov/13.7#E1 // // Note that a and b must not be negative integers, in addition // we require z > 0 and so apply Kummer's relation for z < 0. // template <class T, class Policy> inline T hypergeometric_1F1_asym_large_z_series(T a, const T& b, T z, const Policy& pol, int& log_scaling) { BOOST_MATH_STD_USING static const char* function = "boost::math::hypergeometric_1F1_asym_large_z_series<%1%>(%1%, %1%, %1%)"; T prefix; int e, s; if (z < 0) { a = b - a; z = -z; prefix = 1; } else { e = z > INT_MAX ? INT_MAX : itrunc(z, pol); log_scaling += e; prefix = exp(z - e); } if ((fabs(a) < 10) && (fabs(b) < 10)) { prefix *= pow(z, a) * pow(z, -b) * boost::math::tgamma(b, pol) / boost::math::tgamma(a, pol); } else { T t = log(z) * (a - b); e = itrunc(t, pol); log_scaling += e; prefix *= exp(t - e); t = boost::math::lgamma(b, &s, pol); e = itrunc(t, pol); log_scaling += e; prefix *= s * exp(t - e); t = boost::math::lgamma(a, &s, pol); e = itrunc(t, pol); log_scaling -= e; prefix /= s * exp(t - e); } // // Checked 2F0: // unsigned k = 0; T a1_poch(1 - a); T a2_poch(b - a); T z_mult(1 / z); T sum = 0; T abs_sum = 0; T term = 1; T last_term = 0; do { sum += term; last_term = term; abs_sum += fabs(sum); term *= a1_poch * a2_poch * z_mult; term /= ++k; a1_poch += 1; a2_poch += 1; if (fabs(sum) * boost::math::policies::get_epsilon<T, Policy>() > fabs(term)) break; if(fabs(sum) / abs_sum < boost::math::policies::get_epsilon<T, Policy>()) return boost::math::policies::raise_evaluation_error<T>(function, "Large-z asymptotic approximation to 1F1 has destroyed all the digits in the result due to cancellation. Current best guess is %1%", prefix * sum, Policy()); if(k > boost::math::policies::get_max_series_iterations<Policy>()) return boost::math::policies::raise_evaluation_error<T>(function, "1F1: Unable to locate solution in a reasonable time:" " large-z asymptotic approximation. Current best guess is %1%", prefix * sum, Policy()); if((k > 10) && (fabs(term) > fabs(last_term))) return boost::math::policies::raise_evaluation_error<T>(function, "Large-z asymptotic approximation to 1F1 is divergent. Current best guess is %1%", prefix * sum, Policy()); } while (true); return prefix * sum; } // experimental range template <class T, class Policy> inline bool hypergeometric_1F1_asym_region(const T& a, const T& b, const T& z, const Policy&) { BOOST_MATH_STD_USING int half_digits = policies::digits<T, Policy>() / 2; bool in_region = false; if (fabs(a) < 0.001f) return false; // Haven't been able to make this work, why not? TODO! // // We use the following heuristic, if after we have had half_digits terms // of the 2F0 series, we require terms to be decreasing in size by a factor // of at least 0.7. Assuming the earlier terms were converging much faster // than this, then this should be enough to achieve convergence before the // series shoots off to infinity. // if (z > 0) { T one_minus_a = 1 - a; T b_minus_a = b - a; if (fabs((one_minus_a + half_digits) * (b_minus_a + half_digits) / (half_digits * z)) < 0.7) { in_region = true; // // double check that we are not divergent at the start if a,b < 0: // if ((one_minus_a < 0) || (b_minus_a < 0)) { if (fabs(one_minus_a * b_minus_a / z) > 0.5) in_region = false; } } } else if (fabs((1 - (b - a) + half_digits) * (a + half_digits) / (half_digits * z)) < 0.7) { if ((floor(b - a) == (b - a)) && (b - a < 0)) return false; // Can't have a negative integer b-a. in_region = true; // // double check that we are not divergent at the start if a,b < 0: // T a1 = 1 - (b - a); if ((a1 < 0) || (a < 0)) { if (fabs(a1 * a / z) > 0.5) in_region = false; } } // // Check for a and b negative integers as these aren't supported by the approximation: // if (in_region) { if ((a < 0) && (floor(a) == a)) in_region = false; if ((b < 0) && (floor(b) == b)) in_region = false; if (fabs(z) < 40) in_region = false; } return in_region; } } } } // namespaces #ifdef BOOST_MSVC #pragma warning(pop) #endif #endif // BOOST_MATH_HYPERGEOMETRIC_ASYM_HPP
Save
cmd:
run