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

来自cppreference.com
 
 
实验性
技术规范
文件系统库 (文件系统 TS)
库基础 (库基础 TS)
库基础 2 (库基础 TS v2)
库基础 3 (库基础 TS v3)
并行扩展 (并行 TS)
并行扩展 2 (并行 TS v2)
并发扩展 (并发 TS)
并发扩展 2 (并发 TS v2)
概念 (概念 TS)
范围 (范围 TS)
反射 (反射 TS)
数学特殊函数 (特殊函数 TR)
实验性非 TS 功能特性
模式匹配
线性代数
std::execution
契约
2D 图形
 
 
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) 计算实参 x 的 {{c|n} 度无连带拉盖尔多项式的值。
2) 一组接受任何整数类型实参的重载或函数模板。等价于将实参转型为 double 后的 (1)

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

参数

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

返回值

如果未发生错误,则返回 x 的无连带拉盖尔多项式的值,即
ex
n!
dn
dxn
(xn
e-x)

错误处理

根据 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
    [x2
    - 4x + 2]
  • laguerre(3, x) =
    1
    6
    [-x3
    - 9x2
    - 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()
{
    // spot-checks
    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

参阅

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

外部链接

Weisstein, Eric W. "Laguerre Polynomial." From MathWorld--A Wolfram Web Resource.