Esempio n. 1
0
def test_reverse_order():
    assert reverse_order(Sum(x, (x, 0, 3)), 0) == Sum(-x, (x, 4, -1))
    assert reverse_order(Sum(x*y, (x, 1, 5), (y, 0, 6)), 0, 1) == \
           Sum(x*y, (x, 6, 0), (y, 7, -1))
    assert reverse_order(Sum(x, (x, 1, 2)), 0) == Sum(-x, (x, 3, 0))
    assert reverse_order(Sum(x, (x, 1, 3)), 0) == Sum(-x, (x, 4, 0))
    assert reverse_order(Sum(x, (x, 1, a)), 0) == Sum(-x, (x, a + 1, 0))
    assert reverse_order(Sum(x, (x, a, 5)), 0) == Sum(-x, (x, 6, a - 1))
    assert reverse_order(Sum(x, (x, a + 1, a + 5)), 0) == \
                         Sum(-x, (x, a + 6, a))
    assert reverse_order(Sum(x, (x, a + 1, a + 2)), 0) == \
           Sum(-x, (x, a + 3, a))
    assert reverse_order(Sum(x, (x, a + 1, a + 1)), 0) == \
           Sum(-x, (x, a + 2, a))
    assert reverse_order(Sum(x, (x, a, b)), 0) == Sum(-x, (x, b + 1, a - 1))
    assert reverse_order(Sum(x, (x, a, b)), x) == Sum(-x, (x, b + 1, a - 1))
    assert reverse_order(Sum(x*y, (x, a, b), (y, 2, 5)), x, 1) == \
        Sum(x*y, (x, b + 1, a - 1), (y, 6, 1))
    assert reverse_order(Sum(x*y, (x, a, b), (y, 2, 5)), y, x) == \
        Sum(x*y, (x, b + 1, a - 1), (y, 6, 1))
Esempio n. 2
0
def test_reverse_order():
    x, y, a, b, c, d = symbols('x, y, a, b, c, d', integer=True)

    assert reverse_order(Product(x, (x, 0, 3)),
                         0) == Product(1 / x, (x, 4, -1))
    assert reverse_order(Product(x*y, (x, 1, 5), (y, 0, 6)), 0, 1) == \
           Product(x*y, (x, 6, 0), (y, 7, -1))
    assert reverse_order(Product(x, (x, 1, 2)), 0) == Product(1 / x, (x, 3, 0))
    assert reverse_order(Product(x, (x, 1, 3)), 0) == Product(1 / x, (x, 4, 0))
    assert reverse_order(Product(x, (x, 1, a)),
                         0) == Product(1 / x, (x, a + 1, 0))
    assert reverse_order(Product(x, (x, a, 5)),
                         0) == Product(1 / x, (x, 6, a - 1))
    assert reverse_order(Product(x, (x, a + 1, a + 5)), 0) == \
           Product(1/x, (x, a + 6, a))
    assert reverse_order(Product(x, (x, a + 1, a + 2)), 0) == \
           Product(1/x, (x, a + 3, a))
    assert reverse_order(Product(x, (x, a + 1, a + 1)), 0) == \
           Product(1/x, (x, a + 2, a))
    assert reverse_order(Product(x, (x, a, b)),
                         0) == Product(1 / x, (x, b + 1, a - 1))
    assert reverse_order(Product(x, (x, a, b)),
                         x) == Product(1 / x, (x, b + 1, a - 1))
    assert reverse_order(Product(x*y, (x, a, b), (y, 2, 5)), x, 1) == \
           Product(x*y, (x, b + 1, a - 1), (y, 6, 1))
    assert reverse_order(Product(x*y, (x, a, b), (y, 2, 5)), y, x) == \
           Product(x*y, (x, b + 1, a - 1), (y, 6, 1))
def test_reverse_order():
    assert reverse_order(Sum(x, (x, 0, 3)), 0) == Sum(-x, (x, 4, -1))
    assert reverse_order(Sum(x*y, (x, 1, 5), (y, 0, 6)), 0, 1) == \
           Sum(x*y, (x, 6, 0), (y, 7, -1))
    assert reverse_order(Sum(x, (x, 1, 2)), 0) == Sum(-x, (x, 3, 0))
    assert reverse_order(Sum(x, (x, 1, 3)), 0) == Sum(-x, (x, 4, 0))
    assert reverse_order(Sum(x, (x, 1, a)), 0) == Sum(-x, (x, a + 1, 0))
    assert reverse_order(Sum(x, (x, a, 5)), 0) == Sum(-x, (x, 6, a - 1))
    assert reverse_order(Sum(x, (x, a + 1, a + 5)), 0) == \
                         Sum(-x, (x, a + 6, a))
    assert reverse_order(Sum(x, (x, a + 1, a + 2)), 0) == \
           Sum(-x, (x, a + 3, a))
    assert reverse_order(Sum(x, (x, a + 1, a + 1)), 0) == \
           Sum(-x, (x, a + 2, a))
    assert reverse_order(Sum(x, (x, a, b)), 0) == Sum(-x, (x, b + 1, a - 1))
    assert reverse_order(Sum(x, (x, a, b)), x) == Sum(-x, (x, b + 1, a - 1))
    assert reverse_order(Sum(x*y, (x, a, b), (y, 2, 5)), x, 1) == \
        Sum(x*y, (x, b + 1, a - 1), (y, 6, 1))
    assert reverse_order(Sum(x*y, (x, a, b), (y, 2, 5)), y, x) == \
        Sum(x*y, (x, b + 1, a - 1), (y, 6, 1))
Esempio n. 4
0
def test_reverse_order():
    x, y, a, b, c, d= symbols('x, y, a, b, c, d', integer = True)

    assert reverse_order(Product(x, (x, 0, 3)), 0) == Product(1/x, (x, 4, -1))
    assert reverse_order(Product(x*y, (x, 1, 5), (y, 0, 6)), 0, 1) == \
           Product(x*y, (x, 6, 0), (y, 7, -1))
    assert reverse_order(Product(x, (x, 1, 2)), 0) == Product(1/x, (x, 3, 0))
    assert reverse_order(Product(x, (x, 1, 3)), 0) == Product(1/x, (x, 4, 0))
    assert reverse_order(Product(x, (x, 1, a)), 0) == Product(1/x, (x, a + 1, 0))
    assert reverse_order(Product(x, (x, a, 5)), 0) == Product(1/x, (x, 6, a - 1))
    assert reverse_order(Product(x, (x, a + 1, a + 5)), 0) == \
           Product(1/x, (x, a + 6, a))
    assert reverse_order(Product(x, (x, a + 1, a + 2)), 0) == \
           Product(1/x, (x, a + 3, a))
    assert reverse_order(Product(x, (x, a + 1, a + 1)), 0) == \
           Product(1/x, (x, a + 2, a))
    assert reverse_order(Product(x, (x, a, b)), 0) == Product(1/x, (x, b + 1, a - 1))
    assert reverse_order(Product(x, (x, a, b)), x) == Product(1/x, (x, b + 1, a - 1))
    assert reverse_order(Product(x*y, (x, a, b), (y, 2, 5)), x, 1) == \
           Product(x*y, (x, b + 1, a - 1), (y, 6, 1))
    assert reverse_order(Product(x*y, (x, a, b), (y, 2, 5)), y, x) == \
           Product(x*y, (x, b + 1, a - 1), (y, 6, 1))