コード例 #1
0
def test_ff_eval_apply():
    x, y = symbols('x,y')

    assert ff(nan, y) == nan

    assert ff(x, y) == ff(x, y)

    assert ff(oo, 0) == 1
    assert ff(-oo, 0) == 1

    assert ff(oo, 6) == oo
    assert ff(-oo, 7) == -oo

    assert ff(oo, -6) == oo
    assert ff(-oo, -7) == oo
    assert ff(-oo, 2) == oo

    assert ff(x, 0) == 1
    assert ff(x, 1) == x
    assert ff(x, 2) == x*(x - 1)
    assert ff(x, 3) == x*(x - 1)*(x - 2)
    assert ff(x, 5) == x*(x - 1)*(x - 2)*(x - 3)*(x - 4)

    assert ff(x, -1) == 1/(x + 1)
    assert ff(x, -2) == 1/((x + 1)*(x + 2))
    assert ff(x, -3) == 1/((x + 1)*(x + 2)*(x + 3))

    assert ff(100, 100) == factorial(100)

    n = Symbol('n', integer=True)
    k = Symbol('k', integer=True)
    m = Symbol('m', integer=True, nonnegative=True)
    assert ff(x, m).is_integer is None
    assert ff(n, k).is_integer is None
    assert ff(n, m).is_integer is True
コード例 #2
0
def test_ff_eval_apply():
    x, y = symbols('x,y')

    assert ff(nan, y) == nan

    assert ff(x, y) == ff(x, y)

    assert ff(oo, 0) == 1
    assert ff(-oo, 0) == 1

    assert ff(oo, 6) == oo
    assert ff(-oo, 7) == -oo

    assert ff(oo, -6) == oo
    assert ff(-oo, -7) == oo
    assert ff(-oo, 2) == oo

    assert ff(x, 0) == 1
    assert ff(x, 1) == x
    assert ff(x, 2) == x * (x - 1)
    assert ff(x, 3) == x * (x - 1) * (x - 2)
    assert ff(x, 5) == x * (x - 1) * (x - 2) * (x - 3) * (x - 4)

    assert ff(x, -1) == 1 / (x + 1)
    assert ff(x, -2) == 1 / ((x + 1) * (x + 2))
    assert ff(x, -3) == 1 / ((x + 1) * (x + 2) * (x + 3))

    assert ff(100, 100) == factorial(100)

    n = Symbol('n', integer=True)
    k = Symbol('k', integer=True)
    m = Symbol('m', integer=True, nonnegative=True)
    assert ff(x, m).is_integer is None
    assert ff(n, k).is_integer is None
    assert ff(n, m).is_integer is True
コード例 #3
0
def test_sympyissue_14822():
    assert rf(Rational(2, 3), 32).evalf() == Float('+6.0994868747569084e+34', dps=15)
    assert ff(Rational(2, 3), 32).evalf() == Float('-2.066175896913914e+32', dps=15)
コード例 #4
0
def test_sympyissue_14822():
    assert rf(Rational(2, 3), 32).evalf() == Float('+6.0994868747569084e+34',
                                                   dps=15)
    assert ff(Rational(2, 3), 32).evalf() == Float('-2.066175896913914e+32',
                                                   dps=15)