42 #ifndef _GLIBCXX_TR1_POLY_LAGUERRE_TCC
43 #define _GLIBCXX_TR1_POLY_LAGUERRE_TCC 1
70 template<
typename _Tpa,
typename _Tp>
75 const _Tp __a = -_Tp(__n);
76 const _Tp __b = _Tp(__alpha1) + _Tp(1);
77 const _Tp __eta = _Tp(2) * __b - _Tp(4) * __a;
78 const _Tp __cos2th = __x / __eta;
79 const _Tp __sin2th = _Tp(1) - __cos2th;
80 const _Tp __th = std::acos(
std::sqrt(__cos2th));
83 * __eta * __eta * __cos2th * __sin2th;
85 #if _GLIBCXX_USE_C99_MATH_TR1
86 const _Tp __lg_b = std::tr1::lgamma(_Tp(__n) + __b);
87 const _Tp __lnfact = std::tr1::lgamma(_Tp(__n + 1));
93 _Tp __pre_term1 = _Tp(0.5L) * (_Tp(1) - __b)
94 *
std::log(_Tp(0.25L) * __x * __eta);
95 _Tp __pre_term2 = _Tp(0.25L) *
std::log(__pre_h);
96 _Tp __lnpre = __lg_b - __lnfact + _Tp(0.5L) * __x
97 + __pre_term1 - __pre_term2;
99 _Tp __ser_term2 =
std::sin(_Tp(0.25L) * __eta
103 _Tp __ser = __ser_term1 + __ser_term2;
125 template<
typename _Tpa,
typename _Tp>
130 const _Tp __b = _Tp(__alpha1) + _Tp(1);
131 const _Tp __mx = -__x;
132 const _Tp __tc_sgn = (__x < _Tp(0) ? _Tp(1)
133 : ((__n % 2 == 1) ? -_Tp(1) : _Tp(1)));
137 for (
unsigned int __k = 1; __k <= __n; ++__k)
138 __tc *= (__ax / __k);
140 _Tp __term = __tc * __tc_sgn;
142 for (
int __k =
int(__n) - 1; __k >= 0; --__k)
144 __term *= ((__b + _Tp(__k)) / _Tp(
int(__n) - __k))
145 * _Tp(__k + 1) / __mx;
182 template<
typename _Tpa,
typename _Tp>
185 const _Tpa __alpha1,
const _Tp __x)
193 _Tp __l_1 = -__x + _Tp(1) + _Tp(__alpha1);
201 for (
unsigned int __nn = 2; __nn <= __n; ++__nn)
203 __l_n = (_Tp(2 * __nn - 1) + _Tp(__alpha1) - __x)
205 - (_Tp(__nn - 1) + _Tp(__alpha1)) * __l_n2 / _Tp(__nn);
242 template<
typename _Tpa,
typename _Tp>
248 std::__throw_domain_error(__N(
"Negative argument "
249 "in __poly_laguerre."));
251 else if (__isnan(__x))
256 return _Tp(1) + _Tp(__alpha1) - __x;
257 else if (__x == _Tp(0))
259 _Tp __prod = _Tp(__alpha1) + _Tp(1);
260 for (
unsigned int __k = 2; __k <= __n; ++__k)
261 __prod *= (_Tp(__alpha1) + _Tp(__k)) / _Tp(__k);
264 else if (__n > 10000000 && _Tp(__alpha1) > -_Tp(1)
265 && __x < _Tp(2) * (_Tp(__alpha1) + _Tp(1)) + _Tp(4 * __n))
267 else if (_Tp(__alpha1) >= _Tp(0)
268 || (__x > _Tp(0) && _Tp(__alpha1) < -_Tp(__n + 1)))
295 template<
typename _Tp>
300 return __poly_laguerre<unsigned int, _Tp>(__n, __m, __x);
318 template<
typename _Tp>
322 return __poly_laguerre<unsigned int, _Tp>(__n, 0, __x);
329 #endif // _GLIBCXX_TR1_POLY_LAGUERRE_TCC
_Tp __poly_laguerre_large_n(const unsigned __n, const _Tpa __alpha1, const _Tp __x)
This routine returns the associated Laguerre polynomial of order , degree for large n...
complex< _Tp > log(const complex< _Tp > &)
Return complex natural logarithm of z.
A structure for numeric constants.
_Tp __poly_laguerre_hyperg(const unsigned int __n, const _Tpa __alpha1, const _Tp __x)
Evaluate the polynomial based on the confluent hypergeometric function in a safe way, with no restriction on the arguments.
static _Tp __pi_2()
Constant .
complex< _Tp > sqrt(const complex< _Tp > &)
Return complex square root of z.
_Tp __assoc_laguerre(const unsigned int __n, const unsigned int __m, const _Tp __x)
This routine returns the associated Laguerre polynomial of order n, degree m: .
_Tp __poly_laguerre(const unsigned int __n, const _Tpa __alpha1, const _Tp __x)
This routine returns the associated Laguerre polynomial of order n, degree : .
_Tp __laguerre(const unsigned int __n, const _Tp __x)
This routine returns the Laguerre polynomial of order n: .
_Tp __log_gamma(const _Tp __x)
Return . This will return values even for . To recover the sign of for any argument use __log_gamma_...
complex< _Tp > sin(const complex< _Tp > &)
Return complex sine of z.
_Tp __poly_laguerre_recursion(const unsigned int __n, const _Tpa __alpha1, const _Tp __x)
This routine returns the associated Laguerre polynomial of order , degree : by recursion.
_Tp abs(const complex< _Tp > &)
Return magnitude of z.
complex< _Tp > exp(const complex< _Tp > &)
Return complex base e exponential of z.