• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python sympy.binomial_coefficients_list函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sympy.binomial_coefficients_list函数的典型用法代码示例。如果您正苦于以下问题:Python binomial_coefficients_list函数的具体用法?Python binomial_coefficients_list怎么用?Python binomial_coefficients_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_binomial_coefficients_list

def test_binomial_coefficients_list():
    assert binomial_coefficients_list(0) == [1]
    assert binomial_coefficients_list(1) == [1, 1]
    assert binomial_coefficients_list(2) == [1, 2, 1]
    assert binomial_coefficients_list(3) == [1, 3, 3, 1]
    assert binomial_coefficients_list(4) == [1, 4, 6, 4, 1]
    assert binomial_coefficients_list(5) == [1, 5, 10, 10, 5, 1]
    assert binomial_coefficients_list(6) == [1, 6, 15, 20, 15, 6, 1]
开发者ID:LuckyStrikes1090,项目名称:sympy,代码行数:8,代码来源:test_ntheory.py


示例2: _compute_num_chambers

 def _compute_num_chambers(self):
     """Computes the number of chambers defined by the hyperplanes
     corresponding to the normal vectors."""
     d = self.rank
     n = self.num_normal_vectors
     raw_cfs = sp.binomial_coefficients_list(n)
     cfs = np.array([(-1)**i * raw_cfs[i] for i in range(n + 1)])
     powers = np.array([max(entry, 0)
                        for entry in [d - k for k in range(n + 1)]])
     ys = np.array([-1] * len(powers))
     return (-1)**d * sum(cfs * (ys**powers))
开发者ID:codeaudit,项目名称:hyperplane-hasher,代码行数:11,代码来源:hyperplane_hasher.py


示例3: mu

def mu(f,a,n,x,y):
    binom = sympy.binomial_coefficients_list(n)
    binom = map(numpy.double, binom)
    normf = numpy.sqrt(sum(numpy.abs(a[k](x))**2 * 1/binom[k] 
                           for k in xrange(n+1)
                           )
                       )
    Delta = numpy.sqrt(numpy.double(n)) * (1 + numpy.abs(y))
    normy = 1 + numpy.abs(y)

    return normf * Delta / (2 * normy)
开发者ID:abelfunctions,项目名称:abelfunctions,代码行数:11,代码来源:test_alpha.py


示例4: _new_polynomial

def _new_polynomial(F,X,Y,tau,l):
    """
    Computes the next iterate of the newton-puiseux algorithms. Given
    the Puiseux data `\tau = (q,\mu,m,\beta)` ``_new_polynomial``
    returns .. math:
    
        \tilde{F} = F(\mu X^q,X^m(\beta+Y))/X \in \mathbb{L}(\mu,\beta)(X)[Y]

    In this algorithm, the choice of parameters will always result in
    .. math:

        \tilde{F} \in \mathbb{L}(\mu,\beta)[X,Y]

    Algorithm:

    Calling sympy.Poly() with new generators (i.e. [x,y]) takes a long
    time.  Hence, the technique below.
    """
    q,mu,m,beta,eta = tau
    d = {}
    
    # for each monomial of the form
    #
    #     c * x**a * y**b
    #
    # compute the appropriate new terms after applying the
    # transformation
    #
    #     x |--> mu * x**q
    #     y |--> eta * x**m * (beta+y)
    #
    for (a,b),c in F.as_dict().iteritems():
        binom = sympy.binomial_coefficients_list(b)
        new_a = int(q*a + m*b)
        for i in xrange(b+1):
            # the coefficient of the x***(qa+mb) * y**i term
            new_c = c * (mu**a) * (eta**b) * (binom[i]) * (beta**(b-i))
            try:
                d[(new_a,i)] += new_c
            except KeyError:
                d[(new_a,i)] = new_c

    # now perform the polynomial division by x**l. In the case when
    # the curve is singular there will be a cancellation resulting in
    # a term of the form (0,0):0 . Creating a new polynomial
    # containing such a term will result in the zero polynomial.
    new_d = dict([((a-l,b),c) for (a,b),c in d.iteritems()])
    Fnew = sympy.Poly.from_dict(new_d, gens=[X,Y], domain=sympy.EX)
    return Fnew
开发者ID:gradyrw,项目名称:abelfunctions,代码行数:49,代码来源:puiseux.py


示例5: test_binomial_coefficients

def test_binomial_coefficients():
    for n in range(15):
        c = binomial_coefficients(n)
        l = [c[k] for k in sorted(c)]
        assert l == binomial_coefficients_list(n)
开发者ID:LuckyStrikes1090,项目名称:sympy,代码行数:5,代码来源:test_ntheory.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python sympy.cancel函数代码示例发布时间:2022-05-27
下一篇:
Python sympy.binomial函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap