- cmath[meta header]
- function[meta id-type]
- std[meta namespace]
- [mathjax enable]
- cpp17[meta cpp]
namespace std {
float hermitef(unsigned n, float x);
double hermite(unsigned n, double x);
long double hermitel(unsigned n, long double x);
}エルミート多項式 (Hermite polynomials) を求める。
引数 n, x のエルミート多項式
$$ H_n(x) = (-1)^n \exp(x^2) \frac{\mathrm{d}^n}{\mathrm{d}x^n} \exp(-x^2) $$
を返す。
n >= 128 の場合、この関数の呼び出しの効果は実装定義である。
#include <cmath>
#include <iostream>
void p(unsigned n) {
for (double x : {-1, 0, 1})
std::cout << "hermite(" << n << ", " << x << ") = " << std::hermite(n, x) << "\n";
std::cout << "\n";
}
int main() {
p(0); // H0(x) = 1
p(1); // H1(x) = 2x
p(2); // H2(x) = 4x^2 - 2
p(3); // H3(x) = 8x^3 - 12x
}- std::hermite[color ff0000]
hermite(0, -1) = 1
hermite(0, 0) = 1
hermite(0, 1) = 1
hermite(1, -1) = -2
hermite(1, 0) = 0
hermite(1, 1) = 2
hermite(2, -1) = 2
hermite(2, 0) = -2
hermite(2, 1) = 2
hermite(3, -1) = 4
hermite(3, 0) = -0
hermite(3, 1) = -4
- C++17
- Clang: ??
- GCC: 7.1.0
- ICC: ??
- Visual C++: ??
- N3060 JTC1.22.29124 Programming Language C++ — Special Math Functions
- WG21 P0226R1 Mathematical Special Functions for C++17, v5
- ISO/IEC 29124:2010 Information technology -- Programming languages, their environments and system software interfaces -- Extensions to the C++ Library to support mathematical special functions