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


Python hyperexpand.apply_operators函数代码示例

本文整理汇总了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;未经允许,请勿转载。