File: Associated-Legendre-Polynomials-and-Spherical-Harmonics.html

package info (click to toggle)
gsl-ref-html 2.3-1
  • links: PTS
  • area: non-free
  • in suites: bullseye, sid
  • size: 6,876 kB
  • ctags: 4,574
  • sloc: makefile: 35
file content (308 lines) | stat: -rw-r--r-- 19,373 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 The GSL Team.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with the
Invariant Sections being "GNU General Public License" and "Free Software
Needs Free Documentation", the Front-Cover text being "A GNU Manual",
and with the Back-Cover Text being (a) (see below). A copy of the
license is included in the section entitled "GNU Free Documentation
License".

(a) The Back-Cover Text is: "You have the freedom to copy and modify this
GNU Manual." -->
<!-- Created by GNU Texinfo 5.1, http://www.gnu.org/software/texinfo/ -->
<head>
<title>GNU Scientific Library &ndash; Reference Manual: Associated Legendre Polynomials and Spherical Harmonics</title>

<meta name="description" content="GNU Scientific Library &ndash; Reference Manual: Associated Legendre Polynomials and Spherical Harmonics">
<meta name="keywords" content="GNU Scientific Library &ndash; Reference Manual: Associated Legendre Polynomials and Spherical Harmonics">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Function-Index.html#Function-Index" rel="index" title="Function Index">
<link href="Legendre-Functions-and-Spherical-Harmonics.html#Legendre-Functions-and-Spherical-Harmonics" rel="up" title="Legendre Functions and Spherical Harmonics">
<link href="Conical-Functions.html#Conical-Functions" rel="next" title="Conical Functions">
<link href="Legendre-Polynomials.html#Legendre-Polynomials" rel="previous" title="Legendre Polynomials">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.indentedblock {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
div.smalllisp {margin-left: 3.2em}
kbd {font-style:oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nocodebreak {white-space:nowrap}
span.nolinebreak {white-space:nowrap}
span.roman {font-family:serif; font-weight:normal}
span.sansserif {font-family:sans-serif; font-weight:normal}
ul.no-bullet {list-style: none}
-->
</style>


</head>

<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
<a name="Associated-Legendre-Polynomials-and-Spherical-Harmonics"></a>
<div class="header">
<p>
Next: <a href="Conical-Functions.html#Conical-Functions" accesskey="n" rel="next">Conical Functions</a>, Previous: <a href="Legendre-Polynomials.html#Legendre-Polynomials" accesskey="p" rel="previous">Legendre Polynomials</a>, Up: <a href="Legendre-Functions-and-Spherical-Harmonics.html#Legendre-Functions-and-Spherical-Harmonics" accesskey="u" rel="up">Legendre Functions and Spherical Harmonics</a> &nbsp; [<a href="Function-Index.html#Function-Index" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Associated-Legendre-Polynomials-and-Spherical-Harmonics-1"></a>
<h4 class="subsection">7.24.2 Associated Legendre Polynomials and Spherical Harmonics</h4>

<p>The following functions compute the associated Legendre polynomials
<em>P_l^m(x)</em> which are solutions of the differential equation
</p>
<div class="example">
<pre class="example">(1 - x^2) d^2 P_l^m(x) / dx^2 P_l^m(x) - 2x d/dx P_l^m(x) +
( l(l+1) - m^2 / (1 - x^2) ) P_l^m(x) = 0
</pre></div>

<p>where the degree <em>l</em> and order <em>m</em> satisfy <em>0 \le l</em> and
<em>0 \le m \le l</em>.
The functions <em>P_l^m(x)</em> grow combinatorially with
<em>l</em> and can overflow for <em>l</em> larger than about 150.
Alternatively, one may calculate normalized associated Legendre
polynomials. There are a number of different normalization conventions,
and these
functions can be stably computed up to degree and order 2700. The
following normalizations are provided:
</p><dl compact="compact">
<dt><code>Schmidt semi-normalization</code></dt>
<dd><p>Schmidt semi-normalized associated Legendre polynomials are often
used in the magnetics community and are defined as
</p><div class="example">
<pre class="example">S_l^0(x) = P_l^0(x)
S_l^m(x) = (-1)^m \sqrt((2(l-m)! / (l+m)!)) P_l^m(x), m &gt; 0 
</pre></div>
<p>The factor of <em>(-1)^m</em> is called the Condon-Shortley phase
factor and can be excluded if desired by setting the parameter
<code>csphase = 1</code> in the functions below.
</p>
</dd>
<dt><code>Spherical Harmonic Normalization</code></dt>
<dd><p>The associated Legendre polynomials suitable for calculating spherical
harmonics are defined as
</p><div class="example">
<pre class="example">Y_l^m(x) = (-1)^m \sqrt((2l + 1) * (l-m)! / (4 \pi) / (l+m)!) P_l^m(x)
</pre></div>
<p>where again the phase factor <em>(-1)^m</em> can be included or excluded
if desired.
</p>
</dd>
<dt><code>Full Normalization</code></dt>
<dd><p>The fully normalized associated Legendre polynomials are defined as
</p><div class="example">
<pre class="example">N_l^m(x) = (-1)^m \sqrt((l + 1/2) * (l-m)! / (l+m)!) P_l^m(x)
</pre></div>
<p>and have the property
</p><div class="example">
<pre class="example">\int_(-1)^1 ( N_l^m(x) )^2 dx = 1
</pre></div>

</dd>
</dl>
<p>The normalized associated Legendre routines below use a recurrence
relation which is stable up to a degree and order of about 2700.
Beyond this, the computed functions could suffer from underflow
leading to incorrect results. Routines are provided to compute
first and second derivatives
<em>dP_l^m(x)/dx</em> and <em>d^2 P_l^m(x)/dx^2</em> as well as their alternate
versions <em>d P_l^m(\cos{\theta})/d\theta</em> and
<em>d^2 P_l^m(\cos{\theta})/d\theta^2</em>. While there is a simple
scaling relationship between the two forms, the derivatives
involving <em>\theta</em> are heavily used in spherical harmonic
expansions and so these routines are also provided.
</p>
<p>In the functions below, a parameter of type <code>gsl_sf_legendre_t</code>
specifies the type of normalization to use. The possible values are
</p><dl compact="compact">
<dt><code>GSL_SF_LEGENDRE_NONE</code></dt>
<dd><p>This specifies the computation of the unnormalized associated
Legendre polynomials <em>P_l^m(x)</em>.
</p>
</dd>
<dt><code>GSL_SF_LEGENDRE_SCHMIDT</code></dt>
<dd><p>This specifies the computation of the Schmidt semi-normalized associated
Legendre polynomials <em>S_l^m(x)</em>.
</p>
</dd>
<dt><code>GSL_SF_LEGENDRE_SPHARM</code></dt>
<dd><p>This specifies the computation of the spherical harmonic associated
Legendre polynomials <em>Y_l^m(x)</em>.
</p>
</dd>
<dt><code>GSL_SF_LEGENDRE_FULL</code></dt>
<dd><p>This specifies the computation of the fully normalized associated
Legendre polynomials <em>N_l^m(x)</em>.
</p></dd>
</dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005farray"></a>Function: <em>int</em> <strong>gsl_sf_legendre_array</strong> <em>(const gsl_sf_legendre_t <var>norm</var>, const size_t <var>lmax</var>, const double <var>x</var>, double <var>result_array</var>[])</em></dt>
<dt><a name="index-gsl_005fsf_005flegendre_005farray_005fe"></a>Function: <em>int</em> <strong>gsl_sf_legendre_array_e</strong> <em>(const gsl_sf_legendre_t <var>norm</var>, const size_t <var>lmax</var>, const double <var>x</var>, const double <var>csphase</var>, double <var>result_array</var>[])</em></dt>
<dd><p>These functions calculate all normalized associated Legendre
polynomials for <em>0 \le l \le lmax</em> and
<em>0 \le m \le l</em> for
<em>|x| &lt;= 1</em>.
The <var>norm</var> parameter specifies which normalization is used.
The normalized <em>P_l^m(x)</em> values are stored in <var>result_array</var>, whose
minimum size can be obtained from calling <code>gsl_sf_legendre_array_n</code>.
The array index of <em>P_l^m(x)</em> is obtained from calling
<code>gsl_sf_legendre_array_index(l, m)</code>. To include or exclude
the Condon-Shortley phase factor of <em>(-1)^m</em>, set the parameter
<var>csphase</var> to either <em>-1</em> or <em>1</em> respectively in the
<code>_e</code> function. This factor is included by default.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005fderiv_005farray"></a>Function: <em>int</em> <strong>gsl_sf_legendre_deriv_array</strong> <em>(const gsl_sf_legendre_t <var>norm</var>, const size_t <var>lmax</var>, const double <var>x</var>, double <var>result_array</var>[], double <var>result_deriv_array</var>[])</em></dt>
<dt><a name="index-gsl_005fsf_005flegendre_005fderiv_005farray_005fe"></a>Function: <em>int</em> <strong>gsl_sf_legendre_deriv_array_e</strong> <em>(const gsl_sf_legendre_t <var>norm</var>, const size_t <var>lmax</var>, const double <var>x</var>, const double <var>csphase</var>, double <var>result_array</var>[], double <var>result_deriv_array</var>[])</em></dt>
<dd><p>These functions calculate all normalized associated Legendre
functions and their first derivatives up to degree <var>lmax</var> for
<em>|x| &lt; 1</em>.
The parameter <var>norm</var> specifies the normalization used. The
normalized <em>P_l^m(x)</em> values and their derivatives
<em>dP_l^m(x)/dx</em> are stored in <var>result_array</var> and
<var>result_deriv_array</var> respectively.
To include or exclude
the Condon-Shortley phase factor of <em>(-1)^m</em>, set the parameter
<var>csphase</var> to either <em>-1</em> or <em>1</em> respectively in the
<code>_e</code> function. This factor is included by default.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005fderiv_005falt_005farray"></a>Function: <em>int</em> <strong>gsl_sf_legendre_deriv_alt_array</strong> <em>(const gsl_sf_legendre_t <var>norm</var>, const size_t <var>lmax</var>, const double <var>x</var>, double <var>result_array</var>[], double <var>result_deriv_array</var>[])</em></dt>
<dt><a name="index-gsl_005fsf_005flegendre_005fderiv_005falt_005farray_005fe"></a>Function: <em>int</em> <strong>gsl_sf_legendre_deriv_alt_array_e</strong> <em>(const gsl_sf_legendre_t <var>norm</var>, const size_t <var>lmax</var>, const double <var>x</var>, const double <var>csphase</var>, double <var>result_array</var>[], double <var>result_deriv_array</var>[])</em></dt>
<dd><p>These functions calculate all normalized associated Legendre
functions and their (alternate) first derivatives up to degree <var>lmax</var> for
<em>|x| &lt; 1</em>.
The normalized <em>P_l^m(x)</em> values and their derivatives
<em>dP_l^m(\cos{\theta})/d\theta</em> are stored in <var>result_array</var> and
<var>result_deriv_array</var> respectively.
To include or exclude
the Condon-Shortley phase factor of <em>(-1)^m</em>, set the parameter
<var>csphase</var> to either <em>-1</em> or <em>1</em> respectively in the
<code>_e</code> function. This factor is included by default.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005fderiv2_005farray"></a>Function: <em>int</em> <strong>gsl_sf_legendre_deriv2_array</strong> <em>(const gsl_sf_legendre_t <var>norm</var>, const size_t <var>lmax</var>, const double <var>x</var>, double <var>result_array</var>[], double <var>result_deriv_array</var>[], double <var>result_deriv2_array</var>[])</em></dt>
<dt><a name="index-gsl_005fsf_005flegendre_005fderiv2_005farray_005fe"></a>Function: <em>int</em> <strong>gsl_sf_legendre_deriv2_array_e</strong> <em>(const gsl_sf_legendre_t <var>norm</var>, const size_t <var>lmax</var>, const double <var>x</var>, const double <var>csphase</var>, double <var>result_array</var>[], double <var>result_deriv_array</var>[], double <var>result_deriv2_array</var>[])</em></dt>
<dd><p>These functions calculate all normalized associated Legendre
functions and their first and second derivatives up to degree <var>lmax</var> for
<em>|x| &lt; 1</em>.
The parameter <var>norm</var> specifies the normalization used. The
normalized <em>P_l^m(x)</em>, their first derivatives
<em>dP_l^m(x)/dx</em>, and their second derivatives
<em>d^2 P_l^m(x)/dx^2</em> are stored in <var>result_array</var>,
<var>result_deriv_array</var>, and <var>result_deriv2_array</var> respectively.
To include or exclude
the Condon-Shortley phase factor of <em>(-1)^m</em>, set the parameter
<var>csphase</var> to either <em>-1</em> or <em>1</em> respectively in the
<code>_e</code> function. This factor is included by default.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005fderiv2_005falt_005farray"></a>Function: <em>int</em> <strong>gsl_sf_legendre_deriv2_alt_array</strong> <em>(const gsl_sf_legendre_t <var>norm</var>, const size_t <var>lmax</var>, const double <var>x</var>, double <var>result_array</var>[], double <var>result_deriv_array</var>[], double <var>result_deriv2_array</var>[])</em></dt>
<dt><a name="index-gsl_005fsf_005flegendre_005fderiv2_005falt_005farray_005fe"></a>Function: <em>int</em> <strong>gsl_sf_legendre_deriv2_alt_array_e</strong> <em>(const gsl_sf_legendre_t <var>norm</var>, const size_t <var>lmax</var>, const double <var>x</var>, const double <var>csphase</var>, double <var>result_array</var>[], double <var>result_deriv_array</var>[], double <var>result_deriv2_array</var>[])</em></dt>
<dd><p>These functions calculate all normalized associated Legendre
functions and their (alternate) first and second derivatives up to degree
<var>lmax</var> for
<em>|x| &lt; 1</em>.
The parameter <var>norm</var> specifies the normalization used. The
normalized <em>P_l^m(x)</em>, their first derivatives
<em>dP_l^m(\cos{\theta})/d\theta</em>, and their second derivatives
<em>d^2 P_l^m(\cos{\theta})/d\theta^2</em> are stored in <var>result_array</var>,
<var>result_deriv_array</var>, and <var>result_deriv2_array</var> respectively.
To include or exclude
the Condon-Shortley phase factor of <em>(-1)^m</em>, set the parameter
<var>csphase</var> to either <em>-1</em> or <em>1</em> respectively in the
<code>_e</code> function. This factor is included by default.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005farray_005fn"></a>Function: <em>size_t</em> <strong>gsl_sf_legendre_array_n</strong> <em>(const size_t <var>lmax</var>)</em></dt>
<dd><p>This function returns the minimum array size for maximum degree <var>lmax</var>
needed for the array versions of the associated Legendre functions.
Size is calculated as the total number of <em>P_l^m(x)</em> functions,
plus extra space for precomputing multiplicative factors used in the
recurrence relations.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005farray_005findex"></a>Function: <em>size_t</em> <strong>gsl_sf_legendre_array_index</strong> <em>(const size_t <var>l</var>, const size_t <var>m</var>)</em></dt>
<dd><p>This function returns the index into <var>result_array</var>,
<var>result_deriv_array</var>, or <var>result_deriv2_array</var> corresponding
to <em>P_l^m(x)</em>, <em>P_l^{'m}(x)</em>, or <em>P_l^{''m}(x)</em>. The
index is given by <em>l(l+1)/2 + m</em>.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005fPlm"></a>Function: <em>double</em> <strong>gsl_sf_legendre_Plm</strong> <em>(int <var>l</var>, int <var>m</var>, double <var>x</var>)</em></dt>
<dt><a name="index-gsl_005fsf_005flegendre_005fPlm_005fe"></a>Function: <em>int</em> <strong>gsl_sf_legendre_Plm_e</strong> <em>(int <var>l</var>, int <var>m</var>, double <var>x</var>, gsl_sf_result * <var>result</var>)</em></dt>
<dd><p>These routines compute the associated Legendre polynomial
<em>P_l^m(x)</em> for <em>m &gt;= 0</em>, <em>l &gt;= m</em>, <em>|x| &lt;= 1</em>. 
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005fsphPlm"></a>Function: <em>double</em> <strong>gsl_sf_legendre_sphPlm</strong> <em>(int <var>l</var>, int <var>m</var>, double <var>x</var>)</em></dt>
<dt><a name="index-gsl_005fsf_005flegendre_005fsphPlm_005fe"></a>Function: <em>int</em> <strong>gsl_sf_legendre_sphPlm_e</strong> <em>(int <var>l</var>, int <var>m</var>, double <var>x</var>, gsl_sf_result * <var>result</var>)</em></dt>
<dd><p>These routines compute the normalized associated Legendre polynomial
<em>\sqrt{(2l+1)/(4\pi)} \sqrt{(l-m)!/(l+m)!} P_l^m(x)</em> suitable
for use in spherical harmonics.  The parameters must satisfy <em>m &gt;= 0</em>, <em>l &gt;= m</em>, <em>|x| &lt;= 1</em>. Theses routines avoid the overflows
that occur for the standard normalization of <em>P_l^m(x)</em>.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005fPlm_005farray"></a>Function: <em>int</em> <strong>gsl_sf_legendre_Plm_array</strong> <em>(int <var>lmax</var>, int <var>m</var>, double <var>x</var>, double <var>result_array</var>[])</em></dt>
<dt><a name="index-gsl_005fsf_005flegendre_005fPlm_005fderiv_005farray"></a>Function: <em>int</em> <strong>gsl_sf_legendre_Plm_deriv_array</strong> <em>(int <var>lmax</var>, int <var>m</var>, double <var>x</var>, double <var>result_array</var>[], double <var>result_deriv_array</var>[])</em></dt>
<dd><p>These functions are now deprecated and will be removed in a future
release; see <code>gsl_sf_legendre_array</code> and
<code>gsl_sf_legendre_deriv_array</code>.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005fsphPlm_005farray"></a>Function: <em>int</em> <strong>gsl_sf_legendre_sphPlm_array</strong> <em>(int <var>lmax</var>, int <var>m</var>, double <var>x</var>, double <var>result_array</var>[])</em></dt>
<dt><a name="index-gsl_005fsf_005flegendre_005fsphPlm_005fderiv_005farray"></a>Function: <em>int</em> <strong>gsl_sf_legendre_sphPlm_deriv_array</strong> <em>(int <var>lmax</var>, int <var>m</var>, double <var>x</var>, double <var>result_array</var>[], double <var>result_deriv_array</var>[])</em></dt>
<dd><p>These functions are now deprecated and will be removed in a future
release; see <code>gsl_sf_legendre_array</code> and
<code>gsl_sf_legendre_deriv_array</code>.
</p></dd></dl>

<dl>
<dt><a name="index-gsl_005fsf_005flegendre_005farray_005fsize"></a>Function: <em>int</em> <strong>gsl_sf_legendre_array_size</strong> <em>(const int <var>lmax</var>, const int <var>m</var>)</em></dt>
<dd><p>This function is now deprecated and will be removed in a future
release.
</p></dd></dl>

<hr>
<div class="header">
<p>
Next: <a href="Conical-Functions.html#Conical-Functions" accesskey="n" rel="next">Conical Functions</a>, Previous: <a href="Legendre-Polynomials.html#Legendre-Polynomials" accesskey="p" rel="previous">Legendre Polynomials</a>, Up: <a href="Legendre-Functions-and-Spherical-Harmonics.html#Legendre-Functions-and-Spherical-Harmonics" accesskey="u" rel="up">Legendre Functions and Spherical Harmonics</a> &nbsp; [<a href="Function-Index.html#Function-Index" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>