# New Features for Gamma

SymPy Gamma is essentially SymPy’s clone of Wolfram|Alpha, at least in terms of math features. We just rolled out some new features:

Improved plotting, still based on D3.js

Multiple graphs on one plot:

Polar and parametric equations:

Diophantine equation solving:

`diophantine(3*x**2 + 4*y**2 - 5*z**2 + 4*x*y - 7*y*z + 7*z*x)`

Recurrence relation solving:

`rsolve(y(n+2)-y(n+1)-y(n), y(n), {y(0): 0, y(1): 1})`

- Boolean logic results:
An updated version of SymPy, and various other improvements

Gamma's (and by extension, SymPy's) parsing still needs work, though, when it comes to the implicit style. Consider, for instance, the input `y(x)`

. Is this

- The function \(\mathrm{y}(x)\), or
- The product \(yx\)?

This makes inputs ambiguous, at least to the parser. For instance, it makes sense that `expand(a(x + 1) + b(x + 2))`

should be \(ax + bx + a + b\) and not \(\mathrm{a}(x+1) + \mathrm{b}(x+2)\). Meanwhile, `rsolve(y(n+2) - y(n+1) - y(n), y(n))`

wouldn't make any sense as \(\mathrm{rsolve}(ny + 2y - ny - y - ny, ny)\).

How do we solve this problem? I see three, non-mutually-exclusive ways:

- Provide an "interpret as" functionality, like Wolfram|Alpha. For functions, you can also explicitly specify a function symbol with
`Function("f")(x)`

, though this is rather tedious to type. - Give the parser a whitelist/blacklist of functions to use implicit function or implicit multiplication syntax.
- Try it both ways and take the one that doesn't raise an exception.

So in the future, I'd like to improve SymPy's parser more -- and hopefully, someday add natural language parsing to Gamma. Dealing with these ambiguities is a first step towards that.

comments powered by Disqus