Namespaces
Variants

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

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

float hermite ( unsigned int n, float x ) ;

long double hermite ( unsigned int n, long double x ) ;
(C++17 起)
(C++23 前)
/* 浮点类型 */ hermite ( unsigned int n,
/* 浮点类型 */ x ) ;
(C++23 起)
float hermitef ( unsigned int n, float x ) ;
(2) (C++17 起)
long double hermitel ( unsigned int n, long double x ) ;
(3) (C++17 起)
定义于头文件 <cmath>
template < class Integer >
double hermite ( unsigned int n, Integer x ) ;
(A) (C++17 起)
1-3) 计算 n 次(物理学家的) 埃尔米特多项式 ,参数为 x 该库为所有cv未限定的浮点类型提供了 std::hermite 的重载,作为参数 x 的类型。 (C++23 起)
A) 为所有整数类型提供了额外的重载,这些类型将被视为 double

目录

参数

n - 多项式的次数
x - 参数,浮点数或整数值

返回值

If no errors occur, value of the order- n Hermite polynomial of x , that is (-1) n
e x 2
d n
dx n
e -x 2
, is returned.

错误处理

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

  • 若参数为 NaN,则返回 NaN 且不报告定义域错误。
  • n 大于或等于 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 中找到

埃尔米特多项式是方程 u ,,
-2xu ,
= -2nu
的多项式解。

前几个是:

函数 多项式
hermite ( 0 , x ) 1
hermite ( 1 , x ) 2x
hermite ( 2 , x ) 4x 2
- 2
hermite ( 3 , x ) 8x 3
- 12x
hermite ( 4 , x ) 16x 4
- 48x 2
+ 12

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

示例

#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()
{
    // 点校验
    std::cout << std::hermite(3, 10) << '=' << H3(10) << '\n'
              << std::hermite(4, 10) << '=' << H4(10) << '\n';
}

输出:

7880=7880
155212=155212

参见

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

外部链接

韦斯坦,埃里克·W.《埃尔米特多项式》 摘自 MathWorld —— 一个 Wolfram 网络资源。