Yes, I agree this is the way to do it. It's essentially the idea from https://code.google.com/p/sympy/issues/detail?id=2738. But again, I'm really not sure exactly *how* to do it, down to the implementation details. So I really feel (at least for myself) that I don't quite understand the abstractions and the proper separation of ideas yet. It's a hard problem, and as I mentioned earlier, not one that I plan on working on myself in the foreseeable future (I'm already working on another hard problem, namely the assumptions system).
Aaron Meurer On Sun, Nov 10, 2013 at 4:08 PM, F. B. <[email protected]> wrote: > > On Sunday, November 10, 2013 11:31:38 PM UTC+1, Aaron Meurer wrote: >> >> >> Mathematically, + has a thousand meanings, and we blur the >> distinctions because they all act similarly. But at some point in a >> CAS, you have to unblur any notational convenience that you would >> otherwise make on paper. > > > In Wolfram Mathematica, + is a Plus M-expression, always. They don't have > any MatPlus, or whatever. > > The behavior upon it is determined by pattern matching. I don't know how it > works, but I guess that Mathematica builds up some indices to speed up the > pattern search. > > I don't think pattern matching is the only way. I would suggest to make Add, > Mul and Power just containers for the corresponding operators (+, *, **), > while creating parallel classes to represent the precise logical operation > that those signs are meant to represent. > > Otherwise, things could be done the opposite way, create an Add-like object > for every logical operation, which means making Add abstract, and along with > already existing classes like MatAdd, add stuff like: AssocAdd, > InfinitiesAdd, NCAdd, InfinitiesNonCommutativeAdd, NumericAdd, QuantumOpAdd > and so on. I don't think this is a good idea, too many classes to define. > > -- > 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. > For more options, visit https://groups.google.com/groups/opt_out. -- 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. For more options, visit https://groups.google.com/groups/opt_out.
