Namespaces
Variants

std:: laguerre, std:: laguerref, std:: laguerrel

From cppreference.net
double laguerre ( unsigned int n, double x ) ;

double laguerre ( unsigned int n, float x ) ;
double laguerre ( unsigned int n, long double x ) ;
float laguerref ( unsigned int n, float x ) ;

long double laguerrel ( unsigned int n, long double x ) ;
(1)
double laguerre ( unsigned int n, IntegralType x ) ;
(2)
1) 计算 n 次非关联 拉盖尔多项式 ,参数为 x
2) 一组重载或函数模板,接受任意 整数类型 参数。在将参数强制转换为 double 后,等同于 (1)

与所有特殊函数一样,只有当实现将 __STDCPP_MATH_SPEC_FUNCS__ 定义为至少 201003L 的值,且用户在包含任何标准库头文件之前定义了 __STDCPP_WANT_MATH_SPEC_FUNCS__ 时,才保证 laguerre <cmath> 中可用。

目录

参数

n - 多项式次数,无符号整数类型的值
x - 参数,浮点数或整数类型的值

返回值

If no errors occur, value of the nonassociated Laguerre polynomial of x , that is
e x
n!
d n
dx n
(x n
e -x )
, is returned.

错误处理

错误报告方式可按照 math_errhandling 中的规定执行。

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

注释

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

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

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

前几个是:

  • laguerre(0, x) = 1。
  • laguerre(1, x) = -x + 1
  • laguerre(2, x) =
    1
    2
    [x 2
    - 4x + 2]
  • laguerre(3, x) =
    1
    6
    [-x 3
    - 9x 2
    - 18x + 6]

示例

(在 gcc 6.0 下运行结果如上所示)

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

输出:

0.5=0.5
0.125=0.125

参见

关联拉盖尔多项式
(函数)

外部链接

魏斯斯坦, 埃里克·W. 《拉盖尔多项式》 摘自 MathWorld——沃尔夫勒姆网络资源。