Status: Accepted
Owner: asmeurer
Labels: Type-Defect Priority-Medium WrongResult EasyToFix

New issue 2300 by asmeurer: x.diff(4) doesn't fail
http://code.google.com/p/sympy/issues/detail?id=2300

In [261]: x.diff(4)
Out[261]: x

In [262]: x.diff(2*x
   .....: )
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/Users/aaronmeurer/Documents/Python/sympy/sympy/<ipython console> in <module>()

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/expr.py in diff(self, *symbols, **assumptions)
   1474         new_symbols = map(sympify, symbols) # e.g. x, 2, y, z
   1475         assumptions.setdefault("evaluate", True)
-> 1476         return Derivative(self, *new_symbols, **assumptions)
   1477
   1478     def fdiff(self, *indices):

/Users/aaronmeurer/Documents/Python/sympy/sympy/sympy/core/function.py in __new__(cls, expr, *symbols, **assumptions)
    555
556 if i == iwas: # didn't get an update because of bad input --> 557 raise ValueError('Derivative expects Symbol [, Integer] args but got %s, %s' % (s, count))
    558
    559             symbol_count.append((s, count))

ValueError: Derivative expects Symbol [, Integer] args but got 2*x, 1

As the error message in the second one suggests, the first argument to diff should be a Symbol, so x.diff(4) should raise the same ValueError.

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to