Ejemplo n.º 1
0
def test_issue_8496():
    n = Symbol("n")
    k = Symbol("k")

    pytest.raises(TypeError, lambda: catalan(n, k))
    pytest.raises(TypeError, lambda: euler(n, k))
Ejemplo n.º 2
0
def test_euler_failing():
    # depends on dummy variables being implemented https://github.com/sympy/sympy/issues/5665
    assert euler(2 * n).rewrite(Sum) == I * Sum(
        Sum((-1)**_j * 2**(-_k) * I**(-_k) *
            (-2 * _j + _k)**(2 * n + 1) * binomial(_k, _j) / _k, (_j, 0, _k)),
        (_k, 1, 2 * n + 1))
Ejemplo n.º 3
0
def test_sympyissue_8496():
    n = Symbol("n")
    k = Symbol("k")

    pytest.raises(TypeError, lambda: catalan(n, k))
    pytest.raises(TypeError, lambda: euler(n, k))
Ejemplo n.º 4
0
def test_euler():
    assert euler(0) == 1
    assert euler(1) == 0
    assert euler(2) == -1
    assert euler(3) == 0
    assert euler(4) == 5
    assert euler(6) == -61
    assert euler(8) == 1385

    assert euler(20, evaluate=False) != 370371188237525

    n = Symbol('n', integer=True)
    assert euler(n) != -1
    assert euler(n).subs(n, 2) == -1

    assert euler(20).evalf() == 370371188237525.0
    assert euler(20, evaluate=False).evalf() == 370371188237525.0

    assert euler(n).rewrite(Sum) == euler(n)
    # XXX: Not sure what the guy who wrote this test was trying to do with the _j and _k stuff
    assert euler(2 * n + 1).rewrite(Sum) == 0
Ejemplo n.º 5
0
def test_euler():
    assert euler(0) == 1
    assert euler(1) == 0
    assert euler(2) == -1
    assert euler(3) == 0
    assert euler(4) == 5
    assert euler(6) == -61
    assert euler(8) == 1385

    assert euler(20, evaluate=False) != 370371188237525

    n = Symbol('n', integer=True)
    assert euler(n) != -1
    assert euler(n).subs({n: 2}) == -1

    assert euler(20).evalf() == 370371188237525.0
    assert euler(20, evaluate=False).evalf() == 370371188237525.0
    assert euler(Rational(1, 2)).evalf() == euler(Rational(1, 2))

    assert euler(n).rewrite(Sum) == euler(n)
    # XXX: Not sure what the guy who wrote this test was trying to do with the _j and _k stuff
    assert euler(2*n + 1).rewrite(Sum) == 0