XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ sharmonicr()

double sharmonicr ( unsigned int  l,
int  m,
double  theta,
double  phi 
)

Real part of spherical harmonic Ylm(θ, φ)

Purpose
sharmonicr computes the real part of the spherical harmonic of degree l, order m, polar angle θ and azimuth φ.
Ylm(θ, φ) = [(2l + 1)/4π (l - m)!/(l + m)!]^(1/2) Plm(cosθ)exp(imφ), where m <= l.
Plm(x) is an associated Legendre polynomial. Note that the phase factor of (-1)^m is included in Plm(x).
Returns
Real part of spherical harmonic Ylm(θ, φ).
Parameters
[in]lDegree l.
[in]mOrder m. (|m| <= l)
[in]thetaPolar angle θ.
Generally use theta in the range [0, π]. For theta outside this range, the result may be different from other implementation.
[in]phiAzimuth φ.
Generally use phi in the range [0, 2π]. For phi outside this range, the result may be different from other implementation.
Error handling
  • If |m| > l, domain error (EDOM) occurs.
  • Range error (ERANGE) may occur.
Note
  • Note that the worst errors occur when the degree increases, values greater than ~120 are very unlikely to produce sensible results, especially when the order is also large. Further the relative errors are likely to grow arbitrarily large when the function is very close to a root.
Reference
boost/math/special_functions