def basis(i,L): "Gen Laguerre basis function with weight" from scipy.special.orthogonal import genlaguerre a = 2*L+2 lan = genlaguerre(i,a) def f(x): return pow(x,a)*exp(-x)*lan(x) return f
def __F_n(n): """F_n(q) = \chi_n \exp(-q^2 / 2\zeta) P_n(q) and P_n(q) = q^2 / zeta * L_n^{5/2}(q^2 / zeta)""" if n == -1: return np.poly1d([1.0]) else: a = np.poly1d([1, 0.0, 0.0]) return a * genlaguerre(n, 2.5)(a)
def coeffs_harmonicBasis(n, l, r0): """ Calculates the coefficients of the polynomial that defines the radial harmonic basis function of degree n and angular momentum order l r0 is the scale of the harmonic basis function returns \tilde{g}^{nl}_s given the following r^l L^{l+1/2}_n = \sum_{s=l}^{n+l} \tilde{g}^{nl}_s r^s, """ N = norm_harmonicBasis(n, l, r0) coeffs = np.zeros(2 * n + l + 1) coeffs[l::2] = genlaguerre(n, l + 0.5).coeffs[::-1] coeffs *= N return coeffs
def test_regression(self): assert_equal(orth.genlaguerre(1, 1, monic=False)(0), 2.) assert_equal(orth.genlaguerre(1, 1, monic=True)(0), -2.) assert_equal(orth.genlaguerre(1, 1, monic=False), np.poly1d([-1, 2])) assert_equal(orth.genlaguerre(1, 1, monic=True), np.poly1d([1, -2]))
def radial_function(r, n, zeta): "Computes the radial part of the SPF basis." return genlaguerre(n, 0.5)(r**2 / zeta) * \ np.exp(- r**2 / (2 * zeta)) * \ kappa(zeta, n)
def radial_function(r, n, zeta): "Computes the radial part of the mSPF basis." return genlaguerre(n, 2.5)(r**2 / zeta) * \ r**2 / zeta * np.exp(- r**2 / (2 * zeta)) * chi(zeta, n)