def test_Subs(): x = Symbol("x") y = Symbol("y") _x = Symbol("_xi_1") f = function_symbol("f", 2*x) assert f.diff(x) == 2 * Subs(Derivative(function_symbol("f", _x), [_x]), [_x], [2 * x]) assert Subs(Derivative(function_symbol("f", x, y), [x]), [x, y], [_x, x]) \ == Subs(Derivative(function_symbol("f", x, y), [x]), [y, x], [x, _x])
def test_conv11(): x = sympy.Symbol("x") y = sympy.Symbol("y") x1 = Symbol("x") y1 = Symbol("y") e1 = sympy.Subs(sympy.Derivative(sympy.Function("f")(x, y), x), [x, y], [y, y]) e2 = Subs(Derivative(function_symbol("f", x1, y1), [x1]), [x1, y1], [y1, y1]) e3 = Subs(Derivative(function_symbol("f", x1, y1), [x1]), [y1, x1], [x1, y1]) assert sympify(e1) == e2 assert sympify(e1) != e3 assert e2._sympy_() == e1 assert e3._sympy_() != e1
def test_Subs(): x = Symbol("x") y = Symbol("y") _x = Symbol("_xi_1") f = function_symbol("f", 2*x) assert str(f.diff(x)) == "2*Subs(Derivative(f(_xi_1), _xi_1), (_xi_1), (2*x))" # TODO: fix me # assert f.diff(x) == 2 * Subs(Derivative(function_symbol("f", _x), _x), [_x], [2 * x]) assert Subs(Derivative(function_symbol("f", x, y), x), [x, y], [_x, x]) \ == Subs(Derivative(function_symbol("f", x, y), x), [y, x], [x, _x]) s = f.diff(x)/2 _xi_1 = Symbol("_xi_1") assert s.expr == Derivative(function_symbol("f", _xi_1), _xi_1) assert s.variables == (_xi_1,) assert s.point == (2*x,)