def test_chndtrinc(self): # Use a larger atol since mpmath is doing numerical integration _assert_inverts( sp.chndtrinc, _noncentral_chi_cdf, 2, [Arg(0, 100, inclusive_a=False), IntArg(1, 100), ProbArg()], n=1000, rtol=1e-4, atol=1e-15)
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_bdtrik(self): _assert_inverts( sp.bdtrik, _binomial_cdf, 0, [ProbArg(), IntArg(1, 1000), ProbArg()], rtol=1e-4)
def test_chndtrix(self): # Use a larger atol since mpmath is doing numerical integration _assert_inverts( sp.chndtrix, _noncentral_chi_cdf, 0, [ProbArg(), IntArg(1, 100), Arg(0, 100, inclusive_a=False)], n=1000, rtol=1e-4, atol=1e-15, endpt_atol=[1e-6, None, None])
def test_fdtridfd(self): _assert_inverts( sp.fdtridfd, _f_cdf, 1, [IntArg(1, 100), ProbArg(), Arg(0, 100, inclusive_a=False)], rtol=1e-7)
def test_bdtrin(self): _assert_inverts( sp.bdtrin, _binomial_cdf, 1, [IntArg(1, 1000), ProbArg(), ProbArg()], rtol=1e-4, endpt_atol=[None, None, 1e-6])
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_chdtriv(self): _assert_inverts( sp.chdtriv, lambda v, x: mpmath.gammainc(v/2, b=x/2, regularized=True), 0, [ProbArg(), IntArg(1, 100)], rtol=1e-4)
def test_stdtrit(self): _assert_inverts( sp.stdtrit, _student_t_cdf, 1, [IntArg(1, 100), ProbArg()], rtol=1e-7, endpt_atol=[None, 1e-10])