File indexing completed on 2025-01-18 09:39:58
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_MATH_SF_DETAIL_BESSEL_DERIVATIVES_LINEAR_HPP
0011 #define BOOST_MATH_SF_DETAIL_BESSEL_DERIVATIVES_LINEAR_HPP
0012
0013 #ifdef _MSC_VER
0014 #pragma once
0015 #endif
0016
0017 namespace boost{ namespace math{ namespace detail{
0018
0019 template <class T, class Tag, class Policy>
0020 inline T bessel_j_derivative_linear(T v, T x, Tag tag, Policy pol)
0021 {
0022 return (boost::math::detail::cyl_bessel_j_imp<T>(v-1, x, tag, pol) - boost::math::detail::cyl_bessel_j_imp<T>(v+1, x, tag, pol)) / 2;
0023 }
0024
0025 template <class T, class Policy>
0026 inline T bessel_j_derivative_linear(T v, T x, const bessel_int_tag& tag, Policy pol)
0027 {
0028 return (boost::math::detail::cyl_bessel_j_imp<T>(itrunc(v-1), x, tag, pol) - boost::math::detail::cyl_bessel_j_imp<T>(itrunc(v+1), x, tag, pol)) / 2;
0029 }
0030
0031 template <class T, class Policy>
0032 inline T sph_bessel_j_derivative_linear(unsigned v, T x, Policy pol)
0033 {
0034 return (v / x) * boost::math::detail::sph_bessel_j_imp<T>(v, x, pol) - boost::math::detail::sph_bessel_j_imp<T>(v+1, x, pol);
0035 }
0036
0037 template <class T, class Policy>
0038 inline T bessel_i_derivative_linear(T v, T x, Policy pol)
0039 {
0040 T result = boost::math::detail::cyl_bessel_i_imp<T>(v - 1, x, pol);
0041 if(result >= tools::max_value<T>())
0042 return result;
0043 T result2 = boost::math::detail::cyl_bessel_i_imp<T>(v + 1, x, pol);
0044 if(result2 >= tools::max_value<T>() - result)
0045 return result2;
0046 return (result + result2) / 2;
0047 }
0048
0049 template <class T, class Tag, class Policy>
0050 inline T bessel_k_derivative_linear(T v, T x, Tag tag, Policy pol)
0051 {
0052 T result = boost::math::detail::cyl_bessel_k_imp<T>(v - 1, x, tag, pol);
0053 if(result >= tools::max_value<T>())
0054 return -result;
0055 T result2 = boost::math::detail::cyl_bessel_k_imp<T>(v + 1, x, tag, pol);
0056 if(result2 >= tools::max_value<T>() - result)
0057 return -result2;
0058 return (result + result2) / -2;
0059 }
0060
0061 template <class T, class Policy>
0062 inline T bessel_k_derivative_linear(T v, T x, const bessel_int_tag& tag, Policy pol)
0063 {
0064 return (boost::math::detail::cyl_bessel_k_imp<T>(itrunc(v-1), x, tag, pol) + boost::math::detail::cyl_bessel_k_imp<T>(itrunc(v+1), x, tag, pol)) / -2;
0065 }
0066
0067 template <class T, class Tag, class Policy>
0068 inline T bessel_y_derivative_linear(T v, T x, Tag tag, Policy pol)
0069 {
0070 return (boost::math::detail::cyl_neumann_imp<T>(v-1, x, tag, pol) - boost::math::detail::cyl_neumann_imp<T>(v+1, x, tag, pol)) / 2;
0071 }
0072
0073 template <class T, class Policy>
0074 inline T bessel_y_derivative_linear(T v, T x, const bessel_int_tag& tag, Policy pol)
0075 {
0076 return (boost::math::detail::cyl_neumann_imp<T>(itrunc(v-1), x, tag, pol) - boost::math::detail::cyl_neumann_imp<T>(itrunc(v+1), x, tag, pol)) / 2;
0077 }
0078
0079 template <class T, class Policy>
0080 inline T sph_neumann_derivative_linear(unsigned v, T x, Policy pol)
0081 {
0082 return (v / x) * boost::math::detail::sph_neumann_imp<T>(v, x, pol) - boost::math::detail::sph_neumann_imp<T>(v+1, x, pol);
0083 }
0084
0085 }}}
0086
0087 #endif