1 // Special functions -*- C++ -*-
3 // Copyright (C) 2006-2007
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 2, 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 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 // As a special exception, you may use this file as part of a free software
23 // library without restriction. Specifically, if other files instantiate
24 // templates or use macros or inline functions from this file, or you compile
25 // this file and link it with other files to produce an executable, this
26 // file does not by itself cause the resulting executable to be covered by
27 // the GNU General Public License. This exception does not however
28 // invalidate any other reasons why the executable file might be covered by
29 // the GNU General Public License.
31 /** @file tr1/poly_hermite.tcc
32 * This is an internal header file, included by other library headers.
33 * You should not attempt to use it directly.
37 // ISO C++ 14882 TR1: 5.2 Special functions
40 // Written by Edward Smith-Rowland based on:
41 // (1) Handbook of Mathematical Functions,
42 // Ed. Milton Abramowitz and Irene A. Stegun,
43 // Dover Publications, Section 22 pp. 773-802
45 #ifndef _GLIBCXX_TR1_POLY_HERMITE_TCC
46 #define _GLIBCXX_TR1_POLY_HERMITE_TCC 1
53 // [5.2] Special functions
56 * @ingroup tr1_math_spec_func
61 // Implementation-space details.
67 * @brief This routine returns the Hermite polynomial
68 * of order n: \f$ H_n(x) \f$ by recursion on n.
70 * The Hermite polynomial is defined by:
72 * H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2}
75 * @param __n The order of the Hermite polynomial.
76 * @param __x The argument of the Hermite polynomial.
77 * @return The value of the Hermite polynomial of order n
80 template<typename _Tp>
82 __poly_hermite_recursion(const unsigned int __n, const _Tp __x)
95 _Tp __H_n, __H_nm1, __H_nm2;
97 for (__H_nm2 = __H_0, __H_nm1 = __H_1, __i = 2; __i <= __n; ++__i)
99 __H_n = 2 * (__x * __H_nm1 + (__i - 1) * __H_nm2);
109 * @brief This routine returns the Hermite polynomial
110 * of order n: \f$ H_n(x) \f$.
112 * The Hermite polynomial is defined by:
114 * H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} e^{-x^2}
117 * @param __n The order of the Hermite polynomial.
118 * @param __x The argument of the Hermite polynomial.
119 * @return The value of the Hermite polynomial of order n
122 template<typename _Tp>
124 __poly_hermite(const unsigned int __n, const _Tp __x)
127 return std::numeric_limits<_Tp>::quiet_NaN();
129 return __poly_hermite_recursion(__n, __x);
132 } // namespace std::tr1::__detail
134 /* @} */ // group tr1_math_spec_func
139 #endif // _GLIBCXX_TR1_POLY_HERMITE_TCC