Пример #1
0
 def test_infinite_limits(self):
     # Test that large arguments converge to the hard-coded limits
     # at infinity.
     assert_allclose(
         sc.gammainc(1000, 100),
         sc.gammainc(cp.inf, 100),
         atol=1e-200,  # Use `atol` since the function converges to 0.
         rtol=0,
     )
     assert sc.gammainc(100, 1000) == sc.gammainc(100, cp.inf)
Пример #2
0
    def test_roundtrip(self):
        a = cp.logspace(-5, 10, 100)
        x = cp.logspace(-5, 10, 100)

        y = sc.gammaincinv(a, sc.gammainc(a, x))
        assert_allclose(x, y, rtol=1e-10)
Пример #3
0
 def test_limit_check(self):
     result = sc.gammainc(1e-10, 1)
     limit = sc.gammainc(0, 1)
     assert cp.isclose(result, limit)
Пример #4
0
 def test_x_zero(self):
     a = cp.arange(1, 10)
     assert_array_equal(sc.gammainc(a, 0), 0)
Пример #5
0
 def test_infinite_arguments(self, a, x, desired):
     result = sc.gammainc(a, x)
     if cp.isnan(desired):
         assert cp.isnan(result)
     else:
         assert result == desired
Пример #6
0
 def test_a_eq_0_x_gt_0(self):
     assert sc.gammainc(0, 1) == 1
Пример #7
0
 def test_domain(self, a, x):
     assert cp.isnan(sc.gammainc(a, x))