import numpy as np import scipy.special as sps Array = np.ndarray def sph_bessel_i(n, x, **kwargs): return sps.spherical_in(n, x, **kwargs) def sph_bessel_k(n, x, **kwargs): return 2 / np.pi * sps.spherical_kn(n, x, **kwargs) def sph_harm(l, m, theta, phi, **kwargs): return sps.sph_harm(m, l, phi, theta, **kwargs) def interaction_coeff_C(l, p, x): return x * sps.iv(l + 1 / 2, x) * sps.iv(p + 1 / 2, x) def coefficient_Cpm(l, x) -> Array: return x * sps.kv(l + 1 / 2, x) * sps.iv(l + 1 / 2, x) def coeff_C_diff(l, x): return 1 / (x * sps.iv(l + 1 / 2, x) * sps.kv(l + 3 / 2, x)) if __name__ == '__main__': print(sph_bessel_k(np.array([1, 2, 3])[:, None], np.array([0.1, 0.2, 0.5, 0.6])[None, :]))