| 1 | /* specfunc/bessel_Inu.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_gamma.h"cxx . . $ `<file>/external/gsl/gsl_sf_gamma.h`/ |
| 27 | #include "gsl_sf_bessel.h"cxx . . $ `<file>/external/gsl/gsl_sf_bessel.h`/ |
| 28 | |
| 29 | #include "gsl_specfunc__error.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__error.h`/ |
| 30 | |
| 31 | #include "gsl_specfunc__bessel.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__bessel.h`/ |
| 32 | #include "gsl_specfunc__bessel_temme.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__bessel_temme.h`/ |
| 33 | |
| 34 | |
| 35 | /*-*-*-*-*-*-*-*-*-*-*-* Functions with Error Codes *-*-*-*-*-*-*-*-*-*-*-*/ |
| 36 | |
| 37 | int |
| 38 | gsl_sf_bessel_Inu_scaled_ecxx . . $ gsl_sf_bessel_Inu_scaled_e(38fedf92a6b14b51).(double nu, double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result) |
| 39 | { |
| 40 | /* CHECK_POINTER(result) */ |
| 41 | |
| 42 | if(x < 0.0 || nu < 0.0) { |
| 43 | DOMAIN_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:9:9`!(result); |
| 44 | } |
| 45 | else if(x*x < 10.0*(nu+1.0)) { |
| 46 | gsl_sf_resultcxx . . $ gsl_sf_result# b; |
| 47 | double ex = exp(-x); |
| 48 | int stat = gsl_sf_bessel_IJ_taylor_ecxx . . $ gsl_sf_bessel_IJ_taylor_e(2103957cdc9cfe31).(nu, x, 1, 100, GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`!, &b); |
| 49 | result->valcxx . . $ gsl_sf_result_struct#val. = b.valcxx . . $ gsl_sf_result_struct#val. * ex; |
| 50 | result->errcxx . . $ gsl_sf_result_struct#err. = b.errcxx . . $ gsl_sf_result_struct#err. * ex; |
| 51 | result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * fabs(result->valcxx . . $ gsl_sf_result_struct#val.); |
| 52 | return stat; |
| 53 | } |
| 54 | else if(0.5/(nu*nu + x*x) < GSL_ROOT3_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:19:9`!) { |
| 55 | return gsl_sf_bessel_Inu_scaled_asymp_unif_ecxx . . $ gsl_sf_bessel_Inu_scaled_asymp_unif_e(38fedf92a6b14b51).(nu, x, result); |
| 56 | } |
| 57 | else { |
| 58 | int N = (int)(nu + 0.5); |
| 59 | double mu = nu - N; /* -1/2 <= mu <= 1/2 */ |
| 60 | double K_mu, K_mup1, Kp_mu; |
| 61 | double K_nu, K_nup1, K_num1; |
| 62 | double I_nu_ratio; |
| 63 | int stat_Irat; |
| 64 | int stat_Kmu; |
| 65 | int n; |
| 66 | |
| 67 | /* obtain K_mu, K_mup1 */ |
| 68 | if(x < 2.0) { |
| 69 | stat_Kmu = gsl_sf_bessel_K_scaled_temmecxx . . $ gsl_sf_bessel_K_scaled_temme(2e136731b43522e2).(mu, x, &K_mu, &K_mup1, &Kp_mu); |
| 70 | } |
| 71 | else { |
| 72 | stat_Kmu = gsl_sf_bessel_K_scaled_steed_temme_CF2cxx . . $ gsl_sf_bessel_K_scaled_steed_temme_CF2(2e136731b43522e2).(mu, x, &K_mu, &K_mup1, &Kp_mu); |
| 73 | } |
| 74 | |
| 75 | /* recurse forward to obtain K_num1, K_nu */ |
| 76 | K_nu = K_mu; |
| 77 | K_nup1 = K_mup1; |
| 78 | |
| 79 | for(n=0; n<N; n++) { |
| 80 | K_num1 = K_nu; |
| 81 | K_nu = K_nup1; |
| 82 | K_nup1 = 2.0*(mu+n+1)/x * K_nu + K_num1; |
| 83 | } |
| 84 | |
| 85 | /* calculate I_{nu+1}/I_nu */ |
| 86 | stat_Irat = gsl_sf_bessel_I_CF1_sercxx . . $ gsl_sf_bessel_I_CF1_ser(55fbf6ec1f1218f9).(nu, x, &I_nu_ratio); |
| 87 | |
| 88 | /* solve for I_nu */ |
| 89 | result->valcxx . . $ gsl_sf_result_struct#val. = 1.0/(x * (K_nup1 + I_nu_ratio * K_nu)); |
| 90 | result->errcxx . . $ gsl_sf_result_struct#err. = GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * (0.5*N + 2.0) * fabs(result->valcxx . . $ gsl_sf_result_struct#val.); |
| 91 | |
| 92 | return GSL_ERROR_SELECT_2cxx . . $ `external/gsl/gsl_errno.h:145:9`!(stat_Kmu, stat_Irat); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | |
| 97 | int |
| 98 | gsl_sf_bessel_Inu_ecxx . . $ gsl_sf_bessel_Inu_e(38fedf92a6b14b51).(double nu, double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result) |
| 99 | { |
| 100 | gsl_sf_resultcxx . . $ gsl_sf_result# b; |
| 101 | int stat_I = gsl_sf_bessel_Inu_scaled_ecxx . . $ gsl_sf_bessel_Inu_scaled_e(38fedf92a6b14b51).(nu, x, &b); |
| 102 | int stat_e = gsl_sf_exp_mult_err_ecxx . . $ gsl_sf_exp_mult_err_e(30e1ceaed94c3433).(x, fabs(x*GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`!), |
| 103 | b.valcxx . . $ gsl_sf_result_struct#val., b.errcxx . . $ gsl_sf_result_struct#err., |
| 104 | result); |
| 105 | return GSL_ERROR_SELECT_2cxx . . $ `external/gsl/gsl_errno.h:145:9`!(stat_e, stat_I); |
| 106 | } |
| 107 | |
| 108 | |
| 109 | /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ |
| 110 | |
| 111 | #include "gsl_specfunc__eval.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__eval.h`/ |
| 112 | |
| 113 | double gsl_sf_bessel_Inu_scaledcxx . . $ gsl_sf_bessel_Inu_scaled(d8e7e0733fa41c87).(double nu, double x) |
| 114 | { |
| 115 | EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_bessel_Inu_scaled_e(nu, x, &result)); |
| 116 | } |
| 117 | |
| 118 | |
| 119 | double gsl_sf_bessel_Inucxx . . $ gsl_sf_bessel_Inu(d8e7e0733fa41c87).(double nu, double x) |
| 120 | { |
| 121 | EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_bessel_Inu_e(nu, x, &result)); |
| 122 | } |