This has always been the original motivation for multiple dispatch, at least in my mind. You can't make objects that do their own thing in Add or Mul or whatever. There are a dozen example of this throughout SymPy, and a dozen more in user code. There are many hacky ways around it, but none are satisfactory.
The problem is, how do you dispatch Add(*args). Any argument of the Add might want to do anything with any other argument. You don't want to require that arguments be next to each other, because then something as simple as Add(yourobject, 0, yourobject) wouldn't do the right thing. You can do the n**2 passes, but does it remain efficient at that point? I think we should just start to play with this, especially now that we have a decent implementation of multiple dispatch. I'd personally rather play with this with a module that I can understand (so, e.g., matrix expressions rather than tensores), but anything is better than nothing. Aaron Meurer On Fri, Apr 11, 2014 at 5:17 AM, F. B. <[email protected]> wrote: > > > On Friday, April 11, 2014 1:29:11 AM UTC+2, Aaron Meurer wrote: >> >> There are probably little ways around these things, but nothing clean >> without dispatching in the core. > > > Another point in favor of multiple dispatching. > > By the way, tensor expressions should just become ordinary expression with > the addition of an index management mechanism, as well as other features > such as components data association. > > Of course some precautions should be taken, for example all indices have to > be contracted if you take the exponential of a tensor expression (I am > wondering, did anyone ever define a unique and consistent way to generalize > the matrix exponential to tensors of any rank?). > > -- > 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/b7592a77-00ef-4c82-a94b-f0e904581c63%40googlegroups.com. > > 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 http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6L%2B0wx_h1YFT83swB90WwYq_fL3W6q-61frXxr-rUo0YQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
