/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_jn.hpp (3909B)
// Copyright (c) 2006 Xiaogang Zhang // 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_JN_HPP #define BOOST_MATH_BESSEL_JN_HPP #ifdef _MSC_VER #pragma once #endif #include #include #include #include #include // Bessel function of the first kind of integer order // J_n(z) is the minimal solution // n < abs(z), forward recurrence stable and usable // n >= abs(z), forward recurrence unstable, use Miller's algorithm namespace boost { namespace math { namespace detail{ template T bessel_jn(int n, T x, const Policy& pol) { T value(0), factor, current, prev, next; BOOST_MATH_STD_USING // // Reflection has to come first: // if (n < 0) { factor = static_cast((n & 0x1) ? -1 : 1); // J_{-n}(z) = (-1)^n J_n(z) n = -n; } else { factor = 1; } if(x < 0) { factor *= (n & 0x1) ? -1 : 1; // J_{n}(-z) = (-1)^n J_n(z) x = -x; } // // Special cases: // if(asymptotic_bessel_large_x_limit(T(n), x)) return factor * asymptotic_bessel_j_large_x_2(T(n), x); if (n == 0) { return factor * bessel_j0(x); } if (n == 1) { return factor * bessel_j1(x); } if (x == 0) // n >= 2 { return static_cast(0); } BOOST_ASSERT(n > 1); T scale = 1; if (n < abs(x)) // forward recurrence { prev = bessel_j0(x); current = bessel_j1(x); policies::check_series_iterations("boost::math::bessel_j_n<%1%>(%1%,%1%)", n, pol); for (int k = 1; k < n; k++) { T fact = 2 * k / x; // // rescale if we would overflow or underflow: // if((fabs(fact) > 1) && ((tools::max_value() - fabs(prev)) / fabs(fact) < fabs(current))) { scale /= current; prev /= current; current = 1; } value = fact * current - prev; prev = current; current = value; } } else if((x < 1) || (n > x * x / 4) || (x < 5)) { return factor * bessel_j_small_z_series(T(n), x, pol); } else // backward recurrence { T fn; int s; // fn = J_(n+1) / J_n // |x| <= n, fast convergence for continued fraction CF1 boost::math::detail::CF1_jy(static_cast(n), x, &fn, &s, pol); prev = fn; current = 1; // Check recursion won't go on too far: policies::check_series_iterations("boost::math::bessel_j_n<%1%>(%1%,%1%)", n, pol); for (int k = n; k > 0; k--) { T fact = 2 * k / x; if((fabs(fact) > 1) && ((tools::max_value() - fabs(prev)) / fabs(fact) < fabs(current))) { prev /= current; scale /= current; current = 1; } next = fact * current - prev; prev = current; current = next; } value = bessel_j0(x) / current; // normalization scale = 1 / scale; } value *= factor; if(tools::max_value() * scale < fabs(value)) return policies::raise_overflow_error("boost::math::bessel_jn<%1%>(%1%,%1%)", 0, pol); return value / scale; } }}} // namespaces #endif // BOOST_MATH_BESSEL_JN_HPP