• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

    最終更新日時(UTC):
    が更新

    履歴 編集

    function
    <cmath>

    std::hermite

    namespace std {
      double
        hermite(unsigned int n,
                double x);              // (1) C++17
      floating-point-type
        hermite(unsigned int n,
                floating-point-type x); // (1) C++23
    
      Promoted
        hermite(unsigned int n,
                Arithmetic x);          // (2) C++17
    
      float
        hermitef(unsigned int n,
                 float x);              // (3) C++17
    
      long double
        hermitel(unsigned int n,
                 long double x);        // (4) C++17
    }
    

    概要

    エルミート多項式 (Hermite polynomials) を求める。

    戻り値

    引数 n, x のエルミート多項式 Hn(x)=(1)nexp(x2)dndxnexp(x2) を返す。

    備考

    #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
    }
    

    出力例

    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

    処理系

    実装例

    閉形式

    Hn(x)=n!j=0n/2(1)jj!(n2j)!(2x)n2j

    漸化式

    Hn(x)=2xHn1(x)2(n1)Hn2(x);H0(x)=1,H1(x)=2x

    参照