def test_issue1512(): assert abs(pi._evalf(50) - 3.14159265358979) < 1e-10 assert abs(E._evalf(50) - 2.71828182845905) < 1e-10 assert abs(Catalan._evalf(50) - 0.915965594177219) < 1e-10 assert abs(EulerGamma._evalf(50) - 0.577215664901533) < 1e-10 assert abs(GoldenRatio._evalf(50) - 1.61803398874989) < 1e-10 x = Symbol("x") assert (pi+x).evalf() == pi.evalf()+x assert (E+x).evalf() == E.evalf()+x assert (Catalan+x).evalf() == Catalan.evalf()+x assert (EulerGamma+x).evalf() == EulerGamma.evalf()+x assert (GoldenRatio+x).evalf() == GoldenRatio.evalf()+x
def test_sympy(): x = Symbol('x', real = True) assert -oo < oo assert not(-1.5 < -oo) assert (1 - exp(x)).is_negative is None assert Matrix([[1, 2], [3, 4]])**Integer(2) == Matrix([[7, 10], [15, 22]]) assertAlmostEqual(E._evalf(50), math.e) assert solve(1/x, x) == [] # issue 1694 assert solve(-(1 + x)/(2 + x)**2 + 1/(2 + x), x) == [] # issue 1694 assert limit(1 + 1/x, x, 0, dir='-') == -oo assert limit(1/x**2, x, 0, dir='-') == oo assert sympify(u'45') == 45 # issue 2508
def test_issue_4611(): assert abs(pi._evalf(50) - 3.14159265358979) < 1e-10 assert abs(E._evalf(50) - 2.71828182845905) < 1e-10 assert abs(Catalan._evalf(50) - 0.915965594177219) < 1e-10 assert abs(EulerGamma._evalf(50) - 0.577215664901533) < 1e-10 assert abs(GoldenRatio._evalf(50) - 1.61803398874989) < 1e-10 x = Symbol("x") assert (pi + x).evalf() == pi.evalf() + x assert (E + x).evalf() == E.evalf() + x assert (Catalan + x).evalf() == Catalan.evalf() + x assert (EulerGamma + x).evalf() == EulerGamma.evalf() + x assert (GoldenRatio + x).evalf() == GoldenRatio.evalf() + x
def test_sympy(): x = Symbol('x', real=True) assert -oo < oo assert not (-1.5 < -oo) assert (1 - exp(x)).is_negative is None assert Matrix([[1, 2], [3, 4]])**Integer(2) == Matrix([[7, 10], [15, 22]]) assertAlmostEqual(E._evalf(50), math.e) assert solve(1 / x, x) == [] # issue 1694 assert solve(-(1 + x) / (2 + x)**2 + 1 / (2 + x), x) == [] # issue 1694 assert limit(1 + 1 / x, x, 0, dir='-') == -oo assert limit(1 / x**2, x, 0, dir='-') == oo assert sympify(u'45') == 45 # issue 2508