1 // Special functions -*- C++ -*-
3 // Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
4 // Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // Under Section 7 of GPL version 3, you are granted additional
18 // permissions described in the GCC Runtime Library Exception, version
19 // 3.1, as published by the Free Software Foundation.
21 // You should have received a copy of the GNU General Public License and
22 // a copy of the GCC Runtime Library Exception along with this program;
23 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
24 // <http://www.gnu.org/licenses/>.
26 /** @file tr1/poly_hermite.tcc
27 * This is an internal header file, included by other library headers.
28 * Do not attempt to use it directly. @headername{tr1/cmath}
32 // ISO C++ 14882 TR1: 5.2 Special functions
35 // Written by Edward Smith-Rowland based on:
36 // (1) Handbook of Mathematical Functions,
37 // Ed. Milton Abramowitz and Irene A. Stegun,
38 // Dover Publications, Section 22 pp. 773-802
40 #ifndef _GLIBCXX_TR1_POLY_HERMITE_TCC
41 #define _GLIBCXX_TR1_POLY_HERMITE_TCC 1
43 namespace std _GLIBCXX_VISIBILITY(default)
47 // [5.2] Special functions
49 // Implementation-space details.
52 _GLIBCXX_BEGIN_NAMESPACE_VERSION
55 * @brief This routine returns the Hermite polynomial
56 * of order n: \f$ H_n(x) \f$ by recursion on n.
58 * The Hermite polynomial is defined by:
60 * H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2}
63 * @param __n The order of the Hermite polynomial.
64 * @param __x The argument of the Hermite polynomial.
65 * @return The value of the Hermite polynomial of order n
68 template<typename _Tp>
70 __poly_hermite_recursion(const unsigned int __n, const _Tp __x)
83 _Tp __H_n, __H_nm1, __H_nm2;
85 for (__H_nm2 = __H_0, __H_nm1 = __H_1, __i = 2; __i <= __n; ++__i)
87 __H_n = 2 * (__x * __H_nm1 - (__i - 1) * __H_nm2);
97 * @brief This routine returns the Hermite polynomial
98 * of order n: \f$ H_n(x) \f$.
100 * The Hermite polynomial is defined by:
102 * H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2}
105 * @param __n The order of the Hermite polynomial.
106 * @param __x The argument of the Hermite polynomial.
107 * @return The value of the Hermite polynomial of order n
110 template<typename _Tp>
112 __poly_hermite(const unsigned int __n, const _Tp __x)
115 return std::numeric_limits<_Tp>::quiet_NaN();
117 return __poly_hermite_recursion(__n, __x);
120 _GLIBCXX_END_NAMESPACE_VERSION
121 } // namespace std::tr1::__detail
125 #endif // _GLIBCXX_TR1_POLY_HERMITE_TCC