mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
337 lines
28 KiB
HTML
337 lines
28 KiB
HTML
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<title>Spherical Harmonics</title>
|
||
<link rel="stylesheet" href="../../math.css" type="text/css">
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
|
||
<link rel="home" href="../../index.html" title="Math Toolkit 4.2.1">
|
||
<link rel="up" href="../sf_poly.html" title="Polynomials">
|
||
<link rel="prev" href="chebyshev.html" title="Chebyshev Polynomials">
|
||
<link rel="next" href="cardinal_b_splines.html" title="Cardinal B-splines">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
</head>
|
||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||
<table cellpadding="2" width="100%"><tr>
|
||
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
|
||
<td align="center"><a href="../../../../../../index.html">Home</a></td>
|
||
<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
|
||
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
|
||
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
|
||
<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
|
||
</tr></table>
|
||
<hr>
|
||
<div class="spirit-nav">
|
||
<a accesskey="p" href="chebyshev.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="cardinal_b_splines.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||
</div>
|
||
<div class="section">
|
||
<div class="titlepage"><div><div><h3 class="title">
|
||
<a name="math_toolkit.sf_poly.sph_harm"></a><a class="link" href="sph_harm.html" title="Spherical Harmonics">Spherical Harmonics</a>
|
||
</h3></div></div></div>
|
||
<h5>
|
||
<a name="math_toolkit.sf_poly.sph_harm.h0"></a>
|
||
<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>
|
||
</h5>
|
||
<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>
|
||
</pre>
|
||
<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>
|
||
|
||
<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="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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
|
||
<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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
|
||
|
||
<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>
|
||
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><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="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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
|
||
|
||
<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>
|
||
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><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="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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
|
||
|
||
<span class="special">}}</span> <span class="comment">// namespaces</span>
|
||
</pre>
|
||
<h5>
|
||
<a name="math_toolkit.sf_poly.sph_harm.h1"></a>
|
||
<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>
|
||
</h5>
|
||
<p>
|
||
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
|
||
type calculation rules</em></span></a> when T1 and T2 are different types.
|
||
</p>
|
||
<p>
|
||
The final <a class="link" href="../../policy.html" title="Chapter 22. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
|
||
be used to control the behaviour of the function: how it handles errors,
|
||
what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter 22. Policies: Controlling Precision, Error Handling etc">policy
|
||
documentation for more details</a>.
|
||
</p>
|
||
<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>
|
||
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
|
||
<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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
|
||
</pre>
|
||
<p>
|
||
Returns the value of the Spherical Harmonic Y<sub>n</sub><sup>m</sup>(theta, phi):
|
||
</p>
|
||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||
<span class="inlinemediaobject"><img src="../../../equations/spherical_0.svg"></span>
|
||
|
||
</p></blockquote></div>
|
||
<p>
|
||
The spherical harmonics Y<sub>n</sub><sup>m</sup>(theta, phi) are the angular portion of the solution
|
||
to Laplace's equation in spherical coordinates where azimuthal symmetry is
|
||
not present.
|
||
</p>
|
||
<div class="caution"><table border="0" summary="Caution">
|
||
<tr>
|
||
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../doc/src/images/caution.png"></td>
|
||
<th align="left">Caution</th>
|
||
</tr>
|
||
<tr><td align="left" valign="top">
|
||
<p>
|
||
Care must be taken in correctly identifying the arguments to this function:
|
||
θ is taken as the polar (colatitudinal) coordinate with θ in [0, π], and φas
|
||
the azimuthal (longitudinal) coordinate with φin [0,2π). This is the convention
|
||
used in Physics, and matches the definition used by <a href="http://documents.wolfram.com/mathematica/functions/SphericalHarmonicY" target="_top">Mathematica
|
||
in the function SpericalHarmonicY</a>, but is opposite to the usual
|
||
mathematical conventions.
|
||
</p>
|
||
<p>
|
||
Some other sources include an additional Condon-Shortley phase term of
|
||
(-1)<sup>m</sup> in the definition of this function: note however that our definition
|
||
of the associated Legendre polynomial already includes this term.
|
||
</p>
|
||
<p>
|
||
This implementation returns zero for m > n
|
||
</p>
|
||
<p>
|
||
For θ outside [0, π] and φ outside [0, 2π] this implementation follows the convention
|
||
used by Mathematica: the function is periodic with period π in θ and 2π in φ.
|
||
Please note that this is not the behaviour one would get from a casual
|
||
application of the function's definition. Cautious users should keep θ and
|
||
φ to the range [0, π] and [0, 2π] respectively.
|
||
</p>
|
||
<p>
|
||
See: <a href="http://mathworld.wolfram.com/SphericalHarmonic.html" target="_top">Weisstein,
|
||
Eric W. "Spherical Harmonic." From MathWorld--A Wolfram Web Resource</a>.
|
||
</p>
|
||
</td></tr>
|
||
</table></div>
|
||
<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>
|
||
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><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="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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
|
||
</pre>
|
||
<p>
|
||
Returns the real part of Y<sub>n</sub><sup>m</sup>(theta, phi):
|
||
</p>
|
||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||
<span class="inlinemediaobject"><img src="../../../equations/spherical_1.svg"></span>
|
||
|
||
</p></blockquote></div>
|
||
<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>
|
||
<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">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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><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="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 22. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
|
||
</pre>
|
||
<p>
|
||
Returns the imaginary part of Y<sub>n</sub><sup>m</sup>(theta, phi):
|
||
</p>
|
||
<div class="blockquote"><blockquote class="blockquote"><p>
|
||
<span class="inlinemediaobject"><img src="../../../equations/spherical_2.svg"></span>
|
||
|
||
</p></blockquote></div>
|
||
<h5>
|
||
<a name="math_toolkit.sf_poly.sph_harm.h2"></a>
|
||
<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>
|
||
</h5>
|
||
<p>
|
||
The following table shows peak errors for various domains of input arguments.
|
||
Note that only results for the widest floating point type on the system are
|
||
given as narrower types have <a class="link" href="../relative_error.html#math_toolkit.relative_error.zero_error">effectively
|
||
zero error</a>. Peak errors are the same for both the real and imaginary
|
||
parts, as the error is dominated by calculation of the associated Legendre
|
||
polynomials: especially near the roots of the associated Legendre function.
|
||
</p>
|
||
<p>
|
||
All values are in units of epsilon.
|
||
</p>
|
||
<div class="table">
|
||
<a name="math_toolkit.sf_poly.sph_harm.table_spherical_harmonic_r"></a><p class="title"><b>Table 8.38. Error rates for spherical_harmonic_r</b></p>
|
||
<div class="table-contents"><table class="table" summary="Error rates for spherical_harmonic_r">
|
||
<colgroup>
|
||
<col>
|
||
<col>
|
||
<col>
|
||
<col>
|
||
<col>
|
||
</colgroup>
|
||
<thead><tr>
|
||
<th>
|
||
</th>
|
||
<th>
|
||
<p>
|
||
GNU C++ version 7.1.0<br> linux<br> double
|
||
</p>
|
||
</th>
|
||
<th>
|
||
<p>
|
||
GNU C++ version 7.1.0<br> linux<br> long double
|
||
</p>
|
||
</th>
|
||
<th>
|
||
<p>
|
||
Sun compiler version 0x5150<br> Sun Solaris<br> long double
|
||
</p>
|
||
</th>
|
||
<th>
|
||
<p>
|
||
Microsoft Visual C++ version 14.1<br> Win32<br> double
|
||
</p>
|
||
</th>
|
||
</tr></thead>
|
||
<tbody><tr>
|
||
<td>
|
||
<p>
|
||
Spherical Harmonics
|
||
</p>
|
||
</td>
|
||
<td>
|
||
<p>
|
||
<span class="blue">Max = 1.58ε (Mean = 0.0707ε)</span>
|
||
</p>
|
||
</td>
|
||
<td>
|
||
<p>
|
||
<span class="blue">Max = 2.89e+03ε (Mean = 108ε)</span>
|
||
</p>
|
||
</td>
|
||
<td>
|
||
<p>
|
||
<span class="blue">Max = 1.03e+04ε (Mean = 327ε)</span>
|
||
</p>
|
||
</td>
|
||
<td>
|
||
<p>
|
||
<span class="blue">Max = 2.27e+04ε (Mean = 725ε)</span>
|
||
</p>
|
||
</td>
|
||
</tr></tbody>
|
||
</table></div>
|
||
</div>
|
||
<br class="table-break"><div class="table">
|
||
<a name="math_toolkit.sf_poly.sph_harm.table_spherical_harmonic_i"></a><p class="title"><b>Table 8.39. Error rates for spherical_harmonic_i</b></p>
|
||
<div class="table-contents"><table class="table" summary="Error rates for spherical_harmonic_i">
|
||
<colgroup>
|
||
<col>
|
||
<col>
|
||
<col>
|
||
<col>
|
||
<col>
|
||
</colgroup>
|
||
<thead><tr>
|
||
<th>
|
||
</th>
|
||
<th>
|
||
<p>
|
||
GNU C++ version 7.1.0<br> linux<br> double
|
||
</p>
|
||
</th>
|
||
<th>
|
||
<p>
|
||
GNU C++ version 7.1.0<br> linux<br> long double
|
||
</p>
|
||
</th>
|
||
<th>
|
||
<p>
|
||
Sun compiler version 0x5150<br> Sun Solaris<br> long double
|
||
</p>
|
||
</th>
|
||
<th>
|
||
<p>
|
||
Microsoft Visual C++ version 14.1<br> Win32<br> double
|
||
</p>
|
||
</th>
|
||
</tr></thead>
|
||
<tbody><tr>
|
||
<td>
|
||
<p>
|
||
Spherical Harmonics
|
||
</p>
|
||
</td>
|
||
<td>
|
||
<p>
|
||
<span class="blue">Max = 1.36ε (Mean = 0.0765ε)</span>
|
||
</p>
|
||
</td>
|
||
<td>
|
||
<p>
|
||
<span class="blue">Max = 2.89e+03ε (Mean = 108ε)</span>
|
||
</p>
|
||
</td>
|
||
<td>
|
||
<p>
|
||
<span class="blue">Max = 1.03e+04ε (Mean = 327ε)</span>
|
||
</p>
|
||
</td>
|
||
<td>
|
||
<p>
|
||
<span class="blue">Max = 2.27e+04ε (Mean = 725ε)</span>
|
||
</p>
|
||
</td>
|
||
</tr></tbody>
|
||
</table></div>
|
||
</div>
|
||
<br class="table-break"><p>
|
||
Note that the worst errors occur when the degree increases, values greater
|
||
than ~120 are very unlikely to produce sensible results, especially when
|
||
the order is also large. Further the relative errors are likely to grow arbitrarily
|
||
large when the function is very close to a root.
|
||
</p>
|
||
<h5>
|
||
<a name="math_toolkit.sf_poly.sph_harm.h3"></a>
|
||
<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>
|
||
</h5>
|
||
<p>
|
||
A mixture of spot tests of values calculated using functions.wolfram.com,
|
||
and randomly generated test data are used: the test data was computed using
|
||
<a href="http://shoup.net/ntl/doc/RR.txt" target="_top">NTL::RR</a> at 1000-bit
|
||
precision.
|
||
</p>
|
||
<h5>
|
||
<a name="math_toolkit.sf_poly.sph_harm.h4"></a>
|
||
<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>
|
||
</h5>
|
||
<p>
|
||
These functions are implemented fairly naively using the formulae given above.
|
||
Some extra care is taken to prevent roundoff error when converting from polar
|
||
coordinates (so for example the <span class="emphasis"><em>1-x<sup>2</sup></em></span> term used by the
|
||
associated Legendre functions is calculated without roundoff error using
|
||
<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>).
|
||
The limiting factor in the error rates for these functions is the need to
|
||
calculate values near the roots of the associated Legendre functions.
|
||
</p>
|
||
</div>
|
||
<div class="copyright-footer">Copyright © 2006-2021 Nikhar Agrawal, Anton Bikineev, Matthew Borland,
|
||
Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert Holin, Bruno
|
||
Lalande, John Maddock, Evan Miller, Jeremy Murphy, Matthew Pulver, Johan Råde,
|
||
Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg, Daryle
|
||
Walker and Xiaogang Zhang<p>
|
||
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||
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>)
|
||
</p>
|
||
</div>
|
||
<hr>
|
||
<div class="spirit-nav">
|
||
<a accesskey="p" href="chebyshev.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="cardinal_b_splines.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
||
</div>
|
||
</body>
|
||
</html>
|