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);
196 /* Irregular Spherical Conical Function
197 * P^{1/2}_{-1/2 + I lambda}(x)
200 * exceptions: GSL_EDOM
202 int gsl_sf_conicalP_half_e(const double lambda, const double x, gsl_sf_result * result);
203 double gsl_sf_conicalP_half(const double lambda, const double x);
206 /* Regular Spherical Conical Function
207 * P^{-1/2}_{-1/2 + I lambda}(x)
210 * exceptions: GSL_EDOM
212 int gsl_sf_conicalP_mhalf_e(const double lambda, const double x, gsl_sf_result * result);
213 double gsl_sf_conicalP_mhalf(const double lambda, const double x);
217 * P^{0}_{-1/2 + I lambda}(x)
220 * exceptions: GSL_EDOM
222 int gsl_sf_conicalP_0_e(const double lambda, const double x, gsl_sf_result * result);
223 double gsl_sf_conicalP_0(const double lambda, const double x);
227 * P^{1}_{-1/2 + I lambda}(x)
230 * exceptions: GSL_EDOM
232 int gsl_sf_conicalP_1_e(const double lambda, const double x, gsl_sf_result * result);
233 double gsl_sf_conicalP_1(const double lambda, const double x);
236 /* Regular Spherical Conical Function
237 * P^{-1/2-l}_{-1/2 + I lambda}(x)
240 * exceptions: GSL_EDOM
242 int gsl_sf_conicalP_sph_reg_e(const int l, const double lambda, const double x, gsl_sf_result * result);
243 double gsl_sf_conicalP_sph_reg(const int l, const double lambda, const double x);
246 /* Regular Cylindrical Conical Function
247 * P^{-m}_{-1/2 + I lambda}(x)
250 * exceptions: GSL_EDOM
252 int gsl_sf_conicalP_cyl_reg_e(const int m, const double lambda, const double x, gsl_sf_result * result);
253 double gsl_sf_conicalP_cyl_reg(const int m, const double lambda, const double x);
256 /* The following spherical functions are specializations
257 * of Legendre functions which give the regular eigenfunctions
258 * of the Laplacian on a 3-dimensional hyperbolic space.
259 * Of particular interest is the flat limit, which is
260 * Flat-Lim := {lambda->Inf, eta->0, lambda*eta fixed}.
263 /* Zeroth radial eigenfunction of the Laplacian on the
264 * 3-dimensional hyperbolic space.
266 * legendre_H3d_0(lambda,eta) := sin(lambda*eta)/(lambda*sinh(eta))
269 * Flat-Lim legendre_H3d_0(lambda,eta) = j_0(lambda*eta)
272 * exceptions: GSL_EDOM
274 int gsl_sf_legendre_H3d_0_e(const double lambda, const double eta, gsl_sf_result * result);
275 double gsl_sf_legendre_H3d_0(const double lambda, const double eta);
278 /* First radial eigenfunction of the Laplacian on the
279 * 3-dimensional hyperbolic space.
281 * legendre_H3d_1(lambda,eta) :=
282 * 1/sqrt(lambda^2 + 1) sin(lam eta)/(lam sinh(eta))
283 * (coth(eta) - lambda cot(lambda*eta))
286 * Flat-Lim legendre_H3d_1(lambda,eta) = j_1(lambda*eta)
289 * exceptions: GSL_EDOM
291 int gsl_sf_legendre_H3d_1_e(const double lambda, const double eta, gsl_sf_result * result);
292 double gsl_sf_legendre_H3d_1(const double lambda, const double eta);
295 /* l'th radial eigenfunction of the Laplacian on the
296 * 3-dimensional hyperbolic space.
299 * Flat-Lim legendre_H3d_l(l,lambda,eta) = j_l(lambda*eta)
302 * exceptions: GSL_EDOM
304 int gsl_sf_legendre_H3d_e(const int l, const double lambda, const double eta, gsl_sf_result * result);
305 double gsl_sf_legendre_H3d(const int l, const double lambda, const double eta);
308 /* Array of H3d(ell), 0 <= ell <= lmax
310 int gsl_sf_legendre_H3d_array(const int lmax, const double lambda, const double eta, double * result_array);
315 #endif /* __GSL_SF_LEGENDRE_H__ */