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 | - | 차수(degree) |
| m | - | 차수(order) |
| theta | - | 극각(polar angle), 라디안 단위로 측정 |
반환값
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 (theta,ϕ) = (-1) m
[
| (2l+1)(l-m)! |
| 4π(l+m)! |
P m
l (cos(theta))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 매개변수를 0으로 설정하여 호출할 때 이 함수로 축소됩니다.
추가 오버로드는 반드시 (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." MathWorld — 울프램 웹 리소스에서 발췌. |