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

◆ sharmonic_sub()

void sharmonic_sub ( unsigned int  l,
int  m,
double  theta,
double  phi,
std::complex< double > *  z 
)

Spherical harmonic Ylm(θ, φ)

Purpose
sharmonic_sub computes 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).
sharmonic_sub is the subroutine version of sharmonic.
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.
[out]zSpherical harmonic Ylm(θ, φ).
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