On Fri, Jul 22, 2016 at 5:02 AM, Francesco Bonazzi <[email protected]> wrote:
> > > On Tuesday, 19 July 2016 20:49:19 UTC+2, Aaron Meurer wrote: >> >> IMHO, has() specifically should operate symbolically (no knowledge of >> mathematics). >> >> > Well, it's not really about knowledge of mathematics. It's about matching > the unapplied element or the element applied with another argument. > It's mathematics in the sense that it's something beyond the internal tree representation of the object. A[j] is not a subexpression of A[i] as expression trees. A[i].has(A) is different. But again, I don't think diff should check for just matching functions in general. So we need an API so that this sort of thing can work with objects like Indexed and matrix expression, but not for everything. Plus, matrix derivatives get more complicated than this, so I suspect a more general API will be needed to fully express them. Aaron Meurer > > >> 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. >> >> > OK, what about extending *Indexed* to support continuous indexing? > *Indexed* is meant to represent a set of symbols, I think we could add a > *continuous=True/False > *option defaulting to *False* and have something like this: > > >>> A = Indexed("A") > >>> A[i].diff(A[j]) > KroneckerDelta(i, j) > >>> B = Indexed("B", continuous=True) > >>> var("x, y", real=True) > >>> B[x].diff(B[y]) > DiracDelta(x - y) > > The *KroneckerDelta *is already in the development branch. > > Kalevi, I think that generalizing the Dirac delta to complex numbers is a > bit out of scope. Besides, do SymPy users really need it? > > -- > 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 https://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/2b2f5dac-01d8-44f3-942c-dfb301757dcd%40googlegroups.com > <https://groups.google.com/d/msgid/sympy/2b2f5dac-01d8-44f3-942c-dfb301757dcd%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 [email protected]. To post to this group, send email to [email protected]. 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%3D6Kk7pawV1Z%3DdMpKj7a5A2jJ8mq%3DuhPNCSrcyp6PihoGWA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
