File indexing completed on 2025-01-18 09:40:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_MATH_SF_DETAIL_BESSEL_JY_DERIVATIVES_ASYM_HPP
0012 #define BOOST_MATH_SF_DETAIL_BESSEL_JY_DERIVATIVES_ASYM_HPP
0013
0014 #ifdef _MSC_VER
0015 #pragma once
0016 #endif
0017
0018 namespace boost{ namespace math{ namespace detail{
0019
0020 template <class T>
0021 inline T asymptotic_bessel_derivative_amplitude(T v, T x)
0022 {
0023
0024
0025 BOOST_MATH_STD_USING
0026 T s = 1;
0027 const T mu = 4 * v * v;
0028 T txq = 2 * x;
0029 txq *= txq;
0030
0031 s -= (mu - 3) / (2 * txq);
0032 s -= ((mu - 1) * (mu - 45)) / (txq * txq * 8);
0033
0034 return sqrt(s * 2 / (boost::math::constants::pi<T>() * x));
0035 }
0036
0037 template <class T>
0038 inline T asymptotic_bessel_derivative_phase_mx(T v, T x)
0039 {
0040
0041
0042
0043
0044 const T mu = 4 * v * v;
0045 const T mu2 = mu * mu;
0046 const T mu3 = mu2 * mu;
0047 T denom = 4 * x;
0048 T denom_mult = denom * denom;
0049
0050 T s = 0;
0051 s += (mu + 3) / (2 * denom);
0052 denom *= denom_mult;
0053 s += (mu2 + (46 * mu) - 63) / (6 * denom);
0054 denom *= denom_mult;
0055 s += (mu3 + (185 * mu2) - (2053 * mu) + 1899) / (5 * denom);
0056 return s;
0057 }
0058
0059 template <class T, class Policy>
0060 inline T asymptotic_bessel_y_derivative_large_x_2(T v, T x, const Policy& pol)
0061 {
0062
0063 BOOST_MATH_STD_USING
0064
0065 const T ampl = asymptotic_bessel_derivative_amplitude(v, x);
0066 const T phase = asymptotic_bessel_derivative_phase_mx(v, x);
0067 BOOST_MATH_INSTRUMENT_VARIABLE(ampl);
0068 BOOST_MATH_INSTRUMENT_VARIABLE(phase);
0069
0070
0071
0072
0073
0074
0075 const T cx = cos(x);
0076 const T sx = sin(x);
0077 const T vd2shifted = (v / 2) - 0.25f;
0078 const T ci = cos_pi(vd2shifted, pol);
0079 const T si = sin_pi(vd2shifted, pol);
0080 const T sin_phase = sin(phase) * (cx * ci + sx * si) + cos(phase) * (sx * ci - cx * si);
0081 BOOST_MATH_INSTRUMENT_CODE(sin(phase));
0082 BOOST_MATH_INSTRUMENT_CODE(cos(x));
0083 BOOST_MATH_INSTRUMENT_CODE(cos(phase));
0084 BOOST_MATH_INSTRUMENT_CODE(sin(x));
0085 return sin_phase * ampl;
0086 }
0087
0088 template <class T, class Policy>
0089 inline T asymptotic_bessel_j_derivative_large_x_2(T v, T x, const Policy& pol)
0090 {
0091
0092 BOOST_MATH_STD_USING
0093
0094 const T ampl = asymptotic_bessel_derivative_amplitude(v, x);
0095 const T phase = asymptotic_bessel_derivative_phase_mx(v, x);
0096 BOOST_MATH_INSTRUMENT_VARIABLE(ampl);
0097 BOOST_MATH_INSTRUMENT_VARIABLE(phase);
0098
0099
0100
0101
0102
0103
0104 BOOST_MATH_INSTRUMENT_CODE(cos(phase));
0105 BOOST_MATH_INSTRUMENT_CODE(cos(x));
0106 BOOST_MATH_INSTRUMENT_CODE(sin(phase));
0107 BOOST_MATH_INSTRUMENT_CODE(sin(x));
0108 const T cx = cos(x);
0109 const T sx = sin(x);
0110 const T vd2shifted = (v / 2) - 0.25f;
0111 const T ci = cos_pi(vd2shifted, pol);
0112 const T si = sin_pi(vd2shifted, pol);
0113 const T sin_phase = cos(phase) * (cx * ci + sx * si) - sin(phase) * (sx * ci - cx * si);
0114 BOOST_MATH_INSTRUMENT_VARIABLE(sin_phase);
0115 return sin_phase * ampl;
0116 }
0117
0118 template <class T>
0119 inline bool asymptotic_bessel_derivative_large_x_limit(const T& v, const T& x)
0120 {
0121 BOOST_MATH_STD_USING
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136 return (std::max)(T(fabs(v)), T(1)) < x * sqrt(boost::math::tools::forth_root_epsilon<T>());
0137 }
0138
0139 }}}
0140
0141 #endif