• Class / Function / Type

      std::
    • Header file

      <>
    • Other / All

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

    履歴 編集

    function
    <cmath>

    std::laguerre

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

    概要

    ラゲール多項式 (Laguerre polynomials) を求める。

    戻り値

    引数 n, x のラゲール多項式 Ln(x)=exn!dndxn(xnex)for x0 を返す。

    備考

    #include <cmath>
    #include <iostream>
    
    void p(unsigned n) {
      for (double x : {0., 1., 2.})
        std::cout << "laguerre(" << n << ", " << x << ") = " << std::laguerre(n, x) << "\n";
      std::cout << "\n";
    }
    
    int main() {
      p(0); // L0(x) = 1
      p(1); // L1(x) = -x + 1
      p(2); // L2(x) = (x^2 - 4x + 2) / 2
      p(3); // L3(x) = (-x^3 + 9x^2 - 18x + 6) / 6
    }
    

    出力例

    laguerre(0, 0) = 1
    laguerre(0, 1) = 1
    laguerre(0, 2) = 1
    
    laguerre(1, 0) = 1
    laguerre(1, 1) = 0
    laguerre(1, 2) = -1
    
    laguerre(2, 0) = 1
    laguerre(2, 1) = -0.5
    laguerre(2, 2) = -1
    
    laguerre(3, 0) = 1
    laguerre(3, 1) = -0.666667
    laguerre(3, 2) = -0.333333
    
    

    バージョン

    言語

    • C++17

    処理系

    実装例

    閉形式

    Ln(x)=j=0nn!j!(nj)!(x)jj!

    漸化式

    Ln(x)=(2n1x)Ln1(x)(n1)Ln2(x)n;L0(x)=1,L1(x)=x+1

    関連項目

    参照