std::hermite, std::hermitef, std::hermitel

来自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      hermite( unsigned int n, double x );

double      hermite( unsigned int n, float x );
double      hermite( unsigned int n, long double x );
float       hermitef( unsigned int n, float x );

long double hermitel( unsigned int n, long double x );
(1)
double      hermite( unsigned int n, IntegralType x );
(2)
1) 计算实参 xn厄密多项式
2) 一组接受任何整数类型实参的重载或函数模板。等价于将实参转型为 double 后的 (1)

Template:cpp/experimental/special math/macro note

参数

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

返回值

如果未发生错误,则返回 xn 阶厄密多项式的值,即 (-1)n
ex2
dn
dxn
e-x2

错误处理

根据 math_errhandling 的规定进行错误报告。

  • 如果实参为 NaN,则返回 NaN 但不报告定义域错误。
  • 如果 n 大于或等于 128,则其行为由实现定义。

注解

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

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

厄密多项式是方程 u,,
- 2xu,
= -2nu
的多项式解。

前几个为:

  • hermite(0, x) = 1
  • hermite(1, x) = 2x
  • hermite(2, x) = 4x2
    - 2
  • hermite(3, x) = 8x3
    - 12x
  • hermite(4, x) = 16x4
    - 48x2
    + 12

示例

(以 gcc 6.0 运行)

#define __STDCPP_WANT_MATH_SPEC_FUNCS__ 1
#include <cmath>
#include <iostream>
 
double H3(double x)
{
    return 8 * std::pow(x, 3) - 12 * x;
}
 
double H4(double x)
{
    return 16 * std::pow(x, 4) - 48 * x * x + 12;
}
 
int main()
{
    // spot-checks
    std::cout << std::hermite(3, 10) << '=' << H3(10) << '\n'
              << std::hermite(4, 10) << '=' << H4(10) << '\n';
}

输出:

7880=7880
155212=155212

参阅

拉盖尔多项式
(函数)
勒让德多项式
(函数)

外部链接

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