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.79.1">
7 <link rel="home" href="../../index.html" title="Math Toolkit 2.11.0">
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="chebyshev.html" title="Chebyshev Polynomials">
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>
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="chebyshev.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
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>
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>
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">hermite</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
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>
37 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></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>
40 <span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
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> <span class="keyword">class</span> <span class="identifier">T3</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">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>
46 <span class="special">}}</span> <span class="comment">// namespaces</span>
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>
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
58 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></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>
61 <span class="keyword">template</span> <span class="special"><</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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
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>:
68 <div class="blockquote"><blockquote class="blockquote"><p>
69 <span class="inlinemediaobject"><img src="../../../equations/hermite_0.svg"></span>
71 </p></blockquote></div>
73 The final <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
74 be used to control the behaviour of the function: how it handles errors,
75 what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">policy
76 documentation for more details</a>.
79 The following graph illustrates the behaviour of the first few Hermite Polynomials:
81 <div class="blockquote"><blockquote class="blockquote"><p>
82 <span class="inlinemediaobject"><img src="../../../graphs/hermite.svg" align="middle"></span>
84 </p></blockquote></div>
85 <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="keyword">class</span> <span class="identifier">T3</span><span class="special">></span>
86 <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>
89 Implements the three term recurrence relation for the Hermite polynomials,
90 this function can be used to create a sequence of values evaluated at the
91 same <span class="emphasis"><em>x</em></span>, and for rising <span class="emphasis"><em>n</em></span>.
93 <div class="blockquote"><blockquote class="blockquote"><p>
94 <span class="inlinemediaobject"><img src="../../../equations/hermite_1.svg"></span>
96 </p></blockquote></div>
98 For example we could produce a vector of the first 10 polynomial values using:
100 <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>
101 <span class="identifier">vector</span><span class="special"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">v</span><span class="special">;</span>
102 <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>
103 <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"><</span> <span class="number">10</span><span class="special">;</span> <span class="special">++</span><span class="identifier">l</span><span class="special">)</span>
104 <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>
107 Formally the arguments are:
109 <div class="variablelist">
110 <p class="title"><b></b></p>
111 <dl class="variablelist">
112 <dt><span class="term">n</span></dt>
114 The degree <span class="emphasis"><em>n</em></span> of the last polynomial calculated.
116 <dt><span class="term">x</span></dt>
120 <dt><span class="term">Hn</span></dt>
122 The value of the polynomial evaluated at degree <span class="emphasis"><em>n</em></span>.
124 <dt><span class="term">Hnm1</span></dt>
126 The value of the polynomial evaluated at degree <span class="emphasis"><em>n-1</em></span>.
131 <a name="math_toolkit.sf_poly.hermite.h2"></a>
132 <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>
135 The following table shows peak errors (in units of epsilon) for various domains
136 of input arguments. Note that only results for the widest floating point
137 type on the system are given as narrower types have <a class="link" href="../relative_error.html#math_toolkit.relative_error.zero_error">effectively
141 <a name="math_toolkit.sf_poly.hermite.table_hermite"></a><p class="title"><b>Table 8.37. Error rates for hermite</b></p>
142 <div class="table-contents"><table class="table" summary="Error rates for hermite">
155 GNU C++ version 7.1.0<br> linux<br> double
160 GNU C++ version 7.1.0<br> linux<br> long double
165 Sun compiler version 0x5150<br> Sun Solaris<br> long double
170 Microsoft Visual C++ version 14.1<br> Win32<br> double
182 <span class="blue">Max = 0ε (Mean = 0ε)</span>
187 <span class="blue">Max = 6.24ε (Mean = 2.07ε)</span>
192 <span class="blue">Max = 6.24ε (Mean = 2.07ε)</span>
197 <span class="blue">Max = 4.46ε (Mean = 1.41ε)</span>
203 <br class="table-break"><p>
204 Note that the worst errors occur when the degree increases, values greater
205 than ~120 are very unlikely to produce sensible results, especially in the
206 associated polynomial case when the order is also large. Further the relative
207 errors are likely to grow arbitrarily large when the function is very close
211 <a name="math_toolkit.sf_poly.hermite.h3"></a>
212 <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>
215 A mixture of spot tests of values calculated using functions.wolfram.com,
216 and randomly generated test data are used: the test data was computed using
217 <a href="http://shoup.net/ntl/doc/RR.txt" target="_top">NTL::RR</a> at 1000-bit
221 <a name="math_toolkit.sf_poly.hermite.h4"></a>
222 <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>
225 These functions are implemented using the stable three term recurrence relations.
226 These relations guarantee low absolute error but cannot guarantee low relative
227 error near one of the roots of the polynomials.
230 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
231 <td align="left"></td>
232 <td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar
233 Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
234 Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
235 Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
236 Daryle Walker and Xiaogang Zhang<p>
237 Distributed under the Boost Software License, Version 1.0. (See accompanying
238 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>)
243 <div class="spirit-nav">
244 <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="chebyshev.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>