On Thu, Sep 26, 2013 at 6:37 PM, Aaron Meurer <asmeu...@gmail.com> wrote: > My idea was to put assumptions on Wild expressions. I guess using the > new assumptions system, the assumptions do not need to be, nor should > they be, actually tied to the symbols. This will also make it easy to > add assumptions about general expressions, not just Wilds (and make it > easier to do the sorts of things Angus was talking about). So > something like > > expr = x + 2 > a = Wild('a', exclude=[x]) > expr.match(x + a, assumptions=Q.positive(a)) > > would work, but for > > expr = x - 2 > > it would not match. > > One could then specify arbitrary assumptions, and match would refuse > to return any result where the assumptions are False. Or you could add > a flag to make it even stronger: don't return a result unless the > assumptions are True (as opposed to None). > > This may be far reaching and could be a bad idea, but I think we could > then extend the assumptions system to allow "assumptions" like > Q.free_of(a, x) to mean that a does not depend on x, or > Q.isinstance(a, Mul) to mean that a is a Mul. > > The new assumptions system is still relatively weak and needs to be > integrated into SymPy better, so this would be a lofty goal. But > assuming we can unify the system, and get something like > https://code.google.com/p/sympy/issues/detail?id=3929, I think this > would be a nice way to specify things, much better (and more powerful) > than throwing a bunch of lambdas around.
So we definitely need to implement Rubi, I created an issue for it with motivation + steps to do: https://github.com/sympy/sympy/issues/7749 a prerequisite and a separate issue is fast pattern matching, that can handle ~10,000 rules quickly, which needs to be based on a decision tree: https://github.com/sympy/sympy/issues/7748 I have explained in details how it could work there. So it will require to rewrite the pattern matching, but I think most of the things from the current one can be reused, essentially one just traverses the expression tree just like now, but for all the rules at once using a decision tree. The #7748 is independent of #7749, but I think both issues should be solved concurently, as #7749 provides an application for #7748, that needs to work well and fast. Ondrej -- 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 sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. 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/CADDwiVCFw9nFT5Tv9ooqXMUh08M7FLONP-q62DfEu%2BpO%2BGMnmg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.