1 /* specfunc/bessel_amp_phase.c
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman
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.
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.
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.
20 /* Author: G. Jungman */
24 #include <gsl/gsl_math.h>
25 #include <gsl/gsl_errno.h>
26 #include <gsl/gsl_sf_bessel.h>
27 #include "bessel_amp_phase.h"
29 /* chebyshev expansions for amplitude and phase
30 functions used in bessel evaluations
32 These are the same for J0,Y0 and for J1,Y1, so
33 they sit outside those functions.
36 static double bm0_data[21] = {
59 const cheb_series _gsl_sf_bessel_amp_phase_bm0_cs = {
66 static double bth0_data[24] = {
69 -0.000062183633402968,
71 -0.000000456093019869,
73 -0.000000010300442889,
75 -0.000000000428198396,
77 -0.000000000026363898,
79 -0.000000000002144188,
81 -0.000000000000215126,
83 -0.000000000000025465,
85 -0.000000000000003448,
87 -0.000000000000000522,
89 -0.000000000000000087,
92 const cheb_series _gsl_sf_bessel_amp_phase_bth0_cs = {
100 static double bm1_data[21] = {
103 -0.00005661639504035,
105 -0.00000017377182007,
107 -0.00000000265416023,
109 -0.00000000008691795,
111 -0.00000000000451884,
113 -0.00000000000032265,
115 -0.00000000000002913,
117 -0.00000000000000315,
119 -0.00000000000000039,
121 -0.00000000000000005,
123 const cheb_series _gsl_sf_bessel_amp_phase_bm1_cs = {
130 static double bth1_data[24] = {
132 -0.004571755659637690,
133 0.000119818510964326,
134 -0.000006964561891648,
135 0.000000655495621447,
136 -0.000000084066228945,
137 0.000000013376886564,
138 -0.000000002499565654,
139 0.000000000529495100,
140 -0.000000000124135944,
141 0.000000000031656485,
142 -0.000000000008668640,
143 0.000000000002523758,
144 -0.000000000000775085,
145 0.000000000000249527,
146 -0.000000000000083773,
147 0.000000000000029205,
148 -0.000000000000010534,
149 0.000000000000003919,
150 -0.000000000000001500,
151 0.000000000000000589,
152 -0.000000000000000237,
153 0.000000000000000097,
154 -0.000000000000000040,
156 const cheb_series _gsl_sf_bessel_amp_phase_bth1_cs = {
165 gsl_sf_bessel_asymp_Mnu_e(const double nu, const double x, double * result)
167 const double r = 2.0*nu/x;
168 const double r2 = r*r;
169 const double x2 = x*x;
170 const double term1 = (r2-1.0/x2)/8.0;
171 const double term2 = (r2-1.0/x2)*(r2-9.0/x2)*3.0/128.0;
172 const double Mnu2_c = 2.0/(M_PI) * (1.0 + term1 + term2);
173 *result = sqrt(Mnu2_c)/sqrt(x); /* will never underflow this way */
179 gsl_sf_bessel_asymp_thetanu_corr_e(const double nu, const double x, double * result)
181 const double r = 2.0*nu/x;
182 const double r2 = r*r;
183 const double x2 = x*x;
184 const double term1 = x*(r2 - 1.0/x2)/8.0;
185 const double term2 = x*(r2 - 1.0/x2)*(r2 - 25.0/x2)/384.0;
186 *result = (-0.25*M_PI + term1 + term2);