This is great. Yes, so far it is quite buggy. sin(x) gives a NameError, and x + y gives a pretty nasty error. Also you should think about good error messages, because even if you fix these bugs, the parser will still be heuristic, and so there will still be things that won't be recognized as the user wants, either because it isn't implemented, or because it is too ambiguous to attempt a guess.
Perhaps you could split out the new interface commits into a separate branch and submit that as a pull request, because I think that much is ready to go. Aaron Meurer On Sat, Sep 8, 2012 at 5:43 PM, David Li <[email protected]> wrote: > Okay, so I've worked a bit on implicit multiplication and implicit function > application for sympify. A demo of SymPy Gamma with the changes is at > http://sympy-gamma-li.appspot.com/ (+ a visual overhaul, update to Python > 2.7 runtime, new Django version). Expressions like '2x', 'ln x', and > '5exp(x^2)' should work now. > > The SymPy branch is at > https://github.com/lidavidm/sympy/tree/sympify_implicit_mul_and_apply. I am > still working on making sure the implicit application doesn't apply to None, > True, False, and other constants, making sure I haven't broken > anything/missed an edge case, and cleaning up the code. Also, I would like > to add tests for the Python parser. In fact, I found a bug as I was writing > this - (x+2)(x+3) doesn't get correctly parsed. > > Implementation: in sympy_parser.py I simply loop over the tokens several > times and apply a variety of transformations. I haven't benchmarked this to > see how much of a performance impact the loops have. I also check for NAME > tokens and split them up if they don't turn out to be in the global scope or > something like that, so 'xy' gets parsed as 'x y'. > > David Li > > > On Monday, September 3, 2012 11:31:35 AM UTC-7, David Li wrote: >> >> Hello all, >> >> As a high school student, I am encouraged to conduct a science fair >> experiment each year. I became interested in contributing to SymPy through >> the 2011 Google Code-In project, and for this year, I am interested in >> somehow working on SymPy for science fair. I reviewed the GSoC 2012 Ideas >> and believe I could work on a few of those ideas, in particular, >> implementing by-hand differentiation/integration in order to show steps or >> working on some sort of natural-language input for SymPy Gamma/sympify. My >> question is, are these projects desirable for SymPy, and are there other >> project ideas (that you think would be approachable)? >> >> I saw the discussion on SymPy Gamma at >> https://groups.google.com/forum/?fromgroups=#!topic/sympy/YJNc_MoccYg; >> however, there seems to have been little development since then. Is this >> still a project SymPy would like to pursue? For a project, I could >> investigate natural-language input, perhaps by integrating NLTK. After >> playing with NLTK, I think some areas of research could involve improving >> the tokenizer to handle math expressions (for instance, currently 'tan(x)' >> gets parsed as ['tan', '(', 'x', ')']), and of course, actually interpreting >> the input. A different project would involve investigating/implementing >> by-hand differentiation/integration methods so that SymPy could show steps. >> >> To give some background about my learning, I am currently taking >> Multivariable Calculus/Differential Equations. I have completed AP Calculus >> BC; I have basic knowledge of logic and set theory, but that is the extent >> of my mathematical knowledge. >> >> Thank you, >> David Li > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/sympy/-/SBll6sBsNuoJ. > > 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. -- 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.
