| 1 | /* specfunc/bessel_K0.c |
| 2 | * |
| 3 | * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | /* Author: G. Jungman */ |
| 21 | |
| 22 | #include "gsl__config.h"cxx . . $ `<file>/external/gsl/gsl__config.h`/ |
| 23 | #include "gsl_math.h"cxx . . $ `<file>/external/gsl/gsl_math.h`/ |
| 24 | #include "gsl_errno.h"cxx . . $ `<file>/external/gsl/gsl_errno.h`/ |
| 25 | #include "gsl_sf_exp.h"cxx . . $ `<file>/external/gsl/gsl_sf_exp.h`/ |
| 26 | #include "gsl_sf_bessel.h"cxx . . $ `<file>/external/gsl/gsl_sf_bessel.h`/ |
| 27 | |
| 28 | #include "gsl_specfunc__error.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__error.h`/ |
| 29 | |
| 30 | #include "gsl_specfunc__chebyshev.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__chebyshev.h`/ |
| 31 | #include "gsl_specfunc__cheb_eval.c"cxx . . $ `<file>/external/gsl/gsl_specfunc__cheb_eval.c`/ |
| 32 | |
| 33 | /*-*-*-*-*-*-*-*-*-*-*-* Private Section *-*-*-*-*-*-*-*-*-*-*-*/ |
| 34 | |
| 35 | /* based on SLATEC bk0(), bk0e() */ |
| 36 | |
| 37 | /* chebyshev expansions |
| 38 | |
| 39 | series for bk0 on the interval 0. to 4.00000d+00 |
| 40 | with weighted error 3.57e-19 |
| 41 | log weighted error 18.45 |
| 42 | significant figures required 17.99 |
| 43 | decimal places required 18.97 |
| 44 | |
| 45 | series for ak0 on the interval 1.25000d-01 to 5.00000d-01 |
| 46 | with weighted error 5.34e-17 |
| 47 | log weighted error 16.27 |
| 48 | significant figures required 14.92 |
| 49 | decimal places required 16.89 |
| 50 | |
| 51 | series for ak02 on the interval 0. to 1.25000d-01 |
| 52 | with weighted error 2.34e-17 |
| 53 | log weighted error 16.63 |
| 54 | significant figures required 14.67 |
| 55 | decimal places required 17.20 |
| 56 | */ |
| 57 | |
| 58 | static double bk0_datacxx . . $ bk0_data.[11] = { |
| 59 | -0.03532739323390276872, |
| 60 | 0.3442898999246284869, |
| 61 | 0.03597993651536150163, |
| 62 | 0.00126461541144692592, |
| 63 | 0.00002286212103119451, |
| 64 | 0.00000025347910790261, |
| 65 | 0.00000000190451637722, |
| 66 | 0.00000000001034969525, |
| 67 | 0.00000000000004259816, |
| 68 | 0.00000000000000013744, |
| 69 | 0.00000000000000000035 |
| 70 | }; |
| 71 | static cheb_seriescxx . . $ cheb_series# bk0_cscxx . . $ bk0_cs. = { |
| 72 | bk0_datacxx . . $ bk0_data., |
| 73 | 10, |
| 74 | -1, 1, |
| 75 | 10 |
| 76 | }; |
| 77 | |
| 78 | static double ak0_datacxx . . $ ak0_data.[17] = { |
| 79 | -0.07643947903327941, |
| 80 | -0.02235652605699819, |
| 81 | 0.00077341811546938, |
| 82 | -0.00004281006688886, |
| 83 | 0.00000308170017386, |
| 84 | -0.00000026393672220, |
| 85 | 0.00000002563713036, |
| 86 | -0.00000000274270554, |
| 87 | 0.00000000031694296, |
| 88 | -0.00000000003902353, |
| 89 | 0.00000000000506804, |
| 90 | -0.00000000000068895, |
| 91 | 0.00000000000009744, |
| 92 | -0.00000000000001427, |
| 93 | 0.00000000000000215, |
| 94 | -0.00000000000000033, |
| 95 | 0.00000000000000005 |
| 96 | }; |
| 97 | static cheb_seriescxx . . $ cheb_series# ak0_cscxx . . $ ak0_cs. = { |
| 98 | ak0_datacxx . . $ ak0_data., |
| 99 | 16, |
| 100 | -1, 1, |
| 101 | 10 |
| 102 | }; |
| 103 | |
| 104 | static double ak02_datacxx . . $ ak02_data.[14] = { |
| 105 | -0.01201869826307592, |
| 106 | -0.00917485269102569, |
| 107 | 0.00014445509317750, |
| 108 | -0.00000401361417543, |
| 109 | 0.00000015678318108, |
| 110 | -0.00000000777011043, |
| 111 | 0.00000000046111825, |
| 112 | -0.00000000003158592, |
| 113 | 0.00000000000243501, |
| 114 | -0.00000000000020743, |
| 115 | 0.00000000000001925, |
| 116 | -0.00000000000000192, |
| 117 | 0.00000000000000020, |
| 118 | -0.00000000000000002 |
| 119 | }; |
| 120 | static cheb_seriescxx . . $ cheb_series# ak02_cscxx . . $ ak02_cs. = { |
| 121 | ak02_datacxx . . $ ak02_data., |
| 122 | 13, |
| 123 | -1, 1, |
| 124 | 8 |
| 125 | }; |
| 126 | |
| 127 | |
| 128 | /*-*-*-*-*-*-*-*-*-*-*-* Functions with Error Codes *-*-*-*-*-*-*-*-*-*-*-*/ |
| 129 | |
| 130 | int gsl_sf_bessel_K0_scaled_ecxx . . $ gsl_sf_bessel_K0_scaled_e(feafd9287608bc44).(const double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result) |
| 131 | { |
| 132 | /* CHECK_POINTER(result) */ |
| 133 | |
| 134 | if(x <= 0.0) { |
| 135 | DOMAIN_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:9:9`!(result); |
| 136 | } |
| 137 | else if(x <= 2.0) { |
| 138 | const double lx = logcxx . . $ log(447c67c6676f75c3).(x); |
| 139 | const double ex = expcxx . . $ exp(447c67c6676f75c3).(x); |
| 140 | int stat_I0; |
| 141 | gsl_sf_resultcxx . . $ gsl_sf_result# I0; |
| 142 | gsl_sf_resultcxx . . $ gsl_sf_result# c; |
| 143 | cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&bk0_cscxx . . $ bk0_cs., 0.5*x*x-1.0, &c); |
| 144 | stat_I0 = gsl_sf_bessel_I0_ecxx . . $ gsl_sf_bessel_I0_e(feafd9287608bc44).(x, &I0); |
| 145 | result->valcxx . . $ gsl_sf_result_struct#val. = ex * ((-lx+M_LN2cxx . . $ `<external>/11263917310783833665/math.h:1119:10`!)*I0.valcxx . . $ gsl_sf_result_struct#val. - 0.25 + c.valcxx . . $ gsl_sf_result_struct#val.); |
| 146 | result->errcxx . . $ gsl_sf_result_struct#err. = ex * ((M_LN2cxx . . $ `<external>/11263917310783833665/math.h:1119:10`!+fabscxx . . $ fabs(447c67c6676f75c3).(lx))*I0.errcxx . . $ gsl_sf_result_struct#err. + c.errcxx . . $ gsl_sf_result_struct#err.); |
| 147 | result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * fabscxx . . $ fabs(447c67c6676f75c3).(result->valcxx . . $ gsl_sf_result_struct#val.); |
| 148 | return stat_I0; |
| 149 | } |
| 150 | else if(x <= 8.0) { |
| 151 | const double sx = sqrtcxx . . $ sqrt(447c67c6676f75c3).(x); |
| 152 | gsl_sf_resultcxx . . $ gsl_sf_result# c; |
| 153 | cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&ak0_cscxx . . $ ak0_cs., (16.0/x-5.0)/3.0, &c); |
| 154 | result->valcxx . . $ gsl_sf_result_struct#val. = (1.25 + c.valcxx . . $ gsl_sf_result_struct#val.) / sx; |
| 155 | result->errcxx . . $ gsl_sf_result_struct#err. = c.errcxx . . $ gsl_sf_result_struct#err. / sx; |
| 156 | result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * fabscxx . . $ fabs(447c67c6676f75c3).(result->valcxx . . $ gsl_sf_result_struct#val.); |
| 157 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 158 | } |
| 159 | else { |
| 160 | const double sx = sqrtcxx . . $ sqrt(447c67c6676f75c3).(x); |
| 161 | gsl_sf_resultcxx . . $ gsl_sf_result# c; |
| 162 | cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&ak02_cscxx . . $ ak02_cs., 16.0/x-1.0, &c); |
| 163 | result->valcxx . . $ gsl_sf_result_struct#val. = (1.25 + c.valcxx . . $ gsl_sf_result_struct#val.) / sx; |
| 164 | result->errcxx . . $ gsl_sf_result_struct#err. = (c.errcxx . . $ gsl_sf_result_struct#err. + GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`!) / sx; |
| 165 | result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * fabscxx . . $ fabs(447c67c6676f75c3).(result->valcxx . . $ gsl_sf_result_struct#val.); |
| 166 | return GSL_SUCCESScxx . . $ GSL_SUCCESS.; |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | |
| 171 | int gsl_sf_bessel_K0_ecxx . . $ gsl_sf_bessel_K0_e(feafd9287608bc44).(const double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result) |
| 172 | { |
| 173 | /* CHECK_POINTER(result) */ |
| 174 | |
| 175 | if(x <= 0.0) { |
| 176 | DOMAIN_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:9:9`!(result); |
| 177 | } |
| 178 | else if(x <= 2.0) { |
| 179 | const double lx = logcxx . . $ log(447c67c6676f75c3).(x); |
| 180 | int stat_I0; |
| 181 | gsl_sf_resultcxx . . $ gsl_sf_result# I0; |
| 182 | gsl_sf_resultcxx . . $ gsl_sf_result# c; |
| 183 | cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&bk0_cscxx . . $ bk0_cs., 0.5*x*x-1.0, &c); |
| 184 | stat_I0 = gsl_sf_bessel_I0_ecxx . . $ gsl_sf_bessel_I0_e(feafd9287608bc44).(x, &I0); |
| 185 | result->valcxx . . $ gsl_sf_result_struct#val. = (-lx+M_LN2cxx . . $ `<external>/11263917310783833665/math.h:1119:10`!)*I0.valcxx . . $ gsl_sf_result_struct#val. - 0.25 + c.valcxx . . $ gsl_sf_result_struct#val.; |
| 186 | result->errcxx . . $ gsl_sf_result_struct#err. = (fabscxx . . $ fabs(447c67c6676f75c3).(lx) + M_LN2cxx . . $ `<external>/11263917310783833665/math.h:1119:10`!) * I0.errcxx . . $ gsl_sf_result_struct#err. + c.errcxx . . $ gsl_sf_result_struct#err.; |
| 187 | result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * fabscxx . . $ fabs(447c67c6676f75c3).(result->valcxx . . $ gsl_sf_result_struct#val.); |
| 188 | return stat_I0; |
| 189 | } |
| 190 | else { |
| 191 | gsl_sf_resultcxx . . $ gsl_sf_result# K0_scaled; |
| 192 | int stat_K0 = gsl_sf_bessel_K0_scaled_ecxx . . $ gsl_sf_bessel_K0_scaled_e(feafd9287608bc44).(x, &K0_scaled); |
| 193 | int stat_e = gsl_sf_exp_mult_err_ecxx . . $ gsl_sf_exp_mult_err_e(30e1ceaed94c3433).(-x, GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`!*fabscxx . . $ fabs(447c67c6676f75c3).(x), |
| 194 | K0_scaled.valcxx . . $ gsl_sf_result_struct#val., K0_scaled.errcxx . . $ gsl_sf_result_struct#err., |
| 195 | result); |
| 196 | return GSL_ERROR_SELECT_2cxx . . $ `external/gsl/gsl_errno.h:145:9`!(stat_e, stat_K0); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | |
| 201 | /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ |
| 202 | |
| 203 | #include "gsl_specfunc__eval.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__eval.h`/ |
| 204 | |
| 205 | double gsl_sf_bessel_K0_scaledcxx . . $ gsl_sf_bessel_K0_scaled(447c67c6676f75c3).(const double x) |
| 206 | { |
| 207 | EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_bessel_K0_scaled_e(x, &result)); |
| 208 | } |
| 209 | |
| 210 | double gsl_sf_bessel_K0cxx . . $ gsl_sf_bessel_K0(447c67c6676f75c3).(const double x) |
| 211 | { |
| 212 | EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_bessel_K0_e(x, &result)); |
| 213 | } |
| 214 |