Debian Codegraph @

external/gsl/gsl_specfunc__bessel_j.c

raw symbols SCIP
1 /* specfunc/bessel_j.c
2 *
3 * Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003 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_pow_int.h"cxx . . $ `<file>/external/gsl/gsl_sf_pow_int.h`/
26 #include "gsl_sf_trig.h"cxx . . $ `<file>/external/gsl/gsl_sf_trig.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_olver.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__bessel_olver.h`/
33
34 /*-*-*-*-*-*-*-*-*-*-*-* Functions with Error Codes *-*-*-*-*-*-*-*-*-*-*-*/
35
36 int gsl_sf_bessel_j0_ecxx . . $ gsl_sf_bessel_j0_e(feafd9287608bc44).(const double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result)
37 {
38 double ax = fabscxx . . $ fabs(447c67c6676f75c3).(x);
39
40 /* CHECK_POINTER(result) */
41
42 if(ax < 0.5) {
43 const double y = x*x;
44 const double c1 = -1.0/6.0;
45 const double c2 = 1.0/120.0;
46 const double c3 = -1.0/5040.0;
47 const double c4 = 1.0/362880.0;
48 const double c5 = -1.0/39916800.0;
49 const double c6 = 1.0/6227020800.0;
50 result->valcxx . . $ gsl_sf_result_struct#val. = 1.0 + y*(c1 + y*(c2 + y*(c3 + y*(c4 + y*(c5 + y*c6)))));
51 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.);
52 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
53 }
54 else {
55 gsl_sf_resultcxx . . $ gsl_sf_result# sin_result;
56 const int stat = gsl_sf_sin_ecxx . . $ gsl_sf_sin_e(feafd9287608bc44).(x, &sin_result);
57 result->valcxx . . $ gsl_sf_result_struct#val. = sin_result.valcxx . . $ gsl_sf_result_struct#val./x;
58 result->errcxx . . $ gsl_sf_result_struct#err. = fabscxx . . $ fabs(447c67c6676f75c3).(sin_result.errcxx . . $ gsl_sf_result_struct#err./x);
59 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.);
60 return stat;
61 }
62 }
63
64
65 int gsl_sf_bessel_j1_ecxx . . $ gsl_sf_bessel_j1_e(feafd9287608bc44).(const double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result)
66 {
67 double ax = fabscxx . . $ fabs(447c67c6676f75c3).(x);
68
69 /* CHECK_POINTER(result) */
70
71 if(x == 0.0) {
72 result->valcxx . . $ gsl_sf_result_struct#val. = 0.0;
73 result->errcxx . . $ gsl_sf_result_struct#err. = 0.0;
74 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
75 }
76 else if(ax < 3.1*GSL_DBL_MINcxx . . $ `external/gsl/gsl_machine.h:25:9`!) {
77 UNDERFLOW_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:3:9`!(result);
78 }
79 else if(ax < 0.25) {
80 const double y = x*x;
81 const double c1 = -1.0/10.0;
82 const double c2 = 1.0/280.0;
83 const double c3 = -1.0/15120.0;
84 const double c4 = 1.0/1330560.0;
85 const double c5 = -1.0/172972800.0;
86 const double sum = 1.0 + y*(c1 + y*(c2 + y*(c3 + y*(c4 + y*c5))));
87 result->valcxx . . $ gsl_sf_result_struct#val. = x/3.0 * sum;
88 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.);
89 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
90 }
91 else {
92 gsl_sf_resultcxx . . $ gsl_sf_result# cos_result;
93 gsl_sf_resultcxx . . $ gsl_sf_result# sin_result;
94 const int stat_cos = gsl_sf_cos_ecxx . . $ gsl_sf_cos_e(feafd9287608bc44).(x, &cos_result);
95 const int stat_sin = gsl_sf_sin_ecxx . . $ gsl_sf_sin_e(feafd9287608bc44).(x, &sin_result);
96 const double cos_x = cos_result.valcxx . . $ gsl_sf_result_struct#val.;
97 const double sin_x = sin_result.valcxx . . $ gsl_sf_result_struct#val.;
98 result->valcxx . . $ gsl_sf_result_struct#val. = (sin_x/x - cos_x)/x;
99 result->errcxx . . $ gsl_sf_result_struct#err. = (fabscxx . . $ fabs(447c67c6676f75c3).(sin_result.errcxx . . $ gsl_sf_result_struct#err./x) + fabscxx . . $ fabs(447c67c6676f75c3).(cos_result.errcxx . . $ gsl_sf_result_struct#err.))/fabscxx . . $ fabs(447c67c6676f75c3).(x);
100 result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * (fabscxx . . $ fabs(447c67c6676f75c3).(sin_x/(x*x)) + fabscxx . . $ fabs(447c67c6676f75c3).(cos_x/x));
101 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.);
102 return GSL_ERROR_SELECT_2cxx . . $ `external/gsl/gsl_errno.h:145:9`!(stat_cos, stat_sin);
103 }
104 }
105
106
107 int gsl_sf_bessel_j2_ecxx . . $ gsl_sf_bessel_j2_e(feafd9287608bc44).(const double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result)
108 {
109 double ax = fabscxx . . $ fabs(447c67c6676f75c3).(x);
110
111 /* CHECK_POINTER(result) */
112
113 if(x == 0.0) {
114 result->valcxx . . $ gsl_sf_result_struct#val. = 0.0;
115 result->errcxx . . $ gsl_sf_result_struct#err. = 0.0;
116 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
117 }
118 else if(ax < 4.0*GSL_SQRT_DBL_MINcxx . . $ `external/gsl/gsl_machine.h:26:9`!) {
119 UNDERFLOW_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:3:9`!(result);
120 }
121 else if(ax < 1.3) {
122 const double y = x*x;
123 const double c1 = -1.0/14.0;
124 const double c2 = 1.0/504.0;
125 const double c3 = -1.0/33264.0;
126 const double c4 = 1.0/3459456.0;
127 const double c5 = -1.0/518918400;
128 const double c6 = 1.0/105859353600.0;
129 const double c7 = -1.0/28158588057600.0;
130 const double c8 = 1.0/9461285587353600.0;
131 const double c9 = -1.0/3916972233164390400.0;
132 const double sum = 1.0+y*(c1+y*(c2+y*(c3+y*(c4+y*(c5+y*(c6+y*(c7+y*(c8+y*c9))))))));
133 result->valcxx . . $ gsl_sf_result_struct#val. = y/15.0 * sum;
134 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.);
135 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
136 }
137 else {
138 gsl_sf_resultcxx . . $ gsl_sf_result# cos_result;
139 gsl_sf_resultcxx . . $ gsl_sf_result# sin_result;
140 const int stat_cos = gsl_sf_cos_ecxx . . $ gsl_sf_cos_e(feafd9287608bc44).(x, &cos_result);
141 const int stat_sin = gsl_sf_sin_ecxx . . $ gsl_sf_sin_e(feafd9287608bc44).(x, &sin_result);
142 const double cos_x = cos_result.valcxx . . $ gsl_sf_result_struct#val.;
143 const double sin_x = sin_result.valcxx . . $ gsl_sf_result_struct#val.;
144 const double f = (3.0/(x*x) - 1.0);
145 result->valcxx . . $ gsl_sf_result_struct#val. = (f * sin_x - 3.0*cos_x/x)/x;
146 result->errcxx . . $ gsl_sf_result_struct#err. = fabscxx . . $ fabs(447c67c6676f75c3).(f * sin_result.errcxx . . $ gsl_sf_result_struct#err./x) + fabscxx . . $ fabs(447c67c6676f75c3).((3.0*cos_result.errcxx . . $ gsl_sf_result_struct#err./x)/x);
147 result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * (fabscxx . . $ fabs(447c67c6676f75c3).(f*sin_x/x) + 3.0*fabscxx . . $ fabs(447c67c6676f75c3).(cos_x/(x*x)));
148 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.);
149 return GSL_ERROR_SELECT_2cxx . . $ `external/gsl/gsl_errno.h:145:9`!(stat_cos, stat_sin);
150 }
151 }
152
153
154 int
155 gsl_sf_bessel_jl_ecxx . . $ gsl_sf_bessel_jl_e(6e0db8bf56396db2).(const int l, const double x, gsl_sf_resultcxx . . $ gsl_sf_result# * result)
156 {
157 if(l < 0 || x < 0.0) {
158 DOMAIN_ERRORcxx . . $ `external/gsl/gsl_specfunc__error.h:9:9`!(result);
159 }
160 else if(x == 0.0) {
161 result->valcxx . . $ gsl_sf_result_struct#val. = ( l > 0 ? 0.0 : 1.0 );
162 result->errcxx . . $ gsl_sf_result_struct#err. = 0.0;
163 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
164 }
165 else if(l == 0) {
166 return gsl_sf_bessel_j0_ecxx . . $ gsl_sf_bessel_j0_e(feafd9287608bc44).(x, result);
167 }
168 else if(l == 1) {
169 return gsl_sf_bessel_j1_ecxx . . $ gsl_sf_bessel_j1_e(feafd9287608bc44).(x, result);
170 }
171 else if(l == 2) {
172 return gsl_sf_bessel_j2_ecxx . . $ gsl_sf_bessel_j2_e(feafd9287608bc44).(x, result);
173 }
174 else if(x*x < 10.0*(l+0.5)/M_Ecxx . . $ `<external>/11263917310783833665/math.h:1116:10`!) {
175 gsl_sf_resultcxx . . $ gsl_sf_result# b;
176 int status = gsl_sf_bessel_IJ_taylor_ecxx . . $ gsl_sf_bessel_IJ_taylor_e(2103957cdc9cfe31).(l+0.5, x, -1, 50, GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`!, &b);
177 double pre = sqrtcxx . . $ sqrt(447c67c6676f75c3).((0.5*M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!)/x);
178 result->valcxx . . $ gsl_sf_result_struct#val. = pre * b.valcxx . . $ gsl_sf_result_struct#val.;
179 result->errcxx . . $ gsl_sf_result_struct#err. = pre * b.errcxx . . $ gsl_sf_result_struct#err.;
180 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.);
181 return status;
182 }
183 else if(GSL_ROOT4_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:20:9`! * x > (l*l + l + 1.0)) {
184 gsl_sf_resultcxx . . $ gsl_sf_result# b;
185 int status = gsl_sf_bessel_Jnu_asympx_ecxx . . $ gsl_sf_bessel_Jnu_asympx_e(38fedf92a6b14b51).(l + 0.5, x, &b);
186 double pre = sqrtcxx . . $ sqrt(447c67c6676f75c3).((0.5*M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!)/x);
187 result->valcxx . . $ gsl_sf_result_struct#val. = pre * b.valcxx . . $ gsl_sf_result_struct#val.;
188 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.) + pre * b.errcxx . . $ gsl_sf_result_struct#err.;
189 return status;
190 }
191 else if(l > 1.0/GSL_ROOT6_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:22:9`!) {
192 gsl_sf_resultcxx . . $ gsl_sf_result# b;
193 int status = gsl_sf_bessel_Jnu_asymp_Olver_ecxx . . $ gsl_sf_bessel_Jnu_asymp_Olver_e(38fedf92a6b14b51).(l + 0.5, x, &b);
194 double pre = sqrtcxx . . $ sqrt(447c67c6676f75c3).((0.5*M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!)/x);
195 result->valcxx . . $ gsl_sf_result_struct#val. = pre * b.valcxx . . $ gsl_sf_result_struct#val.;
196 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.) + pre * b.errcxx . . $ gsl_sf_result_struct#err.;
197 return status;
198 }
199 else if(x > 1000.0 && x > 100.0*l*l)
200 {
201 /* We need this to avoid feeding large x to CF1; note that
202 * due to the above check, we know that n <= 50.
203 */
204 gsl_sf_resultcxx . . $ gsl_sf_result# b;
205 int status = gsl_sf_bessel_Jnu_asympx_ecxx . . $ gsl_sf_bessel_Jnu_asympx_e(38fedf92a6b14b51).(l + 0.5, x, &b);
206 double pre = sqrtcxx . . $ sqrt(447c67c6676f75c3).((0.5*M_PIcxx . . $ `<external>/11263917310783833665/math.h:1121:10`!)/x);
207 result->valcxx . . $ gsl_sf_result_struct#val. = pre * b.valcxx . . $ gsl_sf_result_struct#val.;
208 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.) + pre * b.errcxx . . $ gsl_sf_result_struct#err.;
209 return status;
210 }
211 else {
212 double sgn;
213 double ratio;
214 int stat_CF1 = gsl_sf_bessel_J_CF1cxx . . $ gsl_sf_bessel_J_CF1(7e13fe78331b9d07).(l+0.5, x, &ratio, &sgn);
215 double jellp1 = GSL_SQRT_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:18:9`! * ratio;
216 double jell = GSL_SQRT_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:18:9`!;
217 double jellm1;
218 int ell;
219 for(ell = l; ell > 0; ell--) {
220 jellm1 = -jellp1 + (2*ell + 1)/x * jell;
221 jellp1 = jell;
222 jell = jellm1;
223 }
224
225 if(fabscxx . . $ fabs(447c67c6676f75c3).(jell) > fabscxx . . $ fabs(447c67c6676f75c3).(jellp1)) {
226 gsl_sf_resultcxx . . $ gsl_sf_result# j0_result;
227 int stat_j0 = gsl_sf_bessel_j0_ecxx . . $ gsl_sf_bessel_j0_e(feafd9287608bc44).(x, &j0_result);
228 double pre = GSL_SQRT_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:18:9`! / jell;
229 result->valcxx . . $ gsl_sf_result_struct#val. = j0_result.valcxx . . $ gsl_sf_result_struct#val. * pre;
230 result->errcxx . . $ gsl_sf_result_struct#err. = j0_result.errcxx . . $ gsl_sf_result_struct#err. * fabscxx . . $ fabs(447c67c6676f75c3).(pre);
231 result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * (0.5*l + 1.0) * fabscxx . . $ fabs(447c67c6676f75c3).(result->valcxx . . $ gsl_sf_result_struct#val.);
232 return GSL_ERROR_SELECT_2cxx . . $ `external/gsl/gsl_errno.h:145:9`!(stat_j0, stat_CF1);
233 }
234 else {
235 gsl_sf_resultcxx . . $ gsl_sf_result# j1_result;
236 int stat_j1 = gsl_sf_bessel_j1_ecxx . . $ gsl_sf_bessel_j1_e(feafd9287608bc44).(x, &j1_result);
237 double pre = GSL_SQRT_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:18:9`! / jellp1;
238 result->valcxx . . $ gsl_sf_result_struct#val. = j1_result.valcxx . . $ gsl_sf_result_struct#val. * pre;
239 result->errcxx . . $ gsl_sf_result_struct#err. = j1_result.errcxx . . $ gsl_sf_result_struct#err. * fabscxx . . $ fabs(447c67c6676f75c3).(pre);
240 result->errcxx . . $ gsl_sf_result_struct#err. += 2.0 * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`! * (0.5*l + 1.0) * fabscxx . . $ fabs(447c67c6676f75c3).(result->valcxx . . $ gsl_sf_result_struct#val.);
241 return GSL_ERROR_SELECT_2cxx . . $ `external/gsl/gsl_errno.h:145:9`!(stat_j1, stat_CF1);
242 }
243 }
244 }
245
246
247 int
248 gsl_sf_bessel_jl_arraycxx . . $ gsl_sf_bessel_jl_array(875f458ced4fa3e9).(const int lmax, const double x, double * result_array)
249 {
250 /* CHECK_POINTER(result_array) */
251
252 if(lmax < 0 || x < 0.0) {
253 int j;
254 for(j=0; j<=lmax; j++) result_array[j] = 0.0;
255 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("error", GSL_EDOM);
256 }
257 else if(x == 0.0) {
258 int j;
259 for(j=1; j<=lmax; j++) result_array[j] = 0.0;
260 result_array[0] = 1.0;
261 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
262 }
263 else {
264 gsl_sf_resultcxx . . $ gsl_sf_result# r_jellp1;
265 gsl_sf_resultcxx . . $ gsl_sf_result# r_jell;
266 int stat_0 = gsl_sf_bessel_jl_ecxx . . $ gsl_sf_bessel_jl_e(6e0db8bf56396db2).(lmax+1, x, &r_jellp1);
267 int stat_1 = gsl_sf_bessel_jl_ecxx . . $ gsl_sf_bessel_jl_e(6e0db8bf56396db2).(lmax, x, &r_jell);
268 double jellp1 = r_jellp1.valcxx . . $ gsl_sf_result_struct#val.;
269 double jell = r_jell.valcxx . . $ gsl_sf_result_struct#val.;
270 double jellm1;
271 int ell;
272
273 result_array[lmax] = jell;
274 for(ell = lmax; ell >= 1; ell--) {
275 jellm1 = -jellp1 + (2*ell + 1)/x * jell;
276 jellp1 = jell;
277 jell = jellm1;
278 result_array[ell-1] = jellm1;
279 }
280
281 return GSL_ERROR_SELECT_2cxx . . $ `external/gsl/gsl_errno.h:145:9`!(stat_0, stat_1);
282 }
283 }
284
285
286 int gsl_sf_bessel_jl_steed_arraycxx . . $ gsl_sf_bessel_jl_steed_array(875f458ced4fa3e9).(const int lmax, const double x, double * jl_x)
287 {
288 /* CHECK_POINTER(jl_x) */
289
290 if(lmax < 0 || x < 0.0) {
291 int j;
292 for(j=0; j<=lmax; j++) jl_x[j] = 0.0;
293 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("error", GSL_EDOM);
294 }
295 else if(x == 0.0) {
296 int j;
297 for(j=1; j<=lmax; j++) jl_x[j] = 0.0;
298 jl_x[0] = 1.0;
299 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
300 }
301 else if(x < 2.0*GSL_ROOT4_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:20:9`!) {
302 /* first two terms of Taylor series */
303 double inv_fact = 1.0; /* 1/(1 3 5 ... (2l+1)) */
304 double x_l = 1.0; /* x^l */
305 int l;
306 for(l=0; l<=lmax; l++) {
307 jl_x[l] = x_l * inv_fact;
308 jl_x[l] *= 1.0 - 0.5*x*x/(2.0*l+3.0);
309 inv_fact /= 2.0*l+3.0;
310 x_l *= x;
311 }
312 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
313 }
314 else {
315 /* Steed/Barnett algorithm [Comp. Phys. Comm. 21, 297 (1981)] */
316 double x_inv = 1.0/x;
317 double W = 2.0*x_inv;
318 double F = 1.0;
319 double FP = (lmax+1.0) * x_inv;
320 double B = 2.0*FP + x_inv;
321 double end = B + 20000.0*W;
322 double D = 1.0/B;
323 double del = -D;
324
325 FP += del;
326
327 /* continued fraction */
328 do {
329 B += W;
330 D = 1.0/(B-D);
331 del *= (B*D - 1.);
332 FP += del;
333 if(D < 0.0) F = -F;
334 if(B > end) {
335 GSL_ERRORcxx . . $ `external/gsl/gsl_errno.h:104:9`! ("error", GSL_EMAXITER);
336 }
337 }
338 while(fabscxx . . $ fabs(447c67c6676f75c3).(del) >= fabscxx . . $ fabs(447c67c6676f75c3).(FP) * GSL_DBL_EPSILONcxx . . $ `external/gsl/gsl_machine.h:17:9`!);
339
340 FP *= F;
341
342 if(lmax > 0) {
343 /* downward recursion */
344 double XP2 = FP;
345 double PL = lmax * x_inv;
346 int L = lmax;
347 int LP;
348 jl_x[lmax] = F;
349 for(LP = 1; LP<=lmax; LP++) {
350 jl_x[L-1] = PL * jl_x[L] + XP2;
351 FP = PL*jl_x[L-1] - jl_x[L];
352 XP2 = FP;
353 PL -= x_inv;
354 --L;
355 }
356 F = jl_x[0];
357 }
358
359 /* normalization */
360 W = x_inv / hypotcxx . . $ hypot(d8e7e0733fa41c87).(FP, F);
361 jl_x[0] = W*F;
362 if(lmax > 0) {
363 int L;
364 for(L=1; L<=lmax; L++) {
365 jl_x[L] *= W;
366 }
367 }
368
369 return GSL_SUCCESScxx . . $ GSL_SUCCESS.;
370 }
371 }
372
373
374 /*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/
375
376 #include "gsl_specfunc__eval.h"cxx . . $ `<file>/external/gsl/gsl_specfunc__eval.h`/
377
378 double gsl_sf_bessel_j0cxx . . $ gsl_sf_bessel_j0(447c67c6676f75c3).(const double x)
379 {
380 EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_bessel_j0_e(x, &result));
381 }
382
383 double gsl_sf_bessel_j1cxx . . $ gsl_sf_bessel_j1(447c67c6676f75c3).(const double x)
384 {
385 EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_bessel_j1_e(x, &result));
386 }
387
388 double gsl_sf_bessel_j2cxx . . $ gsl_sf_bessel_j2(447c67c6676f75c3).(const double x)
389 {
390 EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_bessel_j2_e(x, &result));
391 }
392
393 double gsl_sf_bessel_jlcxx . . $ gsl_sf_bessel_jl(538a8530131fd110).(const int l, const double x)
394 {
395 EVAL_RESULTcxx . . $ `external/gsl/gsl_specfunc__eval.h:3:9`!(gsl_sf_bessel_jl_e(l, x, &result));
396 }
397