| 1 | /* specfunc/bessel_Y1.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_trig.h"cxx . . $ `<file>/external/gsl/gsl_sf_trig.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__bessel.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__bessel.h`/ |
| 31 | #include "gsl_specfunc__bessel_amp_phase.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__bessel_amp_phase.h`/ |
| 32 | #include "gsl_specfunc__cheb_eval.c"cxx . . $ `<file>/external/gsl/gsl_specfunc__cheb_eval.c`/ |
| 33 | |
| 34 | /*-*-*-*-*-*-*-*-*-*-*-* Private Section *-*-*-*-*-*-*-*-*-*-*-*/ |
| 35 | |
| 36 | /* based on SLATEC besy1, 1977 version, w. fullerton */ |
| 37 | |
| 38 | /* chebyshev expansions |
| 39 | |
| 40 | series for by1 on the interval 0. to 1.60000d+01 |
| 41 | with weighted error 1.87e-18 |
| 42 | log weighted error 17.73 |
| 43 | significant figures required 17.83 |
| 44 | decimal places required 18.30 |
| 45 | */ |
| 46 | |
| 47 | static double by1_datacxx . . $ by1_data.[14] = { |
| 48 | 0.03208047100611908629, |
| 49 | 1.262707897433500450, |
| 50 | 0.00649996189992317500, |
| 51 | -0.08936164528860504117, |
| 52 | 0.01325088122175709545, |
| 53 | -0.00089790591196483523, |
| 54 | 0.00003647361487958306, |
| 55 | -0.00000100137438166600, |
| 56 | 0.00000001994539657390, |
| 57 | -0.00000000030230656018, |
| 58 | 0.00000000000360987815, |
| 59 | -0.00000000000003487488, |
| 60 | 0.00000000000000027838, |
| 61 | -0.00000000000000000186 |
| 62 | }; |
| 63 | static cheb_seriescxx . . $ cheb_series# by1_cscxx . . $ by1_cs. = { |
| 64 | by1_datacxx . . $ by1_data., |
| 65 | 13, |
| 66 | -1, 1, |
| 67 | 10 |
| 68 | }; |
| 69 | |
| 70 | |
| 71 | /*-*-*-*-*-*-*-*-*-*-*-* Functions with Error Codes *-*-*-*-*-*-*-*-*-*-*-*/ |
| 72 | |
| 73 | int gsl_sf_bessel_Y1_ecxx . . $ gsl_sf_bessel_Y1_e(feafd9287608bc44).(const double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result) |
| 74 | { |
| 75 | const double two_over_pi = 2.0/M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!; |
| 76 | const double xmin = 1.571*GSL_DBL_MINcxx . . $ `external/gsl/gsl_machine.h:25:9`!; /*exp ( amax1(alog(r1mach(1)), -alog(r1mach(2)))+.01) */ |
| 77 | const double x_small = 2.0 * GSL_SQRT_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:18:9`!; |
| 78 | const double xmax = 1.0/GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`!; |
| 79 | |
| 80 | /* CHECK_POINTER(result) */ |
| 81 | |
| 82 | if(x <= 0.0) { |
| 83 | DOMAIN_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:9:9`!(result); |
| 84 | } |
| 85 | else if(x < xmin) { |
| 86 | OVERFLOW_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:1:9`!(result); |
| 87 | } |
| 88 | else if(x < x_small) { |
| 89 | const double lnterm = log(0.5*x); |
| 90 | gsl_sf_resultcxx . . $ gsl_sf_result# J1; |
| 91 | gsl_sf_resultcxx . . $ gsl_sf_result# c; |
| 92 | int status = gsl_sf_bessel_J1_ecxx . . $ gsl_sf_bessel_J1_e(feafd9287608bc44).(x, &J1); |
| 93 | cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&by1_cscxx . . $ by1_cs., -1.0, &c); |
| 94 | result->valcxx . . $ gsl_sf_result_struct#val. = two_over_pi * lnterm * J1.valcxx . . $ gsl_sf_result_struct#val. + (0.5 + c.valcxx . . $ gsl_sf_result_struct#val.)/x; |
| 95 | result->errcxx . . $ gsl_sf_result_struct#err. = fabs(lnterm) * (fabs(GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * J1.valcxx . . $ gsl_sf_result_struct#val.) + J1.errcxx . . $ gsl_sf_result_struct#err.) + c.errcxx . . $ gsl_sf_result_struct#err./x; |
| 96 | return status; |
| 97 | } |
| 98 | else if(x < 4.0) { |
| 99 | const double lnterm = log(0.5*x); |
| 100 | int status; |
| 101 | gsl_sf_resultcxx . . $ gsl_sf_result# J1; |
| 102 | gsl_sf_resultcxx . . $ gsl_sf_result# c; |
| 103 | cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&by1_cscxx . . $ by1_cs., 0.125*x*x-1.0, &c); |
| 104 | status = gsl_sf_bessel_J1_ecxx . . $ gsl_sf_bessel_J1_e(feafd9287608bc44).(x, &J1); |
| 105 | result->valcxx . . $ gsl_sf_result_struct#val. = two_over_pi * lnterm * J1.valcxx . . $ gsl_sf_result_struct#val. + (0.5 + c.valcxx . . $ gsl_sf_result_struct#val.)/x; |
| 106 | result->errcxx . . $ gsl_sf_result_struct#err. = fabs(lnterm) * (fabs(GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * J1.valcxx . . $ gsl_sf_result_struct#val.) + J1.errcxx . . $ gsl_sf_result_struct#err.) + c.errcxx . . $ gsl_sf_result_struct#err./x; |
| 107 | return status; |
| 108 | } |
| 109 | else if(x < xmax) { |
| 110 | const double z = 32.0/(x*x) - 1.0; |
| 111 | gsl_sf_resultcxx . . $ gsl_sf_result# ca; |
| 112 | gsl_sf_resultcxx . . $ gsl_sf_result# ct; |
| 113 | gsl_sf_resultcxx . . $ gsl_sf_result# cp; |
| 114 | const int stat_ca = cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&_gsl_sf_bessel_amp_phase_bm1_cscxx . . $ _gsl_sf_bessel_amp_phase_bm1_cs., z, &ca); |
| 115 | const int stat_ct = cheb_eval_ecxx . . $ cheb_eval_e(d4bbbe138f497cd3).(&_gsl_sf_bessel_amp_phase_bth1_cscxx . . $ _gsl_sf_bessel_amp_phase_bth1_cs., z, &ct); |
| 116 | const int stat_cp = gsl_sf_bessel_cos_pi4_ecxx . . $ gsl_sf_bessel_cos_pi4_e(38fedf92a6b14b51).(x, ct.valcxx . . $ gsl_sf_result_struct#val./x, &cp); |
| 117 | const double sqrtx = sqrt(x); |
| 118 | const double ampl = (0.75 + ca.valcxx . . $ gsl_sf_result_struct#val.) / sqrtx; |
| 119 | result->valcxx . . $ gsl_sf_result_struct#val. = -ampl * cp.valcxx . . $ gsl_sf_result_struct#val.; |
| 120 | result->errcxx . . $ gsl_sf_result_struct#err. = fabs(cp.valcxx . . $ gsl_sf_result_struct#val.) * ca.errcxx . . $ gsl_sf_result_struct#err./sqrtx + fabs(ampl) * cp.errcxx . . $ gsl_sf_result_struct#err.; |
| 121 | result->errcxx . . $ gsl_sf_result_struct#err. += GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * fabs(result->valcxx . . $ gsl_sf_result_struct#val.); |
| 122 | return GSL_ERROR_SELECT_3cxx . . $ `external/gsl/gsl_errno.h:146:9`!(stat_ca, stat_ct, stat_cp); |
| 123 | } |
| 124 | else { |
| 125 | UNDERFLOW_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:3:9`!(result); |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | |
| 130 | /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ |
| 131 | |
| 132 | #include "gsl_specfunc__eval.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__eval.h`/ |
| 133 | |
| 134 | double gsl_sf_bessel_Y1cxx . . $ gsl_sf_bessel_Y1(447c67c6676f75c3).(const double x) |
| 135 | { |
| 136 | EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_bessel_Y1_e(x, &result)); |
| 137 | } |