def test_simpson(self): """ Test simpson function. """ def fn1(x): return 3 * x ** 2 + 2 largenum = 1000 res = cl.simpson(fn1, 1, 0, largenum) self.assertEqual(round(res), 3)
def probability(probfn, upper, lower): ''' Calculate probability by probability density function. ''' return cl.simpson(probfn, upper, lower)