I want to make the following more specific Most classes like Add, MatAdd, etc... do serve two purposes as you say. My > names for these are as follows > Container -- they act as a typed tuple and contain args > Canonicalizer -- they take in different inputs like "x + y" and "y + x" > and produce a normalized form > > Rules do strip out a fair amount of canonicalization and leave the classes > as mostly just containers. You could use rules for everything and make the > classes just containers. This is a question of programming style though, I > don't think that it's objectively better or worse. If you wanted to do this > I think you would just make a new project. SymPy has its own thing going on > and it works pretty well. I've made a project that was based on just rules > for matrix expressions. It was neat, I had fun, but I don't expect the > world to suddenly decide that rules are how we should do things. Balance is > healthy. >
On creation our classes create a new node in our tree and hook up some children newnode = Add(*args) They also simplify and transform the args. So far I've used rules to pull out the simplification part. I call this canonicalize above. Our classes serve a third purpose that I didn't mention before. They also have methods like MatMul._eval_transpose. If we wanted to we could swap these methods out for rules as well. This is what my silly prototype code here does https://github.com/mrocklin/matrix-algebra/blob/master/src/algebra.maude#L41 If we do this then classes are stripped down to just act as typed tuples in our graph and nothing more. This is a really interesting way to program. It's not clear that this is appropriate for SymPy though. So lets define the current functionality of classes as Container + Canonicalizer + Method-collection. I think that it would be awesome if canonicalization was handled by rules. This is what I've done in matrix expressions. I haven't yet touched the methods yet though. I'm not sure what my plans are for them. -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
