]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/doc/html/math_toolkit/sf_poly/hermite.html
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / math / doc / html / math_toolkit / sf_poly / hermite.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Hermite Polynomials</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="laguerre.html" title="Laguerre (and Associated) Polynomials">
10 <link rel="next" href="sph_harm.html" title="Spherical Harmonics">
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="laguerre.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="sph_harm.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.hermite"></a><a class="link" href="hermite.html" title="Hermite Polynomials">Hermite Polynomials</a>
28 </h3></div></div></div>
29 <h5>
30 <a name="math_toolkit.sf_poly.hermite.h0"></a>
31 <span class="phrase"><a name="math_toolkit.sf_poly.hermite.synopsis"></a></span><a class="link" href="hermite.html#math_toolkit.sf_poly.hermite.synopsis">Synopsis</a>
32 </h5>
33 <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</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">hermite</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</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">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
38 <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">hermite</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">T</span> <span class="identifier">x</span><span class="special">);</span>
39
40 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
41 <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">hermite</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">T</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
42
43 <span class="keyword">template</span> <span class="special">&lt;</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> <span class="identifier">T3</span><span class="special">&gt;</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">hermite_next</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">Hn</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">Hnm1</span><span class="special">);</span>
45
46 <span class="special">}}</span> <span class="comment">// namespaces</span>
47 </pre>
48 <h5>
49 <a name="math_toolkit.sf_poly.hermite.h1"></a>
50 <span class="phrase"><a name="math_toolkit.sf_poly.hermite.description"></a></span><a class="link" href="hermite.html#math_toolkit.sf_poly.hermite.description">Description</a>
51 </h5>
52 <p>
53 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
54 type calculation rules</em></span></a>: note than when there is a single
55 template argument the result is the same type as that argument or <code class="computeroutput"><span class="keyword">double</span></code> if the template argument is an integer
56 type.
57 </p>
58 <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">&gt;</span>
59 <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">hermite</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">T</span> <span class="identifier">x</span><span class="special">);</span>
60
61 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</span>
62 <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">hermite</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">T</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
63 </pre>
64 <p>
65 Returns the value of the Hermite Polynomial of order <span class="emphasis"><em>n</em></span>
66 at point <span class="emphasis"><em>x</em></span>:
67 </p>
68 <p>
69 <span class="inlinemediaobject"><img src="../../../equations/hermite_0.svg"></span>
70 </p>
71 <p>
72 The final <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
73 be used to control the behaviour of the function: how it handles errors,
74 what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter&#160;15.&#160;Policies: Controlling Precision, Error Handling etc">policy
75 documentation for more details</a>.
76 </p>
77 <p>
78 The following graph illustrates the behaviour of the first few Hermite Polynomials:
79 </p>
80 <p>
81 <span class="inlinemediaobject"><img src="../../../graphs/hermite.svg" align="middle"></span>
82 </p>
83 <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</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> <span class="identifier">T3</span><span class="special">&gt;</span>
84 <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">hermite_next</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">n</span><span class="special">,</span> <span class="identifier">T1</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">Hn</span><span class="special">,</span> <span class="identifier">T3</span> <span class="identifier">Hnm1</span><span class="special">);</span>
85 </pre>
86 <p>
87 Implements the three term recurrence relation for the Hermite polynomials,
88 this function can be used to create a sequence of values evaluated at the
89 same <span class="emphasis"><em>x</em></span>, and for rising <span class="emphasis"><em>n</em></span>.
90 </p>
91 <p>
92 <span class="inlinemediaobject"><img src="../../../equations/hermite_1.svg"></span>
93 </p>
94 <p>
95 For example we could produce a vector of the first 10 polynomial values using:
96 </p>
97 <pre class="programlisting"><span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="number">0.5</span><span class="special">;</span> <span class="comment">// Abscissa value</span>
98 <span class="identifier">vector</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">v</span><span class="special">;</span>
99 <span class="identifier">v</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">hermite</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="identifier">x</span><span class="special">)).</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">hermite</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="identifier">x</span><span class="special">));</span>
100 <span class="keyword">for</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="identifier">l</span> <span class="special">=</span> <span class="number">1</span><span class="special">;</span> <span class="identifier">l</span> <span class="special">&lt;</span> <span class="number">10</span><span class="special">;</span> <span class="special">++</span><span class="identifier">l</span><span class="special">)</span>
101 <span class="identifier">v</span><span class="special">.</span><span class="identifier">push_back</span><span class="special">(</span><span class="identifier">hermite_next</span><span class="special">(</span><span class="identifier">l</span><span class="special">,</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">v</span><span class="special">[</span><span class="identifier">l</span><span class="special">],</span> <span class="identifier">v</span><span class="special">[</span><span class="identifier">l</span><span class="special">-</span><span class="number">1</span><span class="special">]));</span>
102 </pre>
103 <p>
104 Formally the arguments are:
105 </p>
106 <div class="variablelist">
107 <p class="title"><b></b></p>
108 <dl class="variablelist">
109 <dt><span class="term">n</span></dt>
110 <dd><p>
111 The degree <span class="emphasis"><em>n</em></span> of the last polynomial calculated.
112 </p></dd>
113 <dt><span class="term">x</span></dt>
114 <dd><p>
115 The abscissa value
116 </p></dd>
117 <dt><span class="term">Hn</span></dt>
118 <dd><p>
119 The value of the polynomial evaluated at degree <span class="emphasis"><em>n</em></span>.
120 </p></dd>
121 <dt><span class="term">Hnm1</span></dt>
122 <dd><p>
123 The value of the polynomial evaluated at degree <span class="emphasis"><em>n-1</em></span>.
124 </p></dd>
125 </dl>
126 </div>
127 <h5>
128 <a name="math_toolkit.sf_poly.hermite.h2"></a>
129 <span class="phrase"><a name="math_toolkit.sf_poly.hermite.accuracy"></a></span><a class="link" href="hermite.html#math_toolkit.sf_poly.hermite.accuracy">Accuracy</a>
130 </h5>
131 <p>
132 The following table shows peak errors (in units of epsilon) for various domains
133 of input arguments. Note that only results for the widest floating point
134 type on the system are given as narrower types have <a class="link" href="../relative_error.html#math_toolkit.relative_error.zero_error">effectively
135 zero error</a>.
136 </p>
137 <div class="table">
138 <a name="math_toolkit.sf_poly.hermite.table_hermite"></a><p class="title"><b>Table&#160;6.37.&#160;Error rates for hermite</b></p>
139 <div class="table-contents"><table class="table" summary="Error rates for hermite">
140 <colgroup>
141 <col>
142 <col>
143 <col>
144 <col>
145 <col>
146 </colgroup>
147 <thead><tr>
148 <th>
149 </th>
150 <th>
151 <p>
152 Microsoft Visual C++ version 12.0<br> Win32<br> double
153 </p>
154 </th>
155 <th>
156 <p>
157 GNU C++ version 5.1.0<br> linux<br> double
158 </p>
159 </th>
160 <th>
161 <p>
162 GNU C++ version 5.1.0<br> linux<br> long double
163 </p>
164 </th>
165 <th>
166 <p>
167 Sun compiler version 0x5130<br> Sun Solaris<br> long double
168 </p>
169 </th>
170 </tr></thead>
171 <tbody><tr>
172 <td>
173 <p>
174 Hermite Polynomials
175 </p>
176 </td>
177 <td>
178 <p>
179 <span class="blue">Max = 4.46&#949; (Mean = 1.41&#949;)</span>
180 </p>
181 </td>
182 <td>
183 <p>
184 <span class="blue">Max = 0&#949; (Mean = 0&#949;)</span>
185 </p>
186 </td>
187 <td>
188 <p>
189 <span class="blue">Max = 6.24&#949; (Mean = 2.07&#949;)</span>
190 </p>
191 </td>
192 <td>
193 <p>
194 <span class="blue">Max = 6.24&#949; (Mean = 2.07&#949;)</span>
195 </p>
196 </td>
197 </tr></tbody>
198 </table></div>
199 </div>
200 <br class="table-break"><p>
201 Note that the worst errors occur when the degree increases, values greater
202 than ~120 are very unlikely to produce sensible results, especially in the
203 associated polynomial case when the order is also large. Further the relative
204 errors are likely to grow arbitrarily large when the function is very close
205 to a root.
206 </p>
207 <h5>
208 <a name="math_toolkit.sf_poly.hermite.h3"></a>
209 <span class="phrase"><a name="math_toolkit.sf_poly.hermite.testing"></a></span><a class="link" href="hermite.html#math_toolkit.sf_poly.hermite.testing">Testing</a>
210 </h5>
211 <p>
212 A mixture of spot tests of values calculated using functions.wolfram.com,
213 and randomly generated test data are used: the test data was computed using
214 <a href="http://shoup.net/ntl/doc/RR.txt" target="_top">NTL::RR</a> at 1000-bit
215 precision.
216 </p>
217 <h5>
218 <a name="math_toolkit.sf_poly.hermite.h4"></a>
219 <span class="phrase"><a name="math_toolkit.sf_poly.hermite.implementation"></a></span><a class="link" href="hermite.html#math_toolkit.sf_poly.hermite.implementation">Implementation</a>
220 </h5>
221 <p>
222 These functions are implemented using the stable three term recurrence relations.
223 These relations guarantee low absolute error but cannot guarantee low relative
224 error near one of the roots of the polynomials.
225 </p>
226 </div>
227 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
228 <td align="left"></td>
229 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2010, 2012-2014 Nikhar Agrawal,
230 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
231 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
232 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
233 Distributed under the Boost Software License, Version 1.0. (See accompanying
234 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>)
235 </p>
236 </div></td>
237 </tr></table>
238 <hr>
239 <div class="spirit-nav">
240 <a accesskey="p" href="laguerre.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="sph_harm.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
241 </div>
242 </body>
243 </html>