summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Numeric/GSL/Special/gsl_sf_legendre.h319
1 files changed, 319 insertions, 0 deletions
diff --git a/lib/Numeric/GSL/Special/gsl_sf_legendre.h b/lib/Numeric/GSL/Special/gsl_sf_legendre.h
new file mode 100644
index 0000000..f8068f4
--- /dev/null
+++ b/lib/Numeric/GSL/Special/gsl_sf_legendre.h
@@ -0,0 +1,319 @@
1/* specfunc/gsl_sf_legendre.h
2 *
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 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 2 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#ifndef __GSL_SF_LEGENDRE_H__
23#define __GSL_SF_LEGENDRE_H__
24
25#include <gsl/gsl_sf_result.h>
26
27#undef __BEGIN_DECLS
28#undef __END_DECLS
29#ifdef __cplusplus
30# define __BEGIN_DECLS extern "C" {
31# define __END_DECLS }
32#else
33# define __BEGIN_DECLS /* empty */
34# define __END_DECLS /* empty */
35#endif
36
37__BEGIN_DECLS
38
39
40/* P_l(x) l >= 0; |x| <= 1
41 *
42 * exceptions: GSL_EDOM
43 */
44int gsl_sf_legendre_Pl_e(const int l, const double x, gsl_sf_result * result);
45double gsl_sf_legendre_Pl(const int l, const double x);
46
47
48/* P_l(x) for l=0,...,lmax; |x| <= 1
49 *
50 * exceptions: GSL_EDOM
51 */
52int gsl_sf_legendre_Pl_array(
53 const int lmax, const double x,
54 double * result_array
55 );
56
57
58/* P_l(x) and P_l'(x) for l=0,...,lmax; |x| <= 1
59 *
60 * exceptions: GSL_EDOM
61 */
62int gsl_sf_legendre_Pl_deriv_array(
63 const int lmax, const double x,
64 double * result_array,
65 double * result_deriv_array
66 );
67
68
69/* P_l(x), l=1,2,3
70 *
71 * exceptions: none
72 */
73int gsl_sf_legendre_P1_e(double x, gsl_sf_result * result);
74int gsl_sf_legendre_P2_e(double x, gsl_sf_result * result);
75int gsl_sf_legendre_P3_e(double x, gsl_sf_result * result);
76double gsl_sf_legendre_P1(const double x);
77double gsl_sf_legendre_P2(const double x);
78double gsl_sf_legendre_P3(const double x);
79
80
81/* Q_0(x), x > -1, x != 1
82 *
83 * exceptions: GSL_EDOM
84 */
85int gsl_sf_legendre_Q0_e(const double x, gsl_sf_result * result);
86double gsl_sf_legendre_Q0(const double x);
87
88
89/* Q_1(x), x > -1, x != 1
90 *
91 * exceptions: GSL_EDOM
92 */
93int gsl_sf_legendre_Q1_e(const double x, gsl_sf_result * result);
94double gsl_sf_legendre_Q1(const double x);
95
96
97/* Q_l(x), x > -1, x != 1, l >= 0
98 *
99 * exceptions: GSL_EDOM
100 */
101int gsl_sf_legendre_Ql_e(const int l, const double x, gsl_sf_result * result);
102double gsl_sf_legendre_Ql(const int l, const double x);
103
104
105/* P_l^m(x) m >= 0; l >= m; |x| <= 1.0
106 *
107 * Note that this function grows combinatorially with l.
108 * Therefore we can easily generate an overflow for l larger
109 * than about 150.
110 *
111 * There is no trouble for small m, but when m and l are both large,
112 * then there will be trouble. Rather than allow overflows, these
113 * functions refuse to calculate when they can sense that l and m are
114 * too big.
115 *
116 * If you really want to calculate a spherical harmonic, then DO NOT
117 * use this. Instead use legendre_sphPlm() below, which uses a similar
118 * recursion, but with the normalized functions.
119 *
120 * exceptions: GSL_EDOM, GSL_EOVRFLW
121 */
122int gsl_sf_legendre_Plm_e(const int l, const int m, const double x, gsl_sf_result * result);
123double gsl_sf_legendre_Plm(const int l, const int m, const double x);
124
125
126/* P_l^m(x) m >= 0; l >= m; |x| <= 1.0
127 * l=|m|,...,lmax
128 *
129 * exceptions: GSL_EDOM, GSL_EOVRFLW
130 */
131int gsl_sf_legendre_Plm_array(
132 const int lmax, const int m, const double x,
133 double * result_array
134 );
135
136
137/* P_l^m(x) and d(P_l^m(x))/dx; m >= 0; lmax >= m; |x| <= 1.0
138 * l=|m|,...,lmax
139 *
140 * exceptions: GSL_EDOM, GSL_EOVRFLW
141 */
142int gsl_sf_legendre_Plm_deriv_array(
143 const int lmax, const int m, const double x,
144 double * result_array,
145 double * result_deriv_array
146 );
147
148
149/* P_l^m(x), normalized properly for use in spherical harmonics
150 * m >= 0; l >= m; |x| <= 1.0
151 *
152 * There is no overflow problem, as there is for the
153 * standard normalization of P_l^m(x).
154 *
155 * Specifically, it returns:
156 *
157 * sqrt((2l+1)/(4pi)) sqrt((l-m)!/(l+m)!) P_l^m(x)
158 *
159 * exceptions: GSL_EDOM
160 */
161int gsl_sf_legendre_sphPlm_e(const int l, int m, const double x, gsl_sf_result * result);
162double gsl_sf_legendre_sphPlm(const int l, const int m, const double x);
163
164
165/* sphPlm(l,m,x) values
166 * m >= 0; l >= m; |x| <= 1.0
167 * l=|m|,...,lmax
168 *
169 * exceptions: GSL_EDOM
170 */
171int gsl_sf_legendre_sphPlm_array(
172 const int lmax, int m, const double x,
173 double * result_array
174 );
175
176
177/* sphPlm(l,m,x) and d(sphPlm(l,m,x))/dx values
178 * m >= 0; l >= m; |x| <= 1.0
179 * l=|m|,...,lmax
180 *
181 * exceptions: GSL_EDOM
182 */
183int gsl_sf_legendre_sphPlm_deriv_array(
184 const int lmax, const int m, const double x,
185 double * result_array,
186 double * result_deriv_array
187 );
188
189
190
191/* size of result_array[] needed for the array versions of Plm
192 * (lmax - m + 1)
193 */
194int gsl_sf_legendre_array_size(const int lmax, const int m);
195
196
197/* Irregular Spherical Conical Function
198 * P^{1/2}_{-1/2 + I lambda}(x)
199 *
200 * x > -1.0
201 * exceptions: GSL_EDOM
202 */
203int gsl_sf_conicalP_half_e(const double lambda, const double x, gsl_sf_result * result);
204double gsl_sf_conicalP_half(const double lambda, const double x);
205
206
207/* Regular Spherical Conical Function
208 * P^{-1/2}_{-1/2 + I lambda}(x)
209 *
210 * x > -1.0
211 * exceptions: GSL_EDOM
212 */
213int gsl_sf_conicalP_mhalf_e(const double lambda, const double x, gsl_sf_result * result);
214double gsl_sf_conicalP_mhalf(const double lambda, const double x);
215
216
217/* Conical Function
218 * P^{0}_{-1/2 + I lambda}(x)
219 *
220 * x > -1.0
221 * exceptions: GSL_EDOM
222 */
223int gsl_sf_conicalP_0_e(const double lambda, const double x, gsl_sf_result * result);
224double gsl_sf_conicalP_0(const double lambda, const double x);
225
226
227/* Conical Function
228 * P^{1}_{-1/2 + I lambda}(x)
229 *
230 * x > -1.0
231 * exceptions: GSL_EDOM
232 */
233int gsl_sf_conicalP_1_e(const double lambda, const double x, gsl_sf_result * result);
234double gsl_sf_conicalP_1(const double lambda, const double x);
235
236
237/* Regular Spherical Conical Function
238 * P^{-1/2-l}_{-1/2 + I lambda}(x)
239 *
240 * x > -1.0, l >= -1
241 * exceptions: GSL_EDOM
242 */
243int gsl_sf_conicalP_sph_reg_e(const int l, const double lambda, const double x, gsl_sf_result * result);
244double gsl_sf_conicalP_sph_reg(const int l, const double lambda, const double x);
245
246
247/* Regular Cylindrical Conical Function
248 * P^{-m}_{-1/2 + I lambda}(x)
249 *
250 * x > -1.0, m >= -1
251 * exceptions: GSL_EDOM
252 */
253int gsl_sf_conicalP_cyl_reg_e(const int m, const double lambda, const double x, gsl_sf_result * result);
254double gsl_sf_conicalP_cyl_reg(const int m, const double lambda, const double x);
255
256
257/* The following spherical functions are specializations
258 * of Legendre functions which give the regular eigenfunctions
259 * of the Laplacian on a 3-dimensional hyperbolic space.
260 * Of particular interest is the flat limit, which is
261 * Flat-Lim := {lambda->Inf, eta->0, lambda*eta fixed}.
262 */
263
264/* Zeroth radial eigenfunction of the Laplacian on the
265 * 3-dimensional hyperbolic space.
266 *
267 * legendre_H3d_0(lambda,eta) := sin(lambda*eta)/(lambda*sinh(eta))
268 *
269 * Normalization:
270 * Flat-Lim legendre_H3d_0(lambda,eta) = j_0(lambda*eta)
271 *
272 * eta >= 0.0
273 * exceptions: GSL_EDOM
274 */
275int gsl_sf_legendre_H3d_0_e(const double lambda, const double eta, gsl_sf_result * result);
276double gsl_sf_legendre_H3d_0(const double lambda, const double eta);
277
278
279/* First radial eigenfunction of the Laplacian on the
280 * 3-dimensional hyperbolic space.
281 *
282 * legendre_H3d_1(lambda,eta) :=
283 * 1/sqrt(lambda^2 + 1) sin(lam eta)/(lam sinh(eta))
284 * (coth(eta) - lambda cot(lambda*eta))
285 *
286 * Normalization:
287 * Flat-Lim legendre_H3d_1(lambda,eta) = j_1(lambda*eta)
288 *
289 * eta >= 0.0
290 * exceptions: GSL_EDOM
291 */
292int gsl_sf_legendre_H3d_1_e(const double lambda, const double eta, gsl_sf_result * result);
293double gsl_sf_legendre_H3d_1(const double lambda, const double eta);
294
295
296/* l'th radial eigenfunction of the Laplacian on the
297 * 3-dimensional hyperbolic space.
298 *
299 * Normalization:
300 * Flat-Lim legendre_H3d_l(l,lambda,eta) = j_l(lambda*eta)
301 *
302 * eta >= 0.0, l >= 0
303 * exceptions: GSL_EDOM
304 */
305int gsl_sf_legendre_H3d_e(const int l, const double lambda, const double eta, gsl_sf_result * result);
306double gsl_sf_legendre_H3d(const int l, const double lambda, const double eta);
307
308
309/* Array of H3d(ell), 0 <= ell <= lmax
310 */
311int gsl_sf_legendre_H3d_array(const int lmax, const double lambda, const double eta, double * result_array);
312
313
314
315
316
317__END_DECLS
318
319#endif /* __GSL_SF_LEGENDRE_H__ */