Namespaces
Variants

std:: sph_legendre, std:: sph_legendref, std:: sph_legendrel

From cppreference.net
ヘッダー <cmath> で定義
(1)
float sph_legendre ( unsigned l, unsigned m, float theta ) ;

double sph_legendre ( unsigned l, unsigned m, double theta ) ;

long double sph_legendre ( unsigned l, unsigned m, long double theta ) ;
(C++17以降)
(C++23以前)
/* floating-point-type */ sph_legendre ( unsigned l, unsigned m,
/* floating-point-type */ theta ) ;
(C++23以降)
float sph_legendref ( unsigned l, unsigned m, float theta ) ;
(2) (C++17以降)
long double sph_legendrel ( unsigned l, unsigned m, long double theta ) ;
(3) (C++17以降)
ヘッダー <cmath> で定義
template < class Integer >
double sph_legendre ( unsigned l, unsigned m, Integer theta ) ;
(A) (C++17以降)
1-3) 次数 l 、位数 m 、極角 theta 球面陪Legendre関数 を計算する。 ライブラリは、パラメータ theta の型として、すべてのcv修飾されていない浮動小数点型に対する std::sph_legendre のオーバーロードを提供する。 (C++23以降)
A) すべての整数型に対して追加のオーバーロードが提供されており、これらは double として扱われます。

目次

パラメータ

l - 次数
m - 位数
theta - 極角、ラジアン単位で測定

戻り値

If no errors occur, returns the value of the spherical associated Legendre function (that is, spherical harmonic with ϕ = 0) of l , m , and theta , where the spherical harmonic function is defined as Y m
l
(θ,ϕ) = (-1) m
[
(2l+1)(l-m)!
4π(l+m)!
] 1/2
P m
l
(cos(θ))e imϕ
where P m
l
(x)
is std:: assoc_legendre ( l, m, x ) ) and |m|≤l .

この定義には Condon-Shortley位相項 (-1) m
が含まれていることに注意してください。これは P m
l
の定義が std::assoc_legendre では省略されているためです。

エラーハンドリング

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

  • 引数がNaNの場合、NaNが返され、定義域エラーは報告されません。
  • l≥128 の場合、動作は実装定義となります。

注記

C++17をサポートしていないが、 ISO 29124:2010 をサポートしている実装では、実装が __STDCPP_MATH_SPEC_FUNCS__ を少なくとも201003L以上の値に定義しており、かつユーザーが標準ライブラリのヘッダーをインクルードする前に __STDCPP_WANT_MATH_SPEC_FUNCS__ を定義している場合、この関数を提供します。

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

球面調和関数の実装は boost.math で利用可能であり、パラメータphiをゼロに設定して呼び出された場合、この関数に帰着します。

追加のオーバーロードは (A) と完全に同一である必要はありません。それらは、整数型の引数 num に対して、 std :: sph_legendre ( int_num1, int_num2, num ) std :: sph_legendre ( int_num1, int_num2, static_cast < double > ( num ) ) と同じ効果を持つことを保証するのに十分であればよいのです。

#include <cmath>
#include <iostream>
#include <numbers>
int main()
{
    // l=3, m=0 のスポットチェック
    double x = 1.2345;
    std::cout << "Y_3^0(" << x << ") = " << std::sph_legendre(3, 0, x) << '\n';
    // 厳密解
    std::cout << "exact solution = "
              << 0.25 * std::sqrt(7 / std::numbers::pi)
                  * (5 * std::pow(std::cos(x), 3) - 3 * std::cos(x))
              << '\n';
}

出力:

Y_3^0(1.2345) = -0.302387
exact solution = -0.302387

関連項目

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

外部リンク

Weisstein, Eric W. "Spherical Harmonic." From MathWorld — A Wolfram Web Resource.
日本語訳:
Weisstein, Eric W. "Spherical Harmonic." MathWorld — Wolfram Webリソースより。
注記: - HTMLタグと属性はそのまま保持 - "Spherical Harmonic" はC++/数学用語のため非翻訳 - リンクテキスト内の人名とタイトルは非翻訳 - 出典情報のみを日本語化