inline T asymptotic_bessel_j_large_x_2(T v, T x) { // See A&S 9.2.19. BOOST_MATH_STD_USING // Get the phase and amplitude: T ampl = asymptotic_bessel_amplitude(v, x); T phase = asymptotic_bessel_phase_mx(v, x); BOOST_MATH_INSTRUMENT_VARIABLE(ampl); BOOST_MATH_INSTRUMENT_VARIABLE(phase); // // Calculate the sine of the phase, using // sine/cosine addition rules to factor in // the x - PI(v/2 + 1/4) term not added to the // phase when we calculated it. // BOOST_MATH_INSTRUMENT_CODE(cos(phase)); BOOST_MATH_INSTRUMENT_CODE(cos(x)); BOOST_MATH_INSTRUMENT_CODE(sin(phase)); BOOST_MATH_INSTRUMENT_CODE(sin(x)); T cx = cos(x); T sx = sin(x); T ci = cos_pi(v / 2 + 0.25f); T si = sin_pi(v / 2 + 0.25f); T sin_phase = cos(phase) * (cx * ci + sx * si) - sin(phase) * (sx * ci - cx * si); BOOST_MATH_INSTRUMENT_VARIABLE(sin_phase); return sin_phase * ampl; }
inline T asymptotic_bessel_j_large_x_2(T v, T x) { // See A&S 9.2.19. BOOST_MATH_STD_USING // Get the phase and amplitude: T ampl = asymptotic_bessel_amplitude(v, x); T phase = asymptotic_bessel_phase_mx(v, x); // // Calculate the sine of the phase, using: // cos(x+p) = cos(x)cos(p) - sin(x)sin(p) // T sin_phase = cos(phase) * cos(x) - sin(phase) * sin(x); return sin_phase * ampl; }