std:: sph_legendre, std:: sph_legendref, std:: sph_legendrel
|
Definido en el encabezado
<cmath>
|
||
| (1) | ||
|
float
sph_legendre
(
unsigned
l,
unsigned
m,
float
theta
)
;
double
sph_legendre
(
unsigned
l,
unsigned
m,
double
theta
)
;
|
(desde C++17)
(hasta C++23) |
|
|
/* floating-point-type */
sph_legendre
(
unsigned
l,
unsigned
m,
/* floating-point-type */ theta ) ; |
(desde C++23) | |
|
float
sph_legendref
(
unsigned
l,
unsigned
m,
float
theta
)
;
|
(2) | (desde C++17) |
|
long
double
sph_legendrel
(
unsigned
l,
unsigned
m,
long
double
theta
)
;
|
(3) | (desde C++17) |
|
Definido en el encabezado
<cmath>
|
||
|
template
<
class
Integer
>
double sph_legendre ( unsigned l, unsigned m, Integer theta ) ; |
(A) | (desde C++17) |
std::sph_legendre
para todos los tipos de punto flotante sin calificación cv como el tipo del parámetro
theta
.
(desde C++23)
Contenidos |
Parámetros
| l | - | grado |
| m | - | orden |
| theta | - | ángulo polar, medido en radianes |
Valor de retorno
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 .
Tenga en cuenta que el
término de fase de Condon-Shortley
(-1)
m
está incluido en esta definición porque se omite de la definición de
P
m
l
en
std::assoc_legendre
.
Manejo de errores
Los errores pueden ser reportados como se especifica en math_errhandling .
- Si el argumento es NaN, se devuelve NaN y no se reporta un error de dominio.
- Si l≥128 , el comportamiento está definido por la implementación.
Notas
Las implementaciones que no admiten C++17, pero sí admiten
ISO 29124:2010
, proporcionan esta función si
__STDCPP_MATH_SPEC_FUNCS__
está definido por la implementación con un valor de al menos 201003L y si el usuario define
__STDCPP_WANT_MATH_SPEC_FUNCS__
antes de incluir cualquier cabecera de la biblioteca estándar.
Las implementaciones que no admiten ISO 29124:2010 pero sí admiten TR 19768:2007 (TR1), proporcionan esta función en el encabezado
tr1/cmath
y el espacio de nombres
std::tr1
.
Una implementación de la función armónica esférica está disponible en boost.math , y se reduce a esta función cuando se llama con el parámetro phi establecido en cero.
Las sobrecargas adicionales no requieren ser proporcionadas exactamente como (A) . Solo necesitan ser suficientes para garantizar que para su argumento num de tipo entero, std :: sph_legendre ( int_num1, int_num2, num ) tenga el mismo efecto que std :: sph_legendre ( int_num1, int_num2, static_cast < double > ( num ) ) .
Ejemplo
#include <cmath> #include <iostream> #include <numbers> int main() { // verificación puntual para l=3, m=0 double x = 1.2345; std::cout << "Y_3^0(" << x << ") = " << std::sph_legendre(3, 0, x) << '\n'; // solución exacta std::cout << "exact solution = " << 0.25 * std::sqrt(7 / std::numbers::pi) * (5 * std::pow(std::cos(x), 3) - 3 * std::cos(x)) << '\n'; }
Salida:
Y_3^0(1.2345) = -0.302387 exact solution = -0.302387
Véase también
|
(C++17)
(C++17)
(C++17)
|
polinomios asociados de Legendre
(función) |
Enlaces externos
| Weisstein, Eric W. "Spherical Harmonic." De MathWorld — Un recurso web de Wolfram. |