]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <head> | |
3 | <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> | |
4 | <title>Spherical Harmonics</title> | |
5 | <link rel="stylesheet" href="../../math.css" type="text/css"> | |
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> | |
7 | <link rel="home" href="../../index.html" title="Math Toolkit 2.5.1"> | |
8 | <link rel="up" href="../sf_poly.html" title="Polynomials"> | |
9 | <link rel="prev" href="hermite.html" title="Hermite Polynomials"> | |
10 | <link rel="next" href="../bessel.html" title="Bessel Functions"> | |
11 | </head> | |
12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> | |
13 | <table cellpadding="2" width="100%"><tr> | |
14 | <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td> | |
15 | <td align="center"><a href="../../../../../../index.html">Home</a></td> | |
16 | <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td> | |
17 | <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> | |
18 | <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> | |
19 | <td align="center"><a href="../../../../../../more/index.htm">More</a></td> | |
20 | </tr></table> | |
21 | <hr> | |
22 | <div class="spirit-nav"> | |
23 | <a accesskey="p" href="hermite.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_poly.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../bessel.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> | |
24 | </div> | |
25 | <div class="section"> | |
26 | <div class="titlepage"><div><div><h3 class="title"> | |
27 | <a name="math_toolkit.sf_poly.sph_harm"></a><a class="link" href="sph_harm.html" title="Spherical Harmonics">Spherical Harmonics</a> | |
28 | </h3></div></div></div> | |
29 | <h5> | |
30 | <a name="math_toolkit.sf_poly.sph_harm.h0"></a> | |
31 | <span class="phrase"><a name="math_toolkit.sf_poly.sph_harm.synopsis"></a></span><a class="link" href="sph_harm.html#math_toolkit.sf_poly.sph_harm.synopsis">Synopsis</a> | |
32 | </h5> | |
33 | <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">spherical_harmonic</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span> | |
34 | </pre> | |
35 | <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">math</span><span class="special">{</span> | |
36 | ||
37 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">></span> | |
38 | <span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a><span class="special">></span> <span class="identifier">spherical_harmonic</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">);</span> | |
39 | ||
40 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> | |
41 | <span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a><span class="special">></span> <span class="identifier">spherical_harmonic</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
42 | ||
43 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">></span> | |
44 | <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">spherical_harmonic_r</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">);</span> | |
45 | ||
46 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> | |
47 | <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">spherical_harmonic_r</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
48 | ||
49 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">></span> | |
50 | <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">spherical_harmonic_i</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">);</span> | |
51 | ||
52 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> | |
53 | <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">spherical_harmonic_i</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
54 | ||
55 | <span class="special">}}</span> <span class="comment">// namespaces</span> | |
56 | </pre> | |
57 | <h5> | |
58 | <a name="math_toolkit.sf_poly.sph_harm.h1"></a> | |
59 | <span class="phrase"><a name="math_toolkit.sf_poly.sph_harm.description"></a></span><a class="link" href="sph_harm.html#math_toolkit.sf_poly.sph_harm.description">Description</a> | |
60 | </h5> | |
61 | <p> | |
62 | The return type of these functions is computed using the <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>result | |
63 | type calculation rules</em></span></a> when T1 and T2 are different types. | |
64 | </p> | |
65 | <p> | |
66 | The final <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can | |
67 | be used to control the behaviour of the function: how it handles errors, | |
68 | what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">policy | |
69 | documentation for more details</a>. | |
70 | </p> | |
71 | <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">></span> | |
72 | <span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a><span class="special">></span> <span class="identifier">spherical_harmonic</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">);</span> | |
73 | ||
74 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> | |
75 | <span class="identifier">std</span><span class="special">::</span><span class="identifier">complex</span><span class="special"><</span><a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a><span class="special">></span> <span class="identifier">spherical_harmonic</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
76 | </pre> | |
77 | <p> | |
78 | Returns the value of the Spherical Harmonic Y<sub>n</sub><sup>m</sup>(theta, phi): | |
79 | </p> | |
80 | <p> | |
81 | <span class="inlinemediaobject"><img src="../../../equations/spherical_0.svg"></span> | |
82 | </p> | |
83 | <p> | |
84 | The spherical harmonics Y<sub>n</sub><sup>m</sup>(theta, phi) are the angular portion of the solution | |
85 | to Laplace's equation in spherical coordinates where azimuthal symmetry is | |
86 | not present. | |
87 | </p> | |
88 | <div class="caution"><table border="0" summary="Caution"> | |
89 | <tr> | |
90 | <td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../doc/src/images/caution.png"></td> | |
91 | <th align="left">Caution</th> | |
92 | </tr> | |
93 | <tr><td align="left" valign="top"> | |
94 | <p> | |
95 | Care must be taken in correctly identifying the arguments to this function: | |
96 | θ   is taken as the polar (colatitudinal) coordinate with θ   in [0, π], and φ   as | |
97 | the azimuthal (longitudinal) coordinate with φ   in [0,2π). This is the convention | |
98 | used in Physics, and matches the definition used by <a href="http://documents.wolfram.com/mathematica/functions/SphericalHarmonicY" target="_top">Mathematica | |
99 | in the function SpericalHarmonicY</a>, but is opposite to the usual | |
100 | mathematical conventions. | |
101 | </p> | |
102 | <p> | |
103 | Some other sources include an additional Condon-Shortley phase term of | |
104 | (-1)<sup>m</sup> in the definition of this function: note however that our definition | |
105 | of the associated Legendre polynomial already includes this term. | |
106 | </p> | |
107 | <p> | |
108 | This implementation returns zero for m > n | |
109 | </p> | |
110 | <p> | |
111 | For θ   outside [0, π] and φ   outside [0, 2π] this implementation follows the convention | |
112 | used by Mathematica: the function is periodic with period π   in θ   and 2π   in φ. | |
113 | Please note that this is not the behaviour one would get from a casual | |
114 | application of the function's definition. Cautious users should keep θ   and | |
115 | φ   to the range [0, π] and [0, 2π] respectively. | |
116 | </p> | |
117 | <p> | |
118 | See: <a href="http://mathworld.wolfram.com/SphericalHarmonic.html" target="_top">Weisstein, | |
119 | Eric W. "Spherical Harmonic." From MathWorld--A Wolfram Web Resource</a>. | |
120 | </p> | |
121 | </td></tr> | |
122 | </table></div> | |
123 | <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">></span> | |
124 | <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">spherical_harmonic_r</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">);</span> | |
125 | ||
126 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> | |
127 | <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">spherical_harmonic_r</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
128 | </pre> | |
129 | <p> | |
130 | Returns the real part of Y<sub>n</sub><sup>m</sup>(theta, phi): | |
131 | </p> | |
132 | <p> | |
133 | <span class="inlinemediaobject"><img src="../../../equations/spherical_1.svg"></span> | |
134 | </p> | |
135 | <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">></span> | |
136 | <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">spherical_harmonic_i</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">);</span> | |
137 | ||
138 | <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span> | |
139 | <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">spherical_harmonic_i</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">theta</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">phi</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span> | |
140 | </pre> | |
141 | <p> | |
142 | Returns the imaginary part of Y<sub>n</sub><sup>m</sup>(theta, phi): | |
143 | </p> | |
144 | <p> | |
145 | <span class="inlinemediaobject"><img src="../../../equations/spherical_2.svg"></span> | |
146 | </p> | |
147 | <h5> | |
148 | <a name="math_toolkit.sf_poly.sph_harm.h2"></a> | |
149 | <span class="phrase"><a name="math_toolkit.sf_poly.sph_harm.accuracy"></a></span><a class="link" href="sph_harm.html#math_toolkit.sf_poly.sph_harm.accuracy">Accuracy</a> | |
150 | </h5> | |
151 | <p> | |
152 | The following table shows peak errors for various domains of input arguments. | |
153 | Note that only results for the widest floating point type on the system are | |
154 | given as narrower types have <a class="link" href="../relative_error.html#math_toolkit.relative_error.zero_error">effectively | |
155 | zero error</a>. Peak errors are the same for both the real and imaginary | |
156 | parts, as the error is dominated by calculation of the associated Legendre | |
157 | polynomials: especially near the roots of the associated Legendre function. | |
158 | </p> | |
159 | <p> | |
160 | All values are in units of epsilon. | |
161 | </p> | |
162 | <div class="table"> | |
163 | <a name="math_toolkit.sf_poly.sph_harm.table_spherical_harmonic_r"></a><p class="title"><b>Table 6.38. Error rates for spherical_harmonic_r</b></p> | |
164 | <div class="table-contents"><table class="table" summary="Error rates for spherical_harmonic_r"> | |
165 | <colgroup> | |
166 | <col> | |
167 | <col> | |
168 | <col> | |
169 | <col> | |
170 | <col> | |
171 | </colgroup> | |
172 | <thead><tr> | |
173 | <th> | |
174 | </th> | |
175 | <th> | |
176 | <p> | |
177 | Microsoft Visual C++ version 12.0<br> Win32<br> double | |
178 | </p> | |
179 | </th> | |
180 | <th> | |
181 | <p> | |
182 | GNU C++ version 5.1.0<br> linux<br> double | |
183 | </p> | |
184 | </th> | |
185 | <th> | |
186 | <p> | |
187 | GNU C++ version 5.1.0<br> linux<br> long double | |
188 | </p> | |
189 | </th> | |
190 | <th> | |
191 | <p> | |
192 | Sun compiler version 0x5130<br> Sun Solaris<br> long double | |
193 | </p> | |
194 | </th> | |
195 | </tr></thead> | |
196 | <tbody><tr> | |
197 | <td> | |
198 | <p> | |
199 | Spherical Harmonics | |
200 | </p> | |
201 | </td> | |
202 | <td> | |
203 | <p> | |
204 | <span class="blue">Max = 2.27e+004ε (Mean = 725ε)</span> | |
205 | </p> | |
206 | </td> | |
207 | <td> | |
208 | <p> | |
209 | <span class="blue">Max = 1.58ε (Mean = 0.0707ε)</span> | |
210 | </p> | |
211 | </td> | |
212 | <td> | |
213 | <p> | |
214 | <span class="blue">Max = 2.89e+03ε (Mean = 108ε)</span> | |
215 | </p> | |
216 | </td> | |
217 | <td> | |
218 | <p> | |
219 | <span class="blue">Max = 1.03e+04ε (Mean = 327ε)</span> | |
220 | </p> | |
221 | </td> | |
222 | </tr></tbody> | |
223 | </table></div> | |
224 | </div> | |
225 | <br class="table-break"><div class="table"> | |
226 | <a name="math_toolkit.sf_poly.sph_harm.table_spherical_harmonic_i"></a><p class="title"><b>Table 6.39. Error rates for spherical_harmonic_i</b></p> | |
227 | <div class="table-contents"><table class="table" summary="Error rates for spherical_harmonic_i"> | |
228 | <colgroup> | |
229 | <col> | |
230 | <col> | |
231 | <col> | |
232 | <col> | |
233 | <col> | |
234 | </colgroup> | |
235 | <thead><tr> | |
236 | <th> | |
237 | </th> | |
238 | <th> | |
239 | <p> | |
240 | Microsoft Visual C++ version 12.0<br> Win32<br> double | |
241 | </p> | |
242 | </th> | |
243 | <th> | |
244 | <p> | |
245 | GNU C++ version 5.1.0<br> linux<br> double | |
246 | </p> | |
247 | </th> | |
248 | <th> | |
249 | <p> | |
250 | GNU C++ version 5.1.0<br> linux<br> long double | |
251 | </p> | |
252 | </th> | |
253 | <th> | |
254 | <p> | |
255 | Sun compiler version 0x5130<br> Sun Solaris<br> long double | |
256 | </p> | |
257 | </th> | |
258 | </tr></thead> | |
259 | <tbody><tr> | |
260 | <td> | |
261 | <p> | |
262 | Spherical Harmonics | |
263 | </p> | |
264 | </td> | |
265 | <td> | |
266 | <p> | |
267 | <span class="blue">Max = 2.27e+004ε (Mean = 725ε)</span> | |
268 | </p> | |
269 | </td> | |
270 | <td> | |
271 | <p> | |
272 | <span class="blue">Max = 1.36ε (Mean = 0.0765ε)</span> | |
273 | </p> | |
274 | </td> | |
275 | <td> | |
276 | <p> | |
277 | <span class="blue">Max = 2.89e+03ε (Mean = 108ε)</span> | |
278 | </p> | |
279 | </td> | |
280 | <td> | |
281 | <p> | |
282 | <span class="blue">Max = 1.03e+04ε (Mean = 327ε)</span> | |
283 | </p> | |
284 | </td> | |
285 | </tr></tbody> | |
286 | </table></div> | |
287 | </div> | |
288 | <br class="table-break"><p> | |
289 | Note that the worst errors occur when the degree increases, values greater | |
290 | than ~120 are very unlikely to produce sensible results, especially when | |
291 | the order is also large. Further the relative errors are likely to grow arbitrarily | |
292 | large when the function is very close to a root. | |
293 | </p> | |
294 | <h5> | |
295 | <a name="math_toolkit.sf_poly.sph_harm.h3"></a> | |
296 | <span class="phrase"><a name="math_toolkit.sf_poly.sph_harm.testing"></a></span><a class="link" href="sph_harm.html#math_toolkit.sf_poly.sph_harm.testing">Testing</a> | |
297 | </h5> | |
298 | <p> | |
299 | A mixture of spot tests of values calculated using functions.wolfram.com, | |
300 | and randomly generated test data are used: the test data was computed using | |
301 | <a href="http://shoup.net/ntl/doc/RR.txt" target="_top">NTL::RR</a> at 1000-bit | |
302 | precision. | |
303 | </p> | |
304 | <h5> | |
305 | <a name="math_toolkit.sf_poly.sph_harm.h4"></a> | |
306 | <span class="phrase"><a name="math_toolkit.sf_poly.sph_harm.implementation"></a></span><a class="link" href="sph_harm.html#math_toolkit.sf_poly.sph_harm.implementation">Implementation</a> | |
307 | </h5> | |
308 | <p> | |
309 | These functions are implemented fairly naively using the formulae given above. | |
310 | Some extra care is taken to prevent roundoff error when converting from polar | |
311 | coordinates (so for example the <span class="emphasis"><em>1-x<sup>2</sup></em></span> term used by the | |
312 | associated Legendre functions is calculated without roundoff error using | |
313 | <span class="emphasis"><em>x = cos(theta)</em></span>, and <span class="emphasis"><em>1-x<sup>2</sup> = sin<sup>2</sup>(theta)</em></span>). | |
314 | The limiting factor in the error rates for these functions is the need to | |
315 | calculate values near the roots of the associated Legendre functions. | |
316 | </p> | |
317 | </div> | |
318 | <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> | |
319 | <td align="left"></td> | |
320 | <td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal, | |
321 | Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert | |
322 | Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani, | |
323 | Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p> | |
324 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
325 | file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) | |
326 | </p> | |
327 | </div></td> | |
328 | </tr></table> | |
329 | <hr> | |
330 | <div class="spirit-nav"> | |
331 | <a accesskey="p" href="hermite.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../sf_poly.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../bessel.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> | |
332 | </div> | |
333 | </body> | |
334 | </html> |