Ejemplo n.º 1
0
def test_polygamma():
    x = Symbol("x")
    y = Symbol("y")
    e1 = sympy.polygamma(sympy.Symbol("x"), sympy.Symbol("y"))
    e2 = polygamma(x, y)
    assert sympify(e1) == e2
    assert e2._sympy_() == e1
Ejemplo n.º 2
0
def test_S():
    assert S(0) == Integer(0)
    assert S(1) == Integer(1)
    assert S(-1) == Integer(-1)
    assert S(1) / 2 == Rational(1, 2)
    assert S.One is S(1)
    assert S.Zero is S(0)
    assert S.NegativeOne is S(-1)
    assert S.Half is S(1) / 2
    assert S.Pi is pi
    assert S.NaN is S(0) / 0
    assert S.Infinity is -oo * -10
    assert S.NegativeInfinity is oo * (-3)
    assert S.ComplexInfinity is zoo
    assert S.Exp1 is (E + 1 - 1)
    assert S.ImaginaryUnit is sqrt(-1)
    assert S.GoldenRatio * 2 / 2 is GoldenRatio
    assert S.Catalan * 1 is Catalan
    assert S.EulerGamma is polygamma(0, 1) * -1
    assert S.true is Eq(2, 2)
    assert S.false is Eq(2, 3)
    assert S(1) / 0 is zoo
    assert S.Pi * 1 is pi
    assert type(S.One) == One
Ejemplo n.º 3
0
def test_trigamma():
    x = Symbol("x")
    assert trigamma(-2) == zoo
    assert trigamma(x) == polygamma(1, x)
Ejemplo n.º 4
0
def test_digamma():
    x = Symbol("x")
    assert digamma(x) == polygamma(0, x)
    assert digamma(0) == zoo
    assert digamma(1) == -EulerGamma
Ejemplo n.º 5
0
def test_polygamma():
    assert polygamma(0, -9) == zoo
    assert polygamma(0, -9) == zoo
    assert polygamma(0, -1) == zoo
    assert polygamma(0, 0) == zoo
    assert polygamma(0, 1) == -EulerGamma
    assert polygamma(0, 7) == Rational(49, 20) - EulerGamma
    assert polygamma(1, 1) == pi**2 / 6
    assert polygamma(1, 2) == pi**2 / 6 - 1
    assert polygamma(1, 3) == pi**2 / 6 - Rational(5, 4)
    assert polygamma(3, 1) == pi**4 / 15
    assert polygamma(3, 5) == 6 * (Rational(-22369, 20736) + pi**4 / 90)
    assert polygamma(5, 1) == 8 * pi**6 / 63