std:: sph_legendre, std:: sph_legendref, std:: sph_legendrel
|
ヘッダー
<cmath>
で定義
|
||
| (1) | ||
|
float
sph_legendre
(
unsigned
l,
unsigned
m,
float
theta
)
;
double
sph_legendre
(
unsigned
l,
unsigned
m,
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以降) |
std::sph_legendre
のオーバーロードを提供する。
(C++23以降)
目次 |
パラメータ
| 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 ml (θ,ϕ) = (-1) m
[
| (2l+1)(l-m)! |
| 4π(l+m)! |
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
関連項目
|
(C++17)
(C++17)
(C++17)
|
関連ルジャンドル多項式
(関数) |
外部リンク
| Weisstein, Eric W. "Spherical Harmonic." From MathWorld — A Wolfram Web Resource. |
| Weisstein, Eric W. "Spherical Harmonic." MathWorld — Wolfram Webリソースより。 |