Skip to main content

Module spherical_harmonics

Module spherical_harmonics 

Source
Expand description

Associated Legendre functions and spherical harmonics.

Conventions: the Condon-Shortley phase (−1)^m is included in P_l^m, and Y_l^m(θ, φ) = √((2l+1)/(4π) · (l−m)!/(l+m)!) P_l^m(cos θ) e^{imφ} is orthonormal on the unit sphere, with Y_l^{−m} = (−1)^m conj(Y_l^m) (the physics and quantum-mechanics convention).

See the book entry Orthogonal polynomials and spherical harmonics.

Functions§

associated_legendre
The associated Legendre function P_l^m(x) for |x| ≤ 1 and |m| ≤ l (zero otherwise), with the Condon-Shortley phase. Negative orders use P_l^{−m} = (−1)^m (l−m)!/(l+m)! P_l^m. Unnormalized values grow like (2m)! and overflow for orders beyond about 150; use normalized_associated_legendre for high degrees.
normalized_associated_legendre
The fully normalized P̄_l^m(x) = √((2l+1)/(4π) · (l−m)!/(l+m)!) P_l^m(x) for m ≥ 0, so that Y_l^m(θ, φ) = P̄_l^m(cos θ) e^{imφ}. Computed by the normalized recurrence, which is stable and free of overflow for degrees into the thousands.
real_spherical_harmonic
The real spherical harmonic: √2 (−1)^m Re Y_l^m for m > 0, Y_l^0 for m = 0 and √2 (−1)^m Im Y_l^{|m|} for m < 0, i.e. √2 P̄_l^{|m|} (−1)^m cos(mφ) or sin(|m|φ). These form a real orthonormal basis.
spherical_harmonic
The complex spherical harmonic Y_l^m(θ, φ) (θ polar from +z, φ azimuth from +x), zero for |m| > l.