Ejemplo n.º 1
0
def test_diff_series():
    # issue sympy/sympy#11313
    # test Derivative series & as_leading_term
    assert Derivative(x**3 + x**4, x).as_leading_term(x).doit() == 3 * x**2
    s = Derivative(sin(x), x).series(x, n=3)
    assert s == Derivative(-x**3 / 6, x) + Derivative(x, x) + O(x**3)
    assert s.doit() == 1 - x**2 / 2 + O(x**3)
Ejemplo n.º 2
0
def test_doit():
    n = Symbol('n', integer=True)
    f = Sum(2 * n * x, (n, 1, 3))
    d = Derivative(f, x)
    assert d.doit() == 12
    assert d.doit(deep=False) == Sum(2 * n, (n, 1, 3))
Ejemplo n.º 3
0
def test_sympyissue_11313():
    # test Derivative series & as_leading_term
    assert Derivative(x**3 + x**4, x).as_leading_term(x).doit() == 3*x**2
    s = Derivative(sin(x), x).series(x, n=3)
    assert s == Derivative(-x**3/6, x) + Derivative(x, x) + O(x**3)
    assert s.doit() == 1 - x**2/2 + O(x**3)
Ejemplo n.º 4
0
def test_doit():
    n = Symbol('n', integer=True)
    f = Sum(2 * n * x, (n, 1, 3))
    d = Derivative(f, x)
    assert d.doit() == 12
    assert d.doit(deep=False) == Sum(2*n, (n, 1, 3))