Namespaces
Variants

std:: assoc_laguerre, std:: assoc_laguerref, std:: assoc_laguerrel

From cppreference.net
定义于头文件 <cmath>
(1)
float assoc_laguerre ( unsigned int n, unsigned int m, float x ) ;

double assoc_laguerre ( unsigned int n, unsigned int m, double x ) ;

long double assoc_laguerre ( unsigned int n, unsigned int m, long double x ) ;
(C++17 起)
(C++23 前)
/* 浮点类型 */ assoc_laguerre ( unsigned int n, unsigned int m,
/* 浮点类型 */ x ) ;
(C++23 起)
float assoc_laguerref ( unsigned int n, unsigned int m, float x ) ;
(2) (C++17 起)
long double assoc_laguerrel ( unsigned int n, unsigned int m, long double x ) ;
(3) (C++17 起)
定义于头文件 <cmath>
template < class Integer >
double assoc_laguerre ( unsigned int n, unsigned int m, Integer x ) ;
(A) (C++17 起)
1-3) 计算次数为 n 、阶数为 m 、自变量为 x 连带拉盖尔多项式 该库为所有 cv 未限定浮点类型提供了 std::assoc_laguerre 的重载版本,作为参数 x 的类型。 (C++23 起)
A) 为所有整数类型提供了额外的重载,这些类型将被视为 double

目录

参数

n - 多项式次数,无符号整数值
m - 多项式阶数,无符号整数值
x - 函数参数,浮点数或整数值

返回值

If no errors occur, value of the associated Laguerre polynomial of x , that is (-1) m
d m
dx m
L n+m (x)
, is returned (where L n+m (x) is the unassociated Laguerre polynomial, std:: laguerre ( n + m, x ) ).

错误处理

错误报告方式遵循 math_errhandling 规范

  • 若参数为 NaN,则返回 NaN 且不报告定义域错误
  • x 为负数,可能出现定义域错误
  • n m 大于等于 128,则行为由实现定义

注释

不支持C++17但支持 ISO 29124:2010 的实现,若实现将 __STDCPP_MATH_SPEC_FUNCS__ 定义为至少201003L的值,且用户在包含任何标准库头文件之前定义了 __STDCPP_WANT_MATH_SPEC_FUNCS__ ,则会提供此函数。

不支持 ISO 29124:2010 但支持 TR 19768:2007 (TR1) 的实现,会在头文件 tr1/cmath 和命名空间 std::tr1 中提供此函数。

此函数的实现也可 在 boost.math 中找到

连带拉盖尔多项式是方程 xy ,,
+(m+1-x)y ,
+ny = 0
的多项式解。

前几个是:

函数 多项式
assoc_laguerre ( 0 , m, x ) 1
assoc_laguerre ( 1 , m, x ) -x + m + 1
assoc_laguerre ( 2 , m, x )
1
2
[x 2
- 2(m + 2)x + (m + 1)(m + 2)]
assoc_laguerre ( 3 , m, x )
1
6
[-x 3
- 3(m + 3)x 2
- 3(m + 2)(m + 3)x + (m + 1)(m + 2)(m + 3)]

额外的重载不需要完全按照 (A) 的形式提供。只需确保对于整数类型的实参 num std :: assoc_laguerre ( int_num1, int_num2, num ) std :: assoc_laguerre ( int_num1, int_num2, static_cast < double > ( num ) ) 具有相同效果即可。

示例

#include <cmath>
#include <iostream>
double L1(unsigned m, double x)
{
    return -x + m + 1;
}
double L2(unsigned m, double x)
{
    return 0.5 * (x * x - 2 * (m + 2) * x + (m + 1) * (m + 2));
}
int main()
{
    // 点校验
    std::cout << std::assoc_laguerre(1, 10, 0.5) << '=' << L1(10, 0.5) << '\n'
              << std::assoc_laguerre(2, 10, 0.5) << '=' << L2(10, 0.5) << '\n';
}

输出:

10.5=10.5
60.125=60.125

参见

(C++17) (C++17) (C++17)
拉盖尔多项式
(函数)

外部链接

魏斯坦,埃里克·W。《连带拉盖尔多项式》 摘自 MathWorld —— 一个 Wolfram 网络资源。