Verified Commit 64b04d59 authored by Chris Kerr's avatar Chris Kerr

Return a Fraction from _modified_gaunt_squared

parent 22bf4a51
......@@ -130,11 +130,11 @@ def _modified_gaunt_squared(l_1, l_2, l_3, m, *, factorials=None):
_gaunt_ksum(l_1, l_2, l_3, m, factorials=factorials),
_gaunt_big_L_part(l_1, l_2, l_3, factorials=factorials),
))
return float(prod((
return prod((
_gaunt_sqrt_arg(l_1, l_2, l_3, m, factorials=factorials),
non_sqrt_part * non_sqrt_part,
(2 * l_3 + 1), # For standard Gaunt, omit this
))) # For standard Gaunt, divide by (4 * math.pi)
)) # For standard Gaunt, divide by (4 * math.pi)
def modified_gaunt(l_1, l_2, l_3, m, *, factorials=None):
......
......@@ -56,9 +56,11 @@ def test_sympy_gaunt_vs_wigner(lmkp):
def test_python_vs_sympy_gaunt2(lmkp):
L, M, K, P = lmkp
sympy_result = sympy_matrix_element_G(L, M, K, P) ** 2
sympy_float = float(sympy_result.n(10))
python_result = gaunt._modified_gaunt_squared(L, K, P, M)
assert python_result == pytest.approx(sympy_float)
assert_sympy_equal(
python_result,
sympy_result,
)
@given(lmkp=LMKP())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment