Skip to main content

sph_harm_normalization

Function sph_harm_normalization 

Source
pub fn sph_harm_normalization(l: usize, m: i32) -> f64
Expand description

Compute the normalization factor for spherical harmonics.

K_l^m = sqrt[(2l+1)/(4pi) * (l-|m|)!/(l+|m|)!]

This is useful for constructing custom spherical harmonic variants.

ยงExamples

use scirs2_special::sph_harm_normalization;
use std::f64::consts::PI;
// K_0^0 = 1/(2*sqrt(pi))
let k = sph_harm_normalization(0, 0);
assert!((k - 0.5 / PI.sqrt()).abs() < 1e-14);