def test_sin(): x = Symbol("x") e = sin(x) assert e == sin(x) assert e != cos(x) assert sin(x).diff(x) == cos(x) assert cos(x).diff(x) == -sin(x) e = sqrt(x).diff(x).diff(x) f = sin(e) g = f.diff(x).diff(x) assert isinstance(g, Add)
def test_sin(): x = Symbol("x") y = Symbol("y") e = sin(x) assert e.subs({x: y}) == sin(y) assert e.subs({x: y}) != sin(x) e = cos(x) assert e.subs({x: 0}) == 1 assert e.subs(x, 0) == 1
def test_abs(): x = Symbol("x") e = abs(x) assert e == abs(x) assert e != cos(x) assert abs(5) == 5 assert abs(-5) == 5 assert abs(Integer(5)/3) == Integer(5)/3 assert abs(-Integer(5)/3) == Integer(5)/3 assert abs(Integer(5)/3+x) != Integer(5)/3 assert abs(Integer(5)/3+x) == abs(Integer(5)/3+x)
def test_conv7b(): x = sympy.Symbol("x") y = sympy.Symbol("y") assert sympify(sympy.sin(x / 3)) == sin(Symbol("x") / 3) assert sympify(sympy.sin(x / 3)) != cos(Symbol("x") / 3) assert sympify(sympy.cos(x / 3)) == cos(Symbol("x") / 3)
def test_conv7(): x = Symbol("x") y = Symbol("y") assert sin(x / 3)._sympy_() == sympy.sin(sympy.Symbol("x") / 3) assert sin(x / 3)._sympy_() != sympy.cos(sympy.Symbol("x") / 3) assert cos(x / 3)._sympy_() == sympy.cos(sympy.Symbol("x") / 3)
def test_args(): x = Symbol("x") e = cos(x) f = e.subs(x, 0, 3)
def test_args(): x = Symbol("x") e = cos(x) raises(TypeError, lambda: e.subs(x, 0, 3))
def test_eval_double2(): x = Symbol("x") y = Symbol("y") e = sin(x)**2 + cos(x)**2 raises(RuntimeError, lambda: (abs(eval_double(e) - 1) < 1e-9))
def test_eval_double1(): x = Symbol("x") y = Symbol("y") e = sin(x)**2 + cos(x)**2 e = e.subs(x, 7) assert abs(eval_double(e) - 1) < 1e-9
def test_eval_double2(): x = Symbol("x") y = Symbol("y") e = sin(x)**2 + cos(x)**2 assert abs(eval_double(e) - 1) < 1e-9
def test_conv7(): x = Symbol("x") y = Symbol("y") assert sin(x/3)._sympy_() == sympy.sin(sympy.Symbol("x") / 3) assert sin(x/3)._sympy_() != sympy.cos(sympy.Symbol("x") / 3) assert cos(x/3)._sympy_() == sympy.cos(sympy.Symbol("x") / 3)
def test_conv7b(): x = sympy.Symbol("x") y = sympy.Symbol("y") assert sympify(sympy.sin(x/3)) == sin(Symbol("x") / 3) assert sympify(sympy.sin(x/3)) != cos(Symbol("x") / 3) assert sympify(sympy.cos(x/3)) == cos(Symbol("x") / 3)