I am trying to fix the unit system module in SymPy, and I got into a problem:
>>> meter + second meter + second >>> length + time length + time Such expressions create an *Add* object. Technically, they such raise an exception, given that the summation involves incompatible dimensions. Obviously, *Add* does not know about all of this, and just creates an *Add* object. The point is, what about adding some Python magic (or similar tricks) to make it possible, when some submodules are loaded, to extend the constructors for *Add*, *Mul*, *Pow*, and possibly also for SymPy functions? We also have a related problem concerning matrix symbols, as operations on them need to be consistent with their dimensions. The problem is currently solved by ad-hoc *MatMul*, *MatAdd* classes. This causes them to lack a lot of features/operations from *Add*, *Mul*. Subclassing also appears to cause problems. Other instances are tensor indices in implicit summation mode. One problem that might arise is the inability of adding methods specific for those kind of operations (such as matrix symbol related methods implemented in *MatAdd*, *MatMul*). This could be avoided by using non-class functinos though. What do you think? -- 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/0b0a8187-6b23-47eb-a4e5-bbb4609e5375%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
