/usr/include/boost/math/special_functions/detail
NameSizeModeActions
airy_ai_bi_zero.hpp62940644editdlrm
bernoulli_details.hpp265130644editdlrm
bessel_derivatives_linear.hpp33780644editdlrm
bessel_i0.hpp281350644editdlrm
bessel_i1.hpp299330644editdlrm
bessel_ik.hpp139170644editdlrm
bessel_j0.hpp85850644editdlrm
bessel_j1.hpp89510644editdlrm
bessel_jn.hpp39090644editdlrm
bessel_jy.hpp218680644editdlrm
bessel_jy_asym.hpp64880644editdlrm
bessel_jy_derivatives_asym.hpp46490644editdlrm
bessel_jy_derivatives_series.hpp69440644editdlrm
bessel_jy_series.hpp72410644editdlrm
bessel_jy_zero.hpp249670644editdlrm
bessel_k0.hpp221780644editdlrm
bessel_k1.hpp254650644editdlrm
bessel_kn.hpp22490644editdlrm
bessel_y0.hpp108050644editdlrm
bessel_y1.hpp94580644editdlrm
bessel_yn.hpp31180644editdlrm
daubechies_scaling_integer_grid.hpp2337880644editdlrm
erf_inv.hpp227380644editdlrm
fp_traits.hpp171930644editdlrm
gamma_inva.hpp70660644editdlrm
hypergeometric_0F1_bessel.hpp15430644editdlrm
hypergeometric_1F1_addition_theorems_on_z.hpp129800644editdlrm
hypergeometric_1F1_bessel.hpp327810644editdlrm
hypergeometric_1F1_by_ratios.hpp335400644editdlrm
hypergeometric_1F1_cf.hpp18300644editdlrm
hypergeometric_1F1_large_a.hpp11590644editdlrm
hypergeometric_1F1_large_abz.hpp221010644editdlrm
hypergeometric_1F1_negative_b_regions.hpp333760644editdlrm
hypergeometric_1F1_recurrence.hpp172950644editdlrm
hypergeometric_1F1_scaled_series.hpp21830644editdlrm
hypergeometric_1F1_small_a_negative_b_by_ratio.hpp38930644editdlrm
hypergeometric_asym.hpp59020644editdlrm
hypergeometric_cf.hpp58260644editdlrm
hypergeometric_pade.hpp38370644editdlrm
hypergeometric_pFq_checked_series.hpp279430644editdlrm
hypergeometric_rational.hpp50680644editdlrm
hypergeometric_separated_series.hpp14490644editdlrm
hypergeometric_series.hpp144220644editdlrm
ibeta_inverse.hpp340720644editdlrm
ibeta_inv_ab.hpp103630644editdlrm
iconv.hpp10090644editdlrm
igamma_inverse.hpp174140644editdlrm
igamma_large.hpp395340644editdlrm
lambert_w_lookup_table.ipp156010644editdlrm
lanczos_sse2.hpp89160644editdlrm
lgamma_small.hpp232950644editdlrm
polygamma.hpp225960644editdlrm
round_fwd.hpp27940644editdlrm
t_distribution_inv.hpp177350644editdlrm
unchecked_bernoulli.hpp764370644editdlrm
unchecked_factorial.hpp462900644editdlrm
Edit: /usr/include/boost/math/special_functions/detail/bessel_jy_derivatives_series.hpp (6944B)
// Copyright (c) 2013 Anton Bikineev // Use, modification and distribution are subject to 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_BESSEL_JY_DERIVATIVES_SERIES_HPP #define BOOST_MATH_BESSEL_JY_DERIVATIVES_SERIES_HPP #ifdef _MSC_VER #pragma once #endif namespace boost{ namespace math{ namespace detail{ template struct bessel_j_derivative_small_z_series_term { typedef T result_type; bessel_j_derivative_small_z_series_term(T v_, T x) : N(0), v(v_), term(1), mult(x / 2) { mult *= -mult; // iterate if v == 0; otherwise result of // first term is 0 and tools::sum_series stops if (v == 0) iterate(); } T operator()() { T r = term * (v + 2 * N); iterate(); return r; } private: void iterate() { ++N; term *= mult / (N * (N + v)); } unsigned N; T v; T term; T mult; }; // // Series evaluation for BesselJ'(v, z) as z -> 0. // It's derivative of http://functions.wolfram.com/Bessel-TypeFunctions/BesselJ/06/01/04/01/01/0003/ // Converges rapidly for all z << v. // template inline T bessel_j_derivative_small_z_series(T v, T x, const Policy& pol) { BOOST_MATH_STD_USING T prefix; if (v < boost::math::max_factorial::value) { prefix = pow(x / 2, v - 1) / 2 / boost::math::tgamma(v + 1, pol); } else { prefix = (v - 1) * log(x / 2) - constants::ln_two() - boost::math::lgamma(v + 1, pol); prefix = exp(prefix); } if (0 == prefix) return prefix; bessel_j_derivative_small_z_series_term s(v, x); boost::uintmax_t max_iter = boost::math::policies::get_max_series_iterations(); #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) T zero = 0; T result = boost::math::tools::sum_series(s, boost::math::policies::get_epsilon(), max_iter, zero); #else T result = boost::math::tools::sum_series(s, boost::math::policies::get_epsilon(), max_iter); #endif boost::math::policies::check_series_iterations("boost::math::bessel_j_derivative_small_z_series<%1%>(%1%,%1%)", max_iter, pol); return prefix * result; } template struct bessel_y_derivative_small_z_series_term_a { typedef T result_type; bessel_y_derivative_small_z_series_term_a(T v_, T x) : N(0), v(v_) { mult = x / 2; mult *= -mult; term = 1; } T operator()() { T r = term * (-v + 2 * N); ++N; term *= mult / (N * (N - v)); return r; } private: unsigned N; T v; T mult; T term; }; template struct bessel_y_derivative_small_z_series_term_b { typedef T result_type; bessel_y_derivative_small_z_series_term_b(T v_, T x) : N(0), v(v_) { mult = x / 2; mult *= -mult; term = 1; } T operator()() { T r = term * (v + 2 * N); ++N; term *= mult / (N * (N + v)); return r; } private: unsigned N; T v; T mult; T term; }; // // Series form for BesselY' as z -> 0, // It's derivative of http://functions.wolfram.com/Bessel-TypeFunctions/BesselY/06/01/04/01/01/0003/ // This series is only useful when the second term is small compared to the first // otherwise we get catastrophic cancellation errors. // // Approximating tgamma(v) by v^v, and assuming |tgamma(-z)| < eps we end up requiring: // eps/2 * v^v(x/2)^-v > (x/2)^v or log(eps/2) > v log((x/2)^2/v) // template inline T bessel_y_derivative_small_z_series(T v, T x, const Policy& pol) { BOOST_MATH_STD_USING static const char* function = "bessel_y_derivative_small_z_series<%1%>(%1%,%1%)"; T prefix; T gam; T p = log(x / 2); T scale = 1; bool need_logs = (v >= boost::math::max_factorial::value) || (boost::math::tools::log_max_value() / v < fabs(p)); if (!need_logs) { gam = boost::math::tgamma(v, pol); p = pow(x / 2, v + 1) * 2; if (boost::math::tools::max_value() * p < gam) { scale /= gam; gam = 1; if (boost::math::tools::max_value() * p < gam) { // This term will overflow to -INF, when combined with the series below it becomes +INF: return boost::math::policies::raise_overflow_error(function, 0, pol); } } prefix = -gam / (boost::math::constants::pi() * p); } else { gam = boost::math::lgamma(v, pol); p = (v + 1) * p + constants::ln_two(); prefix = gam - log(boost::math::constants::pi()) - p; if (boost::math::tools::log_max_value() < prefix) { prefix -= log(boost::math::tools::max_value() / 4); scale /= (boost::math::tools::max_value() / 4); if (boost::math::tools::log_max_value() < prefix) { return boost::math::policies::raise_overflow_error(function, 0, pol); } } prefix = -exp(prefix); } bessel_y_derivative_small_z_series_term_a s(v, x); boost::uintmax_t max_iter = boost::math::policies::get_max_series_iterations(); #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) T zero = 0; T result = boost::math::tools::sum_series(s, boost::math::policies::get_epsilon(), max_iter, zero); #else T result = boost::math::tools::sum_series(s, boost::math::policies::get_epsilon(), max_iter); #endif boost::math::policies::check_series_iterations("boost::math::bessel_y_derivative_small_z_series<%1%>(%1%,%1%)", max_iter, pol); result *= prefix; p = pow(x / 2, v - 1) / 2; if (!need_logs) { prefix = boost::math::tgamma(-v, pol) * boost::math::cos_pi(v) * p / boost::math::constants::pi(); } else { int sgn; prefix = boost::math::lgamma(-v, &sgn, pol) + (v - 1) * log(x / 2) - constants::ln_two(); prefix = exp(prefix) * sgn / boost::math::constants::pi(); } bessel_y_derivative_small_z_series_term_b s2(v, x); max_iter = boost::math::policies::get_max_series_iterations(); #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) T b = boost::math::tools::sum_series(s2, boost::math::policies::get_epsilon(), max_iter, zero); #else T b = boost::math::tools::sum_series(s2, boost::math::policies::get_epsilon(), max_iter); #endif result += scale * prefix * b; return result; } // Calculating of BesselY'(v,x) with small x (x < epsilon) and integer x using derivatives // of formulas in http://functions.wolfram.com/Bessel-TypeFunctions/BesselY/06/01/04/01/02/ // seems to lose precision. Instead using linear combination of regular Bessel is preferred. }}} // namespaces #endif // BOOST_MATH_BESSEL_JY_DERIVATVIES_SERIES_HPP