def a_function(l, r, i, l_1, l_2, pa, pb, pc, g):
    e = 1 / (4 * g)
    out1 = binomial_coefficient(l, l_1, l_2, pa, pb)
    out2 = (-1)**i * fac(l) * pc**(l - 2 * r - 2 * i) * e**(r + i)
    out3 = fac(r) * fac(i) * fac(l - 2 * r - 2 * i)
    ans = (-1)**l * out1 * (out2 / out3)
    return ans
Exemple #2
0
def s_function(l_1, l_2, a, b, g):
    s = 0
    for j in range(((l_1 + l_2) // 2) + 1):
        s += binomial_coefficient(2 * j, l_1, l_2, a,
                                  b) * (factorial2(2 * j - 1) / (2 * g)**j)
    return s
 def test_calculate_coefficient_return_the_correct_answer_1(self):
     coefficient = binomial_coefficient(2, 1, 1, 0.7313240, -0.7313240)
     self.assertEquals(coefficient, 1)
 def test_calculate_coefficient_return_the_correct_answer_3(self):
     coefficient = binomial_coefficient(0, 1, 1, 0.7313240, -0.7313240)
     testing.assert_approx_equal(coefficient, -0.534834793, 9)
 def sigma(self, l, l_1, l_2, a, b, r, g):
     return binomial_coefficient(l, l_1, l_2, a, b) * (
         (fac(l) * g**(r - l)) / (fac(r) * fac(l - 2 * r)))