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


Python C.ceiling方法代码示例

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


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

示例1: _eval_aseries

# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import ceiling [as 别名]
    def _eval_aseries(self, n, args0, x, logx):
        if args0[1] != oo or not \
           (self.args[0].is_Integer and self.args[0].is_nonnegative):
            return super(polygamma, self)._eval_aseries(n, args0, x, logx)
        z = self.args[1]
        N = self.args[0]

        if N == 0:
            # digamma function series
            # Abramowitz & Stegun, p. 259, 6.3.18
            r = log(z) - 1/(2*z)
            o = None
            if n < 2:
                o = C.Order(1/z, x)
            else:
                m = C.ceiling((n+1)//2)
                l = [bernoulli(2*k) / (2*k*z**(2*k)) for k in range(1, m)]
                r -= Add(*l)
                o = C.Order(1/z**(2*m), x)
            return r._eval_nseries(x, n, logx) + o
        else:
            # proper polygamma function
            # Abramowitz & Stegun, p. 260, 6.4.10
            # We return terms to order higher than O(x**n) on purpose
            # -- otherwise we would not be able to return any terms for
            #    quite a long time!
            fac = gamma(N)
            e0 = fac + N*fac/(2*z)
            m = C.ceiling((n+1)//2)
            for k in range(1, m):
                fac = fac*(2*k+N-1)*(2*k+N-2) / ((2*k)*(2*k-1))
                e0 += bernoulli(2*k)*fac/z**(2*k)
            o = C.Order(1/z**(2*m), x)
            if n == 0:
                o = C.Order(1/z, x)
            elif n == 1:
                o = C.Order(1/z**2, x)
            r = e0._eval_nseries(z, n, logx) + o
            return -1 * (-1/z)**N * r
开发者ID:Kimay,项目名称:sympy,代码行数:41,代码来源:gamma_functions.py

示例2: _eval_aseries

# 需要导入模块: from sympy.core import C [as 别名]
# 或者: from sympy.core.C import ceiling [as 别名]
 def _eval_aseries(self, n, args0, x, logx):
     if args0[0] != oo:
         return super(loggamma, self)._eval_aseries(n, args0, x, logx)
     z = self.args[0]
     m = min(n, C.ceiling((n + S(1)) / 2))
     r = log(z) * (z - S(1) / 2) - z + log(2 * pi) / 2
     l = [bernoulli(2 * k) / (2 * k * (2 * k - 1) * z ** (2 * k - 1)) for k in range(1, m)]
     o = None
     if m == 0:
         o = C.Order(1, x)
     else:
         o = C.Order(1 / z ** (2 * m - 1), x)
     # It is very inefficient to first add the order and then do the nseries
     return (r + Add(*l))._eval_nseries(x, n, logx) + o
开发者ID:Krastanov,项目名称:sympy,代码行数:16,代码来源:gamma_functions.py


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