On Sat, Dec 27, 2008 at 7:35 AM, Robert Kern <robert.k...@gmail.com> wrote: > > I'm spending my holiday tinkering time playing around with Parsing > Expression Grammars (Google it, if you're curious). I'd like to make a > PEG implementation that works on arbitrary Python sequences in > addition to strings and apply it to the task of pattern matching over > sympy expressions. I have two(!) runtimes implemented now, and they > seem to work for typical string-parsing tasks (recognition and AST > construction) but I still need to work on substitution and semantic > actions.
Pretty cool. I've never heard of PEG before, but after reading some stuff now, it seems interesting. > Have you ever felt constrained by the current .rewrite()/.subs() > functionality? Yeah. We also have .match(). > Is there some sophisticated pattern-matching available > in some other symbolic math system that you wish sympy could do? If I don't know of any, it seems to me Mathematica just has the .match(), maybe a little bit more polished. > you can describe what you'd like to be able to do, I'll see what I can > do about implementing it. Well, for example I'd like the trigsimp() to be simpler, see sympy/simplify/simplify.py. It currently uses a mix of .match() and handwritten parsing. If you know how to make this simpler, for example using PEG, or anything else, that's be really awesome. It can simplify some stuff: In [4]: trigsimp(sin(x)**2+2*cos(x)**2) Out[4]: 2 2 - sin (x) But we need to add more rules to it, for example for tan: In [5]: trigsimp(tan(x)*cos(x)) Out[5]: cos(x)â‹…tan(x) if you have some ideas how to approach this problem, so that the code is easy to understand, extensible and maintainable, it'd be cool. Thanks for any work you do, Ondrej --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---