def test_diff(): x, y = symbols('x, y') assert Rational(1, 3).diff(x) is S.Zero assert I.diff(x) is S.Zero assert pi.diff(x) is S.Zero assert x.diff(x, 0) == x assert (x**2).diff(x, 2, x) == 0 assert (x**2).diff(x, y, 0) == 2 * x assert (x**2).diff(x, y) == 0 pytest.raises(ValueError, lambda: x.diff(1, x)) a = Symbol("a") b = Symbol("b") c = Symbol("c") p = Rational(5) e = a * b + b**p assert e.diff(a) == b assert e.diff(b) == a + 5 * b**4 assert e.diff(b).diff(a) == Rational(1) e = a * (b + c) assert e.diff(a) == b + c assert e.diff(b) == a assert e.diff(b).diff(a) == Rational(1) e = c**p assert e.diff(c, 6) == Rational(0) assert e.diff(c, 5) == Rational(120) e = c**Rational(2) assert e.diff(c) == 2 * c e = a * b * c assert e.diff(c) == a * b
def test_diff(): x, y = symbols('x, y') assert Rational(1, 3).diff(x) is Integer(0) assert I.diff(x) is Integer(0) assert pi.diff(x) is Integer(0) assert x.diff(x, 0) == x assert (x**2).diff(x, 2, x) == 0 assert (x**2).diff(x, y, 0) == 2*x assert (x**2).diff(x, y) == 0 pytest.raises(ValueError, lambda: x.diff(1, x)) a = Symbol("a") b = Symbol("b") c = Symbol("c") p = Integer(5) e = a*b + b**p assert e.diff(a) == b assert e.diff(b) == a + 5*b**4 assert e.diff(b).diff(a) == 1 e = a*(b + c) assert e.diff(a) == b + c assert e.diff(b) == a assert e.diff(b).diff(a) == 1 e = c**p assert e.diff(c, 6) == 0 assert e.diff(c, 5) == 120 e = c**2 assert e.diff(c) == 2*c e = a*b*c assert e.diff(c) == a*b f = Function('f') assert f(x).diff(x, 2).diff(f(x).diff(x, 1)) == 0
def test_diff(): x, y = symbols('x, y') assert Rational(1, 3).diff(x) is Integer(0) assert I.diff(x) is Integer(0) assert pi.diff(x) is Integer(0) assert x.diff(x, 0) == x assert (x**2).diff(x, 2, x) == 0 assert (x**2).diff(x, y, 0) == 2*x assert (x**2).diff(x, y) == 0 pytest.raises(ValueError, lambda: x.diff(1, x)) a = Symbol('a') b = Symbol('b') c = Symbol('c') p = Integer(5) e = a*b + b**p assert e.diff(a) == b assert e.diff(b) == a + 5*b**4 assert e.diff(b).diff(a) == 1 e = a*(b + c) assert e.diff(a) == b + c assert e.diff(b) == a assert e.diff(b).diff(a) == 1 e = c**p assert e.diff(c, 6) == 0 assert e.diff(c, 5) == 120 e = c**2 assert e.diff(c) == 2*c e = a*b*c assert e.diff(c) == a*b f = Function('f') assert f(x).diff(x, 2).diff(f(x).diff(x, 1)) == 0
def test_diff(): assert Rational(1, 3).diff(x) is Integer(0) assert I.diff(x) is Integer(0) assert pi.diff(x) is Integer(0) assert x.diff((x, 0)) == x assert (x**2).diff((x, 2), x) == 0 assert (x**2).diff(x, (y, 0)) == 2*x assert (x**2).diff(x, y) == 0 pytest.raises(ValueError, lambda: x.diff((1, x))) p = Integer(5) e = a*b + b**p assert e.diff(a) == b assert e.diff(b) == a + 5*b**4 assert e.diff(b).diff(a) == 1 e = a*(b + c) assert e.diff(a) == b + c assert e.diff(b) == a assert e.diff(b).diff(a) == 1 e = c**p assert e.diff((c, 6)) == 0 assert e.diff((c, 5)) == 120 e = c**2 assert e.diff(c) == 2*c e = a*b*c assert e.diff(c) == a*b f = Function('f') assert f(x).diff((x, 2)).diff(f(x).diff((x, 1))) == 0