示例#1
0
def test_meijerg_with_Floats():
    # see sympy/sympy#10681
    f = meijerg(((3.0, 1), ()), ((Rational(3, 2),), (0,)), z)
    a = -2.3632718012073
    g = a*z**Rational(3, 2)*hyper((-0.5, Rational(3, 2)),
                                  (Rational(5, 2),), z*exp_polar(I*pi))
    assert RR.almosteq((hyperexpand(f)/g).n(), 1.0, 1e-12)
示例#2
0
def test_almosteq():
    assert CC.almosteq(CC(2), 3) is False
    assert CC.almosteq(2, CC(3)) is False
    assert CC.almosteq(2, CC(2.5), 0.1) is False
    assert CC.almosteq(2, CC(2.5), 1.0) is True

    assert RR.almosteq(5, RR(2), 1) is True
    assert RR._context.almosteq(RR(2), 1, None, 1) is True
示例#3
0
def test_sympyissue_10681():
    f = integrate(r**2 * (R**2 - r**2)**0.5, r, meijerg=True)
    g = (1.0 / 3) * R**1.0 * r**3 * hyper(
        (-0.5, Rational(3, 2)),
        (Rational(5, 2), ), r**2 * exp_polar(2 * I * pi) / R**2)
    assert RR.almosteq((f / g).n(), 1.0, 1e-12)