std::laguerre, std::laguerref, std::laguerrel
From cppreference.com
< cpp | experimental | special functions
| double laguerre( unsigned int n, double x ); double laguerre( unsigned int n, float x ); |
(1) | |
| double laguerre( unsigned int n, IntegralType x ); |
(2) | |
すべての特殊関数と同様に、laguerre は、実装によって __STDCPP_MATH_SPEC_FUNCS__ が 201003L 以上の値に定義されており、かつユーザーが標準ライブラリヘッダーをインクルードする前に __STDCPP_WANT_MATH_SPEC_FUNCS__ を定義した場合にのみ、<cmath> で利用可能であることが保証されます。
目次 |
[編集] パラメータ
| n | - | 多項式の次数。符号なし整数型の値。 |
| x | - | 引数。浮動小数点型または整数型の値。 |
[編集] 戻り値
エラーが発生しなかった場合、x の非連想ラゲール多項式の値、すなわち | ex |
| n! |
| dn |
| dxn |
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) =
[x21 2
- 4x + 2]。 - laguerre(3, x) =
[-x31 6
- 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.