scipy.special.sph_harm#
- scipy.special.sph_harm(m, n, theta, phi, out=None) = <ufunc 'sph_harm'>#
Compute spherical harmonics.
The spherical harmonics are defined as
\[Y^m_n(\theta,\phi) = \sqrt{\frac{2n+1}{4\pi} \frac{(n-m)!}{(n+m)!}} e^{i m \theta} P^m_n(\cos(\phi))\]where \(P_n^m\) are the associated Legendre functions; see
lpmv.Deprecated since version 1.15.0: This function is deprecated and will be removed in SciPy 1.17.0. Please use
scipy.special.sph_harm_yinstead.- Parameters:
- marray_like
Order of the harmonic (int); must have
|m| <= n.- narray_like
Degree of the harmonic (int); must have
n >= 0. This is often denoted byl(lower case L) in descriptions of spherical harmonics.- thetaarray_like
Azimuthal (longitudinal) coordinate; must be in
[0, 2*pi].- phiarray_like
Polar (colatitudinal) coordinate; must be in
[0, pi].- outndarray, optional
Optional output array for the function values
- Returns:
- y_mncomplex scalar or ndarray
The harmonic \(Y^m_n\) sampled at
thetaandphi.
Notes
There are different conventions for the meanings of the input arguments
thetaandphi. In SciPythetais the azimuthal angle andphiis the polar angle. It is common to see the opposite convention, that is,thetaas the polar angle andphias the azimuthal angle.Note that SciPy’s spherical harmonics include the Condon-Shortley phase [2] because it is part of
lpmv.With SciPy’s conventions, the first several spherical harmonics are
\[\begin{split}Y_0^0(\theta, \phi) &= \frac{1}{2} \sqrt{\frac{1}{\pi}} \\ Y_1^{-1}(\theta, \phi) &= \frac{1}{2} \sqrt{\frac{3}{2\pi}} e^{-i\theta} \sin(\phi) \\ Y_1^0(\theta, \phi) &= \frac{1}{2} \sqrt{\frac{3}{\pi}} \cos(\phi) \\ Y_1^1(\theta, \phi) &= -\frac{1}{2} \sqrt{\frac{3}{2\pi}} e^{i\theta} \sin(\phi).\end{split}\]References
[1]Digital Library of Mathematical Functions, 14.30. https://dlmf.nist.gov/14.30