def test_zipfian_continuity(self): # test that zipfian(0.999999, n) ~ zipfian(1.000001, n) # (a = 1 switches between methods of calculating harmonic sum) alt1, agt1 = 0.99999999, 1.00000001 N = 30 k = np.arange(1, N + 1) assert_allclose(zipfian.pmf(k, alt1, N), zipfian.pmf(k, agt1, N)) assert_allclose(zipfian.cdf(k, alt1, N), zipfian.cdf(k, agt1, N)) assert_allclose(zipfian.sf(k, alt1, N), zipfian.sf(k, agt1, N)) assert_allclose(zipfian.stats(alt1, N, moments='msvk'), zipfian.stats(agt1, N, moments='msvk'), rtol=2e-7)
def test_zipfian_asymptotic(self): # test limiting case that zipfian(a, n) -> zipf(a) as n-> oo a = 6.5 N = 10000000 k = np.arange(1, 21) assert_allclose(zipfian.pmf(k, a, N), zipf.pmf(k, a)) assert_allclose(zipfian.cdf(k, a, N), zipf.cdf(k, a)) assert_allclose(zipfian.sf(k, a, N), zipf.sf(k, a)) assert_allclose(zipfian.stats(a, N, moments='msvk'), zipf.stats(a, moments='msvk'))