名前空間
変種
操作

std::laguerre, std::laguerref, std::laguerrel

From cppreference.com
 
 
 
 
double      laguerre( unsigned int n, double x );

double      laguerre( unsigned int n, float x );
double      laguerre( unsigned int n, long double x );
float       laguerref( unsigned int n, float x );

long double laguerrel( unsigned int n, long double x );
(1)
double      laguerre( unsigned int n, IntegralType x );
(2)
1) 次数 n および引数 x の非連想 ラゲール多項式 を計算します。
2) 整数型 (integral type) の引数を受け付けるオーバーロードのセット、または関数テンプレートです。引数を double にキャストした後の (1) と同等です。

すべての特殊関数と同様に、laguerre は、実装によって __STDCPP_MATH_SPEC_FUNCS__ が 201003L 以上の値に定義されており、かつユーザーが標準ライブラリヘッダーをインクルードする前に __STDCPP_WANT_MATH_SPEC_FUNCS__ を定義した場合にのみ、<cmath> で利用可能であることが保証されます。

目次

[編集] パラメータ

n - 多項式の次数。符号なし整数型の値。
x - 引数。浮動小数点型または整数型の値。

[編集] 戻り値

エラーが発生しなかった場合、x の非連想ラゲール多項式の値、すなわち
ex
n!
dn
dxn
(xn
e-x)
が返されます。

[編集] エラー処理

math_errhandling で指定されたとおりにエラーが報告される場合があります。

  • 引数がNaNの場合、NaNが返され、ドメインエラーは報告されません。
  • x が負の場合、定義域エラーが発生する可能性があります。
  • n が 128 以上の場合、動作は実装定義です。

[編集] 注記

TR 29124 をサポートしないが TR 19768 をサポートする実装では、この関数はヘッダー tr1/cmath および名前空間 std::tr1 で提供されます。

この関数の実装は、boost.math でも利用可能です。

ラゲール多項式は、方程式 xy,,
+ (1 - x)y,
+ ny = 0
の多項式解です。

最初のいくつかの多項式は次のとおりです。

  • laguerre(0, x) = 1。
  • laguerre(1, x) = -x + 1
  • laguerre(2, x) =
    1
    2
    [x2
    - 4x + 2]
  • laguerre(3, x) =
    1
    6
    [-x3
    - 9x2
    - 18x + 6]

[編集]

(gcc 6.0で示されたとおりに動作します)

#define __STDCPP_WANT_MATH_SPEC_FUNCS__ 1
#include <cmath>
#include <iostream>
 
double L1(double x)
{
    return -x + 1;
}
 
double L2(double x)
{
    return 0.5 * (x * x - 4 * x + 2);
}
 
int main()
{
    // spot-checks
    std::cout << std::laguerre(1, 0.5) << '=' << L1(0.5) << '\n'
              << std::laguerre(2, 0.5) << '=' << L2(0.5) << '\n';
}

出力

0.5=0.5
0.125=0.125

[編集] 関連項目

ラゲール陪多項式
(関数) [編集]

[編集] 外部リンク

Weisstein, Eric W. "Laguerre Polynomial." From MathWorld--A Wolfram Web Resource.

English 日本語 中文(简体) 中文(繁體)