Fourier bases (bases)

Compute quantities related to Fourier basis functions.

spherical_harmonic(ell, m, theta, phi[, conj])

Evaluate the spherical harmonic function.

spherical_besselj(ell, x[, derivative])

Evaluate the spherical Bessel function of the first kind or its derivative.

spherical_besselj_root(ell, nmax[, only, ...])

Find positive zero(s) \(u_{\ell n}\) of the spherical Bessel function \(j_{\ell}\) of the first kind of order \(\ell\), or its derivative \(j'_{\ell}\), up to a maximum number \(n_\textrm{max}\).


harmonia.algorithms.bases.spherical_harmonic(ell, m, theta, phi, conj=False)[source]

Evaluate the spherical harmonic function.

This returns \(Y_{\ell m}(\theta, \phi)\) of degree \(\ell \geqslant 0\) and order \(\vert {m} \vert \leqslant \ell\) at the polar angle \(\theta \in [0, \pi]\) and the azimuthal angle \(\phi \in [0, 2\pi]\).

Parameters:
  • ell (int, array_like) – Degree of the spherical harmonic function, ell >= 0.

  • m (int, array_like) – Order of the spherical harmonic function, |m| <= ell.

  • theta (float, array_like) – Polar angle in the interval [0, pi].

  • phi (float, array_like) – Azimuthal angle in the interval [0, 2*pi].

  • conj (bool, optional) – If True (default is False), return the complex conjugate.

Returns:

\(Y_{\ell m}\) value at theta and phi.

Return type:

complex, array_like

harmonia.algorithms.bases.spherical_besselj(ell, x, derivative=False)[source]

Evaluate the spherical Bessel function of the first kind or its derivative.

This returns \(j_{\ell}(x)\) or \(j'_{\ell}(x)\) of order \(\ell \geqslant 0\).

Parameters:
  • ell (int, array_like) – Order of the spherical harmonic function, ell >= 0.

  • x (float, array_like) – Argument of the spherical Bessel function.

  • derivative (bool, optional) – If True (default is False), evaluate the derivative instead.

Returns:

\(j_{\ell}\) or \(j'_{\ell}\) value at x.

Return type:

float, array_like

harmonia.algorithms.bases.spherical_besselj_root(ell, nmax, only=True, derivative=False)[source]

Find positive zero(s) \(u_{\ell n}\) of the spherical Bessel function \(j_{\ell}\) of the first kind of order \(\ell\), or its derivative \(j'_{\ell}\), up to a maximum number \(n_\textrm{max}\).

Solving for roots of the spherical Bessel function relies on the identity \(j_\ell(x) = \sqrt{\pi/(2x)} J_{\ell + 1/2}(x)\), where \(J_\ell(x)\) is the Bessel funcion of the first kind. Solving for roots of the derivative function employs the interval bisection method, with the interval ansatz \(\ell + 1 \leqslant x \leqslant n_\textrm{max} \operatorname{max}\{4, \ell\}\).

Parameters:
  • ell (int) – Order of the spherical Bessel function, ell >= 0.

  • nmax (int) – Maximum number of positive zeros to be found, nmax >= 1.

  • only (bool, optional) – If True (default), return the maximal root only.

  • derivative (bool, optional) – If True (default is False), compute the zero(s) of the derivative function instead.

Returns:

u_ell – Positive zero(s) for order ell (in ascending order).

Return type:

float, array_like