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

Python hyperexpand.apply_operators函数代码示例

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

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



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

示例1: test_plan

def test_plan():
    assert devise_plan(Hyper_Function([0], ()),
            Hyper_Function([0], ()), z) == []
    with raises(ValueError):
        devise_plan(Hyper_Function([1], ()), Hyper_Function((), ()), z)
    with raises(ValueError):
        devise_plan(Hyper_Function([2], [1]), Hyper_Function([2], [2]), z)
    with raises(ValueError):
        devise_plan(Hyper_Function([2], []), Hyper_Function([S("1/2")], []), z)

    # We cannot use pi/(10000 + n) because polys is insanely slow.
    a1, a2, b1 = map(lambda n: randcplx(n), range(3))
    b1 += 2*I
    h = hyper([a1, a2], [b1], z)

    h2 = hyper((a1 + 1, a2), [b1], z)
    assert tn(apply_operators(h,
        devise_plan(Hyper_Function((a1 + 1, a2), [b1]),
            Hyper_Function((a1, a2), [b1]), z), op),
        h2, z)

    h2 = hyper((a1 + 1, a2 - 1), [b1], z)
    assert tn(apply_operators(h,
        devise_plan(Hyper_Function((a1 + 1, a2 - 1), [b1]),
            Hyper_Function((a1, a2), [b1]), z), op),
        h2, z)
开发者ID:vprusso,项目名称:sympy,代码行数:26,代码来源:test_hyperexpand.py


示例2: test_plan_derivatives

def test_plan_derivatives():
    a1, a2, a3 = 1, 2, S('1/2')
    b1, b2 = 3, S('5/2')
    h = Hyper_Function((a1, a2, a3), (b1, b2))
    h2 = Hyper_Function((a1 + 1, a2 + 1, a3 + 2), (b1 + 1, b2 + 1))
    ops = devise_plan(h2, h, z)
    f = Formula(h, z, h(z), [])
    deriv = make_derivative_operator(f.M, z)
    assert tn((apply_operators(f.C, ops, deriv)*f.B)[0], h2(z), z)

    h2 = Hyper_Function((a1, a2 - 1, a3 - 2), (b1 - 1, b2 - 1))
    ops = devise_plan(h2, h, z)
    assert tn((apply_operators(f.C, ops, deriv)*f.B)[0], h2(z), z)
开发者ID:vprusso,项目名称:sympy,代码行数:13,代码来源:test_hyperexpand.py


示例3: test_plan_derivatives

def test_plan_derivatives():
    a1, a2, a3 = 1, 2, S("1/2")
    b1, b2 = 3, S("5/2")
    h = hyper((a1, a2, a3), (b1, b2), z)
    h2 = hyper((a1 + 1, a2 + 1, a3 + 2), (b1 + 1, b2 + 1), z)
    ops = devise_plan(IndexPair((a1 + 1, a2 + 1, a3 + 2), (b1 + 1, b2 + 1)), IndexPair((a1, a2, a3), (b1, b2)), z)
    f = Formula((a1, a2, a3), (b1, b2), z, h, [])
    deriv = make_derivative_operator(f.M, z)
    assert tn((apply_operators(f.C, ops, deriv) * f.B)[0], h2, z)

    h2 = hyper((a1, a2 - 1, a3 - 2), (b1 - 1, b2 - 1), z)
    ops = devise_plan(IndexPair((a1, a2 - 1, a3 - 2), (b1 - 1, b2 - 1)), IndexPair((a1, a2, a3), (b1, b2)), z)
    assert tn((apply_operators(f.C, ops, deriv) * f.B)[0], h2, z)
开发者ID:kristenmills,项目名称:sympy,代码行数:13,代码来源:test_hyperexpand.py


示例4: test_meijerg

def test_meijerg():
    # carefully set up the parameters.
    # NOTE: this used to fail sometimes. I believe it is fixed, but if you
    #       hit an inexplicable test failure here, please let me know the seed.
    a1, a2 = map(lambda n: randcplx() - 5*I - n*I, range(2))
    b1, b2 = map(lambda n: randcplx() + 5*I + n*I, range(2))
    b3, b4, b5, a3, a4, a5 = map(lambda n: randcplx(), range(6))
    g = meijerg([a1], [a3, a4], [b1], [b3, b4], z)

    assert ReduceOrder.meijer_minus(3, 4) is None
    assert ReduceOrder.meijer_plus(4, 3) is None

    g2 = meijerg([a1, a2], [a3, a4], [b1], [b3, b4, a2], z)
    assert tn(ReduceOrder.meijer_plus(a2, a2).apply(g, op), g2, z)

    g2 = meijerg([a1, a2], [a3, a4], [b1], [b3, b4, a2 + 1], z)
    assert tn(ReduceOrder.meijer_plus(a2, a2 + 1).apply(g, op), g2, z)

    g2 = meijerg([a1, a2 - 1], [a3, a4], [b1], [b3, b4, a2 + 2], z)
    assert tn(ReduceOrder.meijer_plus(a2 - 1, a2 + 2).apply(g, op), g2, z)

    g2 = meijerg([a1], [a3, a4, b2 - 1], [b1, b2 + 2], [b3, b4], z)
    assert tn(ReduceOrder.meijer_minus(b2 + 2, b2 - 1).apply(g, op), g2, z, tol=1e-6)

    # test several-step reduction
    an = [a1, a2]
    bq = [b3, b4, a2 + 1]
    ap = [a3, a4, b2 - 1]
    bm = [b1, b2 + 1]
    niq, ops = reduce_order_meijer(IndexQuadruple(an, ap, bm, bq))
    assert niq.an == (a1,)
    assert set(niq.ap) == set([a3, a4])
    assert niq.bm == (b1,)
    assert set(niq.bq) == set([b3, b4])
    assert tn(apply_operators(g, ops, op), meijerg(an, ap, bm, bq, z), z)
开发者ID:BDGLunde,项目名称:sympy,代码行数:35,代码来源:test_hyperexpand.py


示例5: test_plan

def test_plan():
    assert devise_plan(IndexPair([0], ()), IndexPair([0], ()), z) == []
    raises(ValueError, "devise_plan(IndexPair([1], ()), IndexPair((), ()), z)")
    raises(ValueError, "devise_plan(IndexPair([2], [1]), IndexPair([2], [2]), z)")
    raises(KeyError, 'devise_plan(IndexPair([2], []), IndexPair([S("1/2")], []), z)')

    # We cannot use pi/(10000 + n) because polys is insanely slow.
    a1, a2, b1 = map(lambda n: randcplx(n), range(3))
    b1 += 2 * I
    h = hyper([a1, a2], [b1], z)

    h2 = hyper((a1 + 1, a2), [b1], z)
    assert tn(apply_operators(h, devise_plan(IndexPair((a1 + 1, a2), [b1]), IndexPair((a1, a2), [b1]), z), op), h2, z)

    h2 = hyper((a1 + 1, a2 - 1), [b1], z)
    assert tn(
        apply_operators(h, devise_plan(IndexPair((a1 + 1, a2 - 1), [b1]), IndexPair((a1, a2), [b1]), z), op), h2, z
    )
开发者ID:kristenmills,项目名称:sympy,代码行数:18,代码来源:test_hyperexpand.py


示例6: test_plan

def test_plan():
    assert devise_plan(IndexPair([0], ()), IndexPair([0], ()), z) == []
    raises(ValueError, 'devise_plan(IndexPair([1], ()), IndexPair((), ()), z)')
    raises(ValueError, 'devise_plan(IndexPair([2], [1]), IndexPair([2], [2]), z)')
    raises(KeyError,
           'devise_plan(IndexPair([2], []), IndexPair([S("1/2")], []), z)')

    a1, a2, b1 = map(lambda _: randcplx(), range(3))
    b1 += 2*I
    h = hyper([a1], [b1], z)

    h2 = hyper((a1 + 1, a2), [b1], z)
    tn(apply_operators(h, devise_plan(IndexPair((a1 + 1, a2), [b1]),
                                      IndexPair((a1, a2), [b1]), z), op),
       h2, z)

    h2 = hyper((a1 + 1, a2 - 1), [b1], z)
    tn(apply_operators(h, devise_plan(IndexPair((a1 + 1, a2 - 1), [b1]),
                                      IndexPair((a1, a2), [b1]), z), op),
       h2, z)
开发者ID:mattcurry,项目名称:sympy,代码行数:20,代码来源:test_hyperexpand.py


示例7: test_reduction_operators

def test_reduction_operators():
    a1, a2, b1 = map(lambda n: randcplx(n), range(3))
    h = hyper([a1], [b1], z)

    assert ReduceOrder(2, 0) is None
    assert ReduceOrder(2, -1) is None
    assert ReduceOrder(1, S('1/2')) is None

    h2 = hyper((a1, a2), (b1, a2), z)
    assert tn(ReduceOrder(a2, a2).apply(h, op), h2, z)

    h2 = hyper((a1, a2 + 1), (b1, a2), z)
    assert tn(ReduceOrder(a2 + 1, a2).apply(h, op), h2, z)

    h2 = hyper((a2 + 4, a1), (b1, a2), z)
    assert tn(ReduceOrder(a2 + 4, a2).apply(h, op), h2, z)

    # test several step order reduction
    ap = (a2 + 4, a1, b1 + 1)
    bq = (a2, b1, b1)
    func, ops = reduce_order(Hyper_Function(ap, bq))
    assert func.ap == (a1,)
    assert func.bq == (b1,)
    assert tn(apply_operators(h, ops, op), hyper(ap, bq, z), z)
开发者ID:vprusso,项目名称:sympy,代码行数:24,代码来源:test_hyperexpand.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python hyperexpand.hyperexpand函数代码示例发布时间:2022-05-27
下一篇:
Python simplify.trigsimp函数代码示例发布时间: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