File indexing completed on 2025-01-18 09:40:04
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_MATH_HYPERGEOMETRIC_0F1_BESSEL_HPP
0011 #define BOOST_MATH_HYPERGEOMETRIC_0F1_BESSEL_HPP
0012
0013 #include <boost/math/special_functions/bessel.hpp>
0014 #include <boost/math/special_functions/gamma.hpp>
0015
0016 namespace boost { namespace math { namespace detail {
0017
0018 template <class T, class Policy>
0019 inline T hypergeometric_0F1_bessel(const T& b, const T& z, const Policy& pol)
0020 {
0021 BOOST_MATH_STD_USING
0022
0023 const bool is_z_nonpositive = z <= 0;
0024
0025 const T sqrt_z = is_z_nonpositive ? T(sqrt(-z)) : T(sqrt(z));
0026 const T bessel_mult = is_z_nonpositive ?
0027 boost::math::cyl_bessel_j(b - 1, 2 * sqrt_z, pol) :
0028 boost::math::cyl_bessel_i(b - 1, 2 * sqrt_z, pol) ;
0029
0030 if (b > boost::math::max_factorial<T>::value)
0031 {
0032 const T lsqrt_z = log(sqrt_z);
0033 const T lsqrt_z_pow_b = (b - 1) * lsqrt_z;
0034 T lg = (boost::math::lgamma(b, pol) - lsqrt_z_pow_b);
0035 lg = exp(lg);
0036 return lg * bessel_mult;
0037 }
0038 else
0039 {
0040 const T sqrt_z_pow_b = pow(sqrt_z, b - 1);
0041 return (boost::math::tgamma(b, pol) / sqrt_z_pow_b) * bessel_mult;
0042 }
0043 }
0044
0045 } } }
0046
0047 #endif