def p_z(ell_min, ell_max, s=-2): """Generator for p^z matrix elements (for use with matrix_expectation_value) This function is specific to the case where waveforms have s=-2. p^z = \\cos\theta = 2 \\sqrt{\\pi/3} Y_{1,0} This is what Ruiz+ (2008) [0707.4654] calls "l^z", which is a bad name. The matrix elements yielded are < s, ellp, mp | \\cos\theta | s, ell, m > = \\sqrt{ \frac{2*ell+1}{2*ellp+1} } * < ell, m, 1, 0 | ellp, m > < ell, -s, 1, 0 | ellp, -s > where the terms on the last line are the ordinary Clebsch-Gordan coefficients. Because of the magnetic selection rules, we only have mp == m We could have used `_swsh_Y_mat_el` but I am just preemptively combining the prefactors. """ import numpy as np from spherical_functions import clebsch_gordan as CG for ell in range(ell_min, ell_max + 1): ellp_min = max(ell_min, ell - 1) ellp_max = min(ell_max, ell + 1) for ellp in range(ellp_min, ellp_max + 1): for m in range(-ell, ell + 1): if (m < -ellp) or (m > ellp): continue cg1 = CG(ell, m, 1, 0, ellp, m) cg2 = CG(ell, -s, 1, 0, ellp, -s) prefac = np.sqrt((2.0 * ell + 1.0) / (2.0 * ellp + 1.0)) yield ellp, m, ell, m, (prefac * cg1 * cg2)
def p_z(ell_min, ell_max, s=-2): """Generator for pᶻ matrix elements (for use with `matrix_expectation_value`) This function is specific to the case where waveforms have s=-2. pᶻ = cosθ = 2 √(π/3) Y₁₀ This is what Ruiz et al. (2008) [0707.4654] call "lᶻ". The matrix elements yielded are ⟨s,j,n|cosθ|s,l,m⟩ = √[(2l+1)/(2j+1)] ⟨l,m,1,0|j,m⟩ ⟨l,-s,1,0|j,-s⟩ where the terms on the last line are the ordinary Clebsch-Gordan coefficients. Because of the magnetic selection rules, we only have nonzero elements for n==m. We could have used `_swsh_Y_mat_el` but I am just preemptively combining the prefactors. """ for ell in range(ell_min, ell_max + 1): ellp_min = max(ell_min, ell - 1) ellp_max = min(ell_max, ell + 1) for ellp in range(ellp_min, ellp_max + 1): for m in range(-ell, ell + 1): if (m < -ellp) or (m > ellp): continue cg1 = CG(ell, m, 1, 0, ellp, m) cg2 = CG(ell, -s, 1, 0, ellp, -s) prefac = np.sqrt((2.0 * ell + 1.0) / (2.0 * ellp + 1.0)) yield ellp, m, ell, m, (prefac * cg1 * cg2)
def swsh_Y_mat_el(s, l3, m3, l1, m1, l2, m2): """Compute a matrix element treating Y_{\ell, m} as a linear operator From the rules for the Wigner D matrices, we get the result that <s, l3, m3 | Y_{l1, m1} | s, l2, m2 > = \sqrt{ \frac{(2*l1+1)(2*l2+1)}{4*\pi*(2*l3+1)} } * < l1, m1, l2, m2 | l3, m3 > < l1, 0, l2, −s | l3, −s > where the terms on the last line are the ordinary Clebsch-Gordan coefficients. See e.g. Campbell and Morgan (1971). """ from spherical_functions import clebsch_gordan as CG cg1 = CG(l1, m1, l2, m2, l3, m3) cg2 = CG(l1, 0., l2, -s, l3, -s) return np.sqrt( (2.*l1 + 1.) * (2.*l2 + 1.) / (4. * np.pi * (2.*l3 + 1)) ) * cg1 * cg2
def swsh_Y_mat_el(s, l3, m3, l1, m1, l2, m2): """Compute a matrix element treating Yₗₘ as a linear operator From the rules for the Wigner D matrices, we get the result that ⟨s,l₃,m₃|Yₗ₁ₘ₁|s,l₂,m₂⟩ = √[(2l₁+1)(2l₂+1)/(4π(2l₃+1))] ⟨l₁,m₁,l₂,m₂|l₃,m₃⟩ ⟨l₁,0,l₂,−s|l₃,−s⟩ where the terms on the last line are the ordinary Clebsch-Gordan coefficients. See, e.g., Campbell and Morgan (1971). """ cg1 = CG(l1, m1, l2, m2, l3, m3) cg2 = CG(l1, 0.0, l2, -s, l3, -s) return np.sqrt((2.0 * l1 + 1.0) * (2.0 * l2 + 1.0) / (4.0 * np.pi * (2.0 * l3 + 1))) * cg1 * cg2
def ethbar_chi_z(ell_min, ell_max, s=-2): """Generator for the matrix element ⟨h|ð̄χ|ðN⟩ in the z direction For the z direction χ is an m = 0 function. The matrix element is √[(6/4π) ((2l+1)/(2j+1))] ⟨l,-s-1,1,1|j,-s⟩ ⟨l,m,1,0|j,m⟩ """ for ell in range(ell_min, ell_max + 1): ellp_min = max(ell_min, ell - 1) ellp_max = min(ell_max, ell + 1) for ellp in range(ellp_min, ellp_max + 1): cg2 = CG(ell, -s - 1, 1, 1, ellp, -s) prefac = np.sqrt((2.0 * ell + 1.0) / (2.0 * ellp + 1.0)) for m in range(-ell, ell + 1): if (m < -ellp) or (m > ellp): continue cg1 = np.sqrt(2) * CG(ell, m, 1, 0, ellp, m) yield ellp, m, ell, m, (prefac * cg1 * cg2)
def mat_el_ethbar_chi(s, l3, m3, l1, m1, l2, m2): cg1 = np.sqrt(2) * CG(l1, m1, l2, m2, l3, m3) cg2 = CG(l1, 1.0, l2, -1 - s, l3, -s) return np.sqrt((2.0 * l1 + 1.0) * (2.0 * l2 + 1.0) / (4.0 * np.pi * (2.0 * l3 + 1))) * cg1 * cg2