# GL Profile Suite / boost_1_51_0 / boost / math / special_functions / detail / bessel_i1.hpp

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 // 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_I1_HPP #define BOOST_MATH_BESSEL_I1_HPP #ifdef _MSC_VER #pragma once #endif #include #include #include // Modified Bessel function of the first kind of order one // minimax rational approximations on intervals, see // Blair and Edwards, Chalk River Report AECL-4928, 1974 namespace boost { namespace math { namespace detail{ template T bessel_i1(T x); template struct bessel_i1_initializer { struct init { init() { do_init(); } static void do_init() { bessel_i1(T(1)); } void force_instantiate()const{} }; static const init initializer; static void force_instantiate() { initializer.force_instantiate(); } }; template const typename bessel_i1_initializer::init bessel_i1_initializer::initializer; template T bessel_i1(T x) { bessel_i1_initializer::force_instantiate(); static const T P1[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.4577180278143463643e+15)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.7732037840791591320e+14)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -6.9876779648010090070e+12)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.3357437682275493024e+11)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.4828267606612366099e+09)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.0588550724769347106e+07)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -5.1894091982308017540e+04)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.8225946631657315931e+02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -4.7207090827310162436e-01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -9.1746443287817501309e-04)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.3466829827635152875e-06)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.4831904935994647675e-09)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.1928788903603238754e-12)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -6.5245515583151902910e-16)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.9705291802535139930e-19)), }; static const T Q1[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -2.9154360556286927285e+15)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 9.7887501377547640438e+12)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.4386907088588283434e+10)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1.1594225856856884006e+07)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -5.1326864679904189920e+03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0)), }; static const T P2[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1.4582087408985668208e-05)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -8.9359825138577646443e-04)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 2.9204895411257790122e-02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -3.4198728018058047439e-01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1.3960118277609544334e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -1.9746376087200685843e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 8.5591872901933459000e-01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -6.0437159056137599999e-02)), }; static const T Q2[] = { static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 3.7510433111922824643e-05)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -2.2835624489492512649e-03)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 7.4212010813186530069e-02)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -8.5017476463217924408e-01)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 3.2593714889036996297e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, -3.8806586721556593450e+00)), static_cast(BOOST_MATH_BIG_CONSTANT(T, 64, 1.0)), }; T value, factor, r, w; BOOST_MATH_STD_USING using namespace boost::math::tools; w = abs(x); if (x == 0) { return static_cast(0); } if (w <= 15) // w in (0, 15] { T y = x * x; r = evaluate_polynomial(P1, y) / evaluate_polynomial(Q1, y); factor = w; value = factor * r; } else // w in (15, \infty) { T y = 1 / w - T(1) / 15; r = evaluate_polynomial(P2, y) / evaluate_polynomial(Q2, y); factor = exp(w) / sqrt(w); value = factor * r; } if (x < 0) { value *= -value; // odd function } return value; } }}} // namespaces #endif // BOOST_MATH_BESSEL_I1_HPP