On Tue, 24 Jun 2025 at 11:38, 'Andreas Söll' via sympy <sympy@googlegroups.com> wrote: > > What am I doing wrong? > > >>> from sympy import * # Version 1.13.2 > >>> x = symbols("x") > >>> f = x / (x+1) > >>> f > x/(x + 1) > >>> integrate(diff(f,x),x) # should be x/(x+1) > -1/(x + 1) > > diff seems correct - what about integrate?
Antiderivatives are not unique. Generally diff(integrate(f(x), x), x) == f(x) but we don't necessarily have integrate(diff(f(x), x), x) == f(x) because they can differ by a constant of integration: >>> cancel(f - integrate(diff(f, x), x)) 1 >>> cancel(f - diff(integrate(f, x), x)) 0 -- Oscar -- 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 sympy+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/sympy/CAHVvXxR0k4vRuXJSEtLMqY%2BTLExaXWXe5K7iLeO6CDBaeLdSrw%40mail.gmail.com.