当前位置: 首页>>代码示例>>Python>>正文


Python special.gammainc方法代码示例

本文整理汇总了Python中scipy.special.gammainc方法的典型用法代码示例。如果您正苦于以下问题:Python special.gammainc方法的具体用法?Python special.gammainc怎么用?Python special.gammainc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scipy.special的用法示例。


在下文中一共展示了special.gammainc方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_digamma_boundary

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def test_digamma_boundary():
    # Check that there isn't a jump in accuracy when we switch from
    # using the asymptotic series to the reflection formula.

    x = -np.logspace(300, -30, 100)
    y = np.array([-6.1, -5.9, 5.9, 6.1])
    x, y = np.meshgrid(x, y)
    z = (x + 1j*y).flatten()

    dataset = []
    with mpmath.workdps(30):
        for z0 in z:
            res = mpmath.digamma(z0)
            dataset.append((z0, complex(res)))
    dataset = np.asarray(dataset)

    FuncData(sc.digamma, dataset, 0, 1, rtol=1e-13).check()


# ------------------------------------------------------------------------------
# gammainc
# ------------------------------------------------------------------------------ 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:24,代码来源:test_mpmath.py

示例2: _upper_incomplete_gamma

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def _upper_incomplete_gamma(z, a):
    """
    An implementation of the non-regularised upper incomplete gamma
    function. Computed using the relationship with the regularised 
    lower incomplete gamma function (scipy.special.gammainc). 
    Uses the recurrence relation wherever z<0.
    """
    n = int(-np.floor(z))
    if n > 0:
        z = z + n
        u_gamma = (1. - gammainc(z, a))*gamma(z)
        
        for i in range(n):
            z = z - 1.
            u_gamma = (u_gamma - np.power(a, z)*np.exp(-a))/z
        return u_gamma
    else:
        return (1. - gammainc(z, a))*gamma(z) 
开发者ID:geodynamics,项目名称:burnman,代码行数:20,代码来源:reciprocal_kprime.py

示例3: mean

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def mean(t, a, b):
        # TODO this is not tested yet.
        # tests:
        #    cemean(0., a, b)==mean(a, b, p)
        #    mean(t, a, 1., p)==mean(0., a, 1., p) == a
        # conditional excess mean
        # E[Y|y>t]
        # (conditional mean age at failure)
        # http://reliabilityanalyticstoolkit.appspot.com/conditional_distribution
        from scipy.special import gamma
        from scipy.special import gammainc
        # Regularized lower gamma
        print('not tested')

        v = 1. + 1. / b
        gv = gamma(v)
        L = np.power((t + .0) / a, b)
        cemean = a * gv * np.exp(L) * (1 - gammainc(v, t / a) / gv)

        return cemean 
开发者ID:ragulpr,项目名称:wtte-rnn,代码行数:22,代码来源:weibull.py

示例4: test_line

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def test_line():
    # Test on the line a = x where a simpler asymptotic expansion
    # (analog of DLMF 8.12.15) is available.

    def gammainc_line(x):
        c = np.array([-1/3, -1/540, 25/6048, 101/155520,
                      -3184811/3695155200, -2745493/8151736420])
        res = 0
        xfac = 1
        for ck in c:
            res -= ck*xfac
            xfac /= x
        res /= np.sqrt(2*np.pi*x)
        res += 0.5
        return res

    x = np.logspace(np.log10(25), 300, 500)
    a = x.copy()
    dataset = np.vstack((a, x, gammainc_line(x))).T

    FuncData(sc.gammainc, dataset, (0, 1), 2, rtol=1e-11).check() 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:23,代码来源:test_gammainc.py

示例5: alpha_abs

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def alpha_abs(self, x, y, n_sersic, r_eff, k_eff, center_x=0, center_y=0):
        """

        :param x:
        :param y:
        :param n_sersic:
        :param r_eff:
        :param k_eff:
        :param center_x:
        :param center_y:
        :return:
        """
        n = n_sersic
        x_red = self._x_reduced(x, y, n_sersic, r_eff, center_x, center_y)
        b = self.b_n(n_sersic)
        a_eff = self._alpha_eff(r_eff, n_sersic, k_eff)
        alpha = 2. * a_eff * x_red ** (-n) * (special.gammainc(2 * n, b * x_red))
        return alpha 
开发者ID:sibirrer,项目名称:lenstronomy,代码行数:20,代码来源:sersic_utils.py

示例6: _cdf

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def _cdf(self, x, df):
        return sc.gammainc(.5*df, .5*x**2) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:4,代码来源:_continuous_distns.py

示例7: _sf

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def _sf(self, x, a):
        fac = 0.5*sc.gammainc(a, abs(x))
        return np.where(x > 0, 0.5-fac, 0.5+fac) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:5,代码来源:_continuous_distns.py

示例8: test_gammainc

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def test_gammainc(self):
        assert_equal(cephes.gammainc(5,0),0.0) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:4,代码来源:test_basic.py

示例9: test_gammaincnan

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def test_gammaincnan(self):
        gama = special.gammainc(-1,1)
        assert_(isnan(gama)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:test_basic.py

示例10: test_gammainczero

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def test_gammainczero(self):
        # bad arg but zero integration limit
        gama = special.gammainc(-1,0)
        assert_equal(gama,0.0) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:6,代码来源:test_basic.py

示例11: test_gammaincc

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def test_gammaincc(self):
        gicc = special.gammaincc(.5,.5)
        greal = 1 - special.gammainc(.5,.5)
        assert_almost_equal(gicc,greal,8) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:6,代码来源:test_basic.py

示例12: test_975

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def test_975(self):
        # Regression test for ticket #975 -- switch point in algorithm
        # check that things work OK at the point, immediately next floats
        # around it, and a bit further away
        pts = [0.25,
               np.nextafter(0.25, 0), 0.25 - 1e-12,
               np.nextafter(0.25, 1), 0.25 + 1e-12]
        for xp in pts:
            y = special.gammaincinv(.4, xp)
            x = special.gammainc(0.4, y)
            assert_tol_equal(x, xp, rtol=1e-12) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:13,代码来源:test_basic.py

示例13: test_gammainc

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def test_gammainc(self):
        assert_mpmath_equal(sc.gammainc,
                            _exception_to_nan(
                                lambda z, b: mpmath.gammainc(z, b=b)/mpmath.gamma(z)),
                            [Arg(a=0), Arg(a=0)]) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:7,代码来源:test_mpmath.py

示例14: kappa_func

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import gammainc [as 别名]
def kappa_func(kappa, n):
    """
    Function for getting Sersic kappa
    """
    from scipy.special import gamma, gammainc
    f = gamma(2*n)-2*gammainc(2*n, kappa)*gamma(2*n)
    return f 
开发者ID:gbrammer,项目名称:grizli,代码行数:9,代码来源:deconvolve.py


注:本文中的scipy.special.gammainc方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。