IMHO, has() specifically should operate symbolically (no knowledge of mathematics).
This old pull request seems relevant here https://github.com/sympy/sympy/pull/7437. I think having methods for objects to tell how to differentiate themselves is better than hacking around the implementation details of the current implementation. I think f(x).diff(f(y)) should return 0, for the same reason that x.diff(y) should return 0. We've had some in-depth discussions on what differentiating with respect to a function should mean in SymPy, and the thing we agreed on is that expr.diff(f(x)) should be the same as expr.xreplace({f(x): y}).diff(y).xreplace({y: f(x)}). Specifically, xreplace means it only looks at things structurally. Aaron Meurer On Tue, Jul 19, 2016 at 8:14 AM, Kalevi Suominen <jks...@gmail.com> wrote: > > > On Tuesday, July 19, 2016 at 11:52:43 AM UTC+3, Francesco Bonazzi wrote: >> >> >> Concerning functions, a similar problem could arise: >> >> In [15]: f(x).diff(f(x)) >> Out[15]: 1 >> >> In [17]: f(x).diff(f(y)) >> Out[17]: 0 >> >> >> I think that output 17 should be a Dirac delta function: DiracDelta(x - >> y). What do you think? >> > > It seems to me that Dirac delta is not appropriate here since it is a > 'generalized function' of a real > variable only in SymPy. Probably some new class of objects, formally > integrable over a complex > domain, would be needed to implement this idea. > > -- > 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 post to this group, send email to sympy@googlegroups.com. > Visit this group at https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/5c543674-9a8f-461e-955b-44ddc8220476%40googlegroups.com > <https://groups.google.com/d/msgid/sympy/5c543674-9a8f-461e-955b-44ddc8220476%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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 post to this group, send email to sympy@googlegroups.com. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6KZwQExuyhbyvpjYFuuDKjwgUM14zXuqeKCKi3p19L19g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.