Use simplify(diff(-x*log(-x + y) + y*log(x - y) - y,y)) instead of only diff(-x*log(-x + y) + y*log(x - y) - y,y)
as mentioned by Kalevi sympy does not do the simplification part autometically. and in sympy during integration sometimes the constants make a difference. Hope it helps. On Thursday, October 22, 2015 at 7:26:35 PM UTC+5:30, Filip wrote: > > I'm trying to integrate ln(x-y) dy, but the result I get from SymPy is > very different from Maple's answer. > Here is what I get when I integrate in SymPy: > In [2]: > > integrate(ln(x-y), y) > > Out[2]: > > -x*log(-x + y) + y*log(x - y) - y > > > When I try to differentiate this, i get something very different from > ln(x-y): > In [3]: > > diff(-x*log(-x + y) + y*log(x - y) - y, y) > > Out[3]: > > -x/(-x + y) - y/(x - y) + log(x - y) - 1 > > > Is this a bug in SymPy, or a user error? > > When i differentiate the answer I get when I integrate using Maple, i get > the expected result ln(x-y) > In [4]: > > diff(-ln(x-y)*(x-y)+x-y, y) > > Out[4]: > > log(x - y) > > > An IPython Notebook with an example can be found here: > http://nbviewer.ipython.org/gist/FSund/d3b3f7f590db0e72e2e2 > > I'm using Python 3.4.3 (Anaconda 2.3.0 (64-bit)), and IPython 4.0.0. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/2f0baa63-24cc-4568-89b7-c70c824ed0ad%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
