命名空间
变体
操作

std::hermite、 std::hermitef、 std::hermitel

来自 cppreference.cn
 
 
实验性
技术规范
文件系统库 (filesystem TS)
库基础 (library fundamentals TS)
库基础 2 (library fundamentals TS v2)
库基础 3 (library fundamentals TS v3)
并行扩展 (parallelism TS)
并行扩展 2 (parallelism TS v2)
并发扩展 (concurrency TS)
并发扩展 2 (concurrency TS v2)
概念 (concepts TS)
范围 (ranges TS)
反射 (reflection TS)
数学特殊函数 (special functions 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) 计算次数为 n 和自变量为 x 的(物理学家)埃尔米特多项式
2) 一组重载或一个接受任何整型参数的函数模板。等价于将参数转换为 double 后的 (1)

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

目录

[编辑] 参数

n - 多项式的次数
x - 自变量,浮点型或整型的值

[编辑] 返回值

如果未发生错误,则返回 x 的 n 阶埃尔米特多项式的值,即 (-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. ""埃尔米特多项式。"" 来自 MathWorld--Wolfram Web 资源。