Namespaces
Variants

std:: assoc_legendre, std:: assoc_legendref, std:: assoc_legendrel

From cppreference.net
double assoc_legendre ( unsigned int n, unsigned int m, double x ) ;

double assoc_legendre ( unsigned int n, unsigned int m, float x ) ;
double assoc_legendre ( unsigned int n, unsigned int m, long double x ) ;
float assoc_legendref ( unsigned int n, unsigned int m, float x ) ;

long double assoc_legendrel ( unsigned int n, unsigned int m, long double x ) ;
(1)
double assoc_legendre ( unsigned int n, unsigned int m, IntegralType x ) ;
(2)
1) 次数 n 、位数 m 、引数 x 関連ルジャンドル多項式 を計算する。
2) 任意の integral type の引数を受け入れるオーバーロードのセットまたは関数テンプレート。引数を double にキャストした後、 (1) と等価です。

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

目次

パラメータ

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

戻り値

If no errors occur, value of the associated Legendre polynomial P m
n
of x , that is (1 - x 2
) m/2
d m
dx m
P n (x)
, is returned (where P n (x) is the unassociated Legendre polynomial, std:: legendre ( n, x ) ).

エラーハンドリング

エラーは math_errhandling で指定されている通りに報告される場合があります。

  • 引数がNaNの場合、NaNが返され、定義域エラーは報告されません。
  • |x| > 1 の場合、定義域エラーが発生する可能性があります。
  • n が128以上の場合、動作は実装定義となります。

注記

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

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

最初のいくつかの随伴ルジャンドル多項式は以下の通りです:

  • assoc_legendre(0, 0, x) = 1.
  • assoc_legendre(1, 0, x) = x .
  • assoc_legendre(1, 1, x) = -(1 - x 2
    ) 1/2
    .
  • assoc_legendre(2, 0, x) =
    1
    2
    (3x 2
    - 1)
    .
  • assoc_legendre(2, 1, x) = -3x(1 - x 2
    ) 1/2
    .
  • assoc_legendre(2, 2, x) = 3(1 - x 2
    )
    .

(gcc 6.0で示された通り動作します)

#define __STDCPP_WANT_MATH_SPEC_FUNCS__ 1
#include <cmath>
#include <iostream>
double P20(double x)
{
    return 0.5 * (3 * x * x - 1);
}
double P21(double x)
{
    return -3.0 * x * std::sqrt(1 - x * x);
}
double P22(double x)
{
    return 3 * (1 - x * x);
}
int main()
{
    // spot-checks
    std::cout << std::assoc_legendre(2, 0, 0.5) << '=' << P20(0.5) << '\n'
              << std::assoc_legendre(2, 1, 0.5) << '=' << P21(0.5) << '\n'
              << std::assoc_legendre(2, 2, 0.5) << '=' << P22(0.5) << '\n';
}

出力:

-0.125=-0.125
-1.29904=-1.29904
2.25=2.25

関連項目

ルジャンドル多項式
(関数)

外部リンク

Weisstein, Eric W. "Associated Legendre Polynomial." MathWorld(Wolfram Webリソース)より。