1 /* specfunc/gsl_sf_legendre.h
3 * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004 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 */
22 #ifndef __GSL_SF_LEGENDRE_H__
23 #define __GSL_SF_LEGENDRE_H__
25 #include <gsl/gsl_sf_result.h>
30 # define __BEGIN_DECLS extern "C" {
31 # define __END_DECLS }
33 # define __BEGIN_DECLS /* empty */
34 # define __END_DECLS /* empty */
40 /* P_l(x) l >= 0; |x| <= 1
42 * exceptions: GSL_EDOM
44 int gsl_sf_legendre_Pl_e(const int l, const double x, gsl_sf_result * result);
45 double gsl_sf_legendre_Pl(const int l, const double x);
48 /* P_l(x) for l=0,...,lmax; |x| <= 1
50 * exceptions: GSL_EDOM
52 int gsl_sf_legendre_Pl_array(
53 const int lmax, const double x,
58 /* P_l(x) and P_l'(x) for l=0,...,lmax; |x| <= 1
60 * exceptions: GSL_EDOM
62 int gsl_sf_legendre_Pl_deriv_array(
63 const int lmax, const double x,
64 double * result_array,
65 double * result_deriv_array
73 int gsl_sf_legendre_P1_e(double x, gsl_sf_result * result);
74 int gsl_sf_legendre_P2_e(double x, gsl_sf_result * result);
75 int gsl_sf_legendre_P3_e(double x, gsl_sf_result * result);
76 double gsl_sf_legendre_P1(const double x);
77 double gsl_sf_legendre_P2(const double x);
78 double gsl_sf_legendre_P3(const double x);
81 /* Q_0(x), x > -1, x != 1
83 * exceptions: GSL_EDOM
85 int gsl_sf_legendre_Q0_e(const double x, gsl_sf_result * result);
86 double gsl_sf_legendre_Q0(const double x);
89 /* Q_1(x), x > -1, x != 1
91 * exceptions: GSL_EDOM
93 int gsl_sf_legendre_Q1_e(const double x, gsl_sf_result * result);
94 double gsl_sf_legendre_Q1(const double x);
97 /* Q_l(x), x > -1, x != 1, l >= 0
99 * exceptions: GSL_EDOM
101 int gsl_sf_legendre_Ql_e(const int l, const double x, gsl_sf_result * result);
102 double gsl_sf_legendre_Ql(const int l, const double x);
105 /* P_l^m(x) m >= 0; l >= m; |x| <= 1.0
107 * Note that this function grows combinatorially with l.
108 * Therefore we can easily generate an overflow for l larger
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
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.
120 * exceptions: GSL_EDOM, GSL_EOVRFLW
122 int gsl_sf_legendre_Plm_e(const int l, const int m, const double x, gsl_sf_result * result);
123 double gsl_sf_legendre_Plm(const int l, const int m, const double x);
126 /* P_l^m(x) m >= 0; l >= m; |x| <= 1.0
129 * exceptions: GSL_EDOM, GSL_EOVRFLW
131 int gsl_sf_legendre_Plm_array(
132 const int lmax, const int m, const double x,
133 double * result_array
137 /* P_l^m(x) and d(P_l^m(x))/dx; m >= 0; lmax >= m; |x| <= 1.0
140 * exceptions: GSL_EDOM, GSL_EOVRFLW
142 int 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
149 /* P_l^m(x), normalized properly for use in spherical harmonics
150 * m >= 0; l >= m; |x| <= 1.0
152 * There is no overflow problem, as there is for the
153 * standard normalization of P_l^m(x).
155 * Specifically, it returns:
157 * sqrt((2l+1)/(4pi)) sqrt((l-m)!/(l+m)!) P_l^m(x)
159 * exceptions: GSL_EDOM
161 int gsl_sf_legendre_sphPlm_e(const int l, int m, const double x, gsl_sf_result * result);
162 double gsl_sf_legendre_sphPlm(const int l, const int m, const double x);
165 /* sphPlm(l,m,x) values
166 * m >= 0; l >= m; |x| <= 1.0
169 * exceptions: GSL_EDOM
171 int gsl_sf_legendre_sphPlm_array(
172 const int lmax, int m, const double x,
173 double * result_array
177 /* sphPlm(l,m,x) and d(sphPlm(l,m,x))/dx values
178 * m >= 0; l >= m; |x| <= 1.0
181 * exceptions: GSL_EDOM
183 int 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
191 /* size of result_array[] needed for the array versions of Plm
194 int gsl_sf_legendre_array_size(const int lmax, const int m);
197 /* Irregular Spherical Conical Function
198 * P^{1/2}_{-1/2 + I lambda}(x)
201 * exceptions: GSL_EDOM
203 int gsl_sf_conicalP_half_e(const double lambda, const double x, gsl_sf_result * result);
204 double gsl_sf_conicalP_half(const double lambda, const double x);
207 /* Regular Spherical Conical Function
208 * P^{-1/2}_{-1/2 + I lambda}(x)
211 * exceptions: GSL_EDOM
213 int gsl_sf_conicalP_mhalf_e(const double lambda, const double x, gsl_sf_result * result);
214 double gsl_sf_conicalP_mhalf(const double lambda, const double x);
218 * P^{0}_{-1/2 + I lambda}(x)
221 * exceptions: GSL_EDOM
223 int gsl_sf_conicalP_0_e(const double lambda, const double x, gsl_sf_result * result);
224 double gsl_sf_conicalP_0(const double lambda, const double x);
228 * P^{1}_{-1/2 + I lambda}(x)
231 * exceptions: GSL_EDOM
233 int gsl_sf_conicalP_1_e(const double lambda, const double x, gsl_sf_result * result);
234 double gsl_sf_conicalP_1(const double lambda, const double x);
237 /* Regular Spherical Conical Function
238 * P^{-1/2-l}_{-1/2 + I lambda}(x)
241 * exceptions: GSL_EDOM
243 int gsl_sf_conicalP_sph_reg_e(const int l, const double lambda, const double x, gsl_sf_result * result);
244 double gsl_sf_conicalP_sph_reg(const int l, const double lambda, const double x);
247 /* Regular Cylindrical Conical Function
248 * P^{-m}_{-1/2 + I lambda}(x)
251 * exceptions: GSL_EDOM
253 int gsl_sf_conicalP_cyl_reg_e(const int m, const double lambda, const double x, gsl_sf_result * result);
254 double gsl_sf_conicalP_cyl_reg(const int m, const double lambda, const double x);
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}.
264 /* Zeroth radial eigenfunction of the Laplacian on the
265 * 3-dimensional hyperbolic space.
267 * legendre_H3d_0(lambda,eta) := sin(lambda*eta)/(lambda*sinh(eta))
270 * Flat-Lim legendre_H3d_0(lambda,eta) = j_0(lambda*eta)
273 * exceptions: GSL_EDOM
275 int gsl_sf_legendre_H3d_0_e(const double lambda, const double eta, gsl_sf_result * result);
276 double gsl_sf_legendre_H3d_0(const double lambda, const double eta);
279 /* First radial eigenfunction of the Laplacian on the
280 * 3-dimensional hyperbolic space.
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))
287 * Flat-Lim legendre_H3d_1(lambda,eta) = j_1(lambda*eta)
290 * exceptions: GSL_EDOM
292 int gsl_sf_legendre_H3d_1_e(const double lambda, const double eta, gsl_sf_result * result);
293 double gsl_sf_legendre_H3d_1(const double lambda, const double eta);
296 /* l'th radial eigenfunction of the Laplacian on the
297 * 3-dimensional hyperbolic space.
300 * Flat-Lim legendre_H3d_l(l,lambda,eta) = j_l(lambda*eta)
303 * exceptions: GSL_EDOM
305 int gsl_sf_legendre_H3d_e(const int l, const double lambda, const double eta, gsl_sf_result * result);
306 double gsl_sf_legendre_H3d(const int l, const double lambda, const double eta);
309 /* Array of H3d(ell), 0 <= ell <= lmax
311 int gsl_sf_legendre_H3d_array(const int lmax, const double lambda, const double eta, double * result_array);
317 gsl_sf_legendre_array_size(const int lmax, const int m)
321 #endif /* HAVE_INLINE */
326 #endif /* __GSL_SF_LEGENDRE_H__ */