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<http://sympy-gamma-li.appspot.com/input/?i=2x>', 'ln x <http://sympy-gamma-li.appspot.com/input/?i=ln+x>', and '5exp(x^2)<http://sympy-gamma-li.appspot.com/input/?i=5exp%28x%5E2%29>' 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<https://github.com/lidavidm/sympy/blob/sympify_implicit_mul_and_apply/sympy/parsing/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<https://github.com/sympy/sympy/wiki/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<http://nltk.org/>. > 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 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.