Beispiel #1
0
 def test_tklmbda_zero_shape(self):
     # When lmbda = 0 the CDF has a simple closed form
     one = mpmath.mpf(1)
     assert_mpmath_equal(
         lambda x: sp.tklmbda(x, 0),
         lambda x: one/(mpmath.exp(-x) + one),
         [Arg()], rtol=1e-7)
Beispiel #2
0
 def test_tklmbda_zero_shape(self):
     # When lmbda = 0 the CDF has a simple closed form
     one = mpmath.mpf(1)
     assert_mpmath_equal(
         lambda x: sp.tklmbda(x, 0),
         lambda x: one/(mpmath.exp(-x) + one),
         [Arg()], rtol=1e-7)
Beispiel #3
0
 def test_stdtr(self):
     # Ideally the left endpoint for Arg() should be 0.
     assert_mpmath_equal(
         sp.stdtr,
         _student_t_cdf,
         [IntArg(1, 100), Arg(1e-10, np.inf)],
         rtol=1e-7)
def test_gammainc():
    # Quick check that the gammainc in
    # special._precompute.gammainc_data agrees with mpmath's
    # gammainc.
    assert_mpmath_equal(gammainc,
                        lambda a, x: mp.gammainc(a, b=x, regularized=True),
                        [Arg(0, 100, inclusive_a=False), Arg(0, 100)],
                        nan_ok=False, rtol=1e-17, n=50, dps=50)
def test_gammainc():
    # Quick check that the gammainc in
    # special._precompute.gammainc_data agrees with mpmath's
    # gammainc.
    assert_mpmath_equal(gammainc,
                        lambda a, x: mp.gammainc(a, b=x, regularized=True),
                        [Arg(0, 100, inclusive_a=False), Arg(0, 100)],
                        nan_ok=False, rtol=1e-17, n=50, dps=50)
def test_gammaincc():
    # Check that the gammaincc in special._precompute.gammainc_data
    # agrees with mpmath's gammainc.
    assert_mpmath_equal(lambda a, x: gammaincc(a, x, dps=1000),
                        lambda a, x: mp.gammainc(a, a=x, regularized=True),
                        [Arg(20, 100), Arg(20, 100)],
                        nan_ok=False, rtol=1e-17, n=50, dps=1000)

    # Test the fast integer path
    assert_mpmath_equal(gammaincc,
                        lambda a, x: mp.gammainc(a, a=x, regularized=True),
                        [IntArg(1, 100), Arg(0, 100)],
                        nan_ok=False, rtol=1e-17, n=50, dps=50)
def test_gammaincc():
    # Check that the gammaincc in special._precompute.gammainc_data
    # agrees with mpmath's gammainc.
    assert_mpmath_equal(lambda a, x: gammaincc(a, x, dps=1000),
                        lambda a, x: mp.gammainc(a, a=x, regularized=True),
                        [Arg(20, 100), Arg(20, 100)],
                        nan_ok=False, rtol=1e-17, n=50, dps=1000)

    # Test the fast integer path
    assert_mpmath_equal(gammaincc,
                        lambda a, x: mp.gammainc(a, a=x, regularized=True),
                        [IntArg(1, 100), Arg(0, 100)],
                        nan_ok=False, rtol=1e-17, n=50, dps=50)
Beispiel #8
0
 def test_stdtr(self):
     # Ideally the left endpoint for Arg() should be 0.
     assert_mpmath_equal(
         sp.stdtr,
         _student_t_cdf,
         [IntArg(1, 100), Arg(1e-10, np.inf)], rtol=1e-7)